forked from lthn/blockchain
improve over all tx to json serialization
This commit is contained in:
parent
a7a4505b79
commit
02da52eb0d
2 changed files with 5 additions and 3 deletions
|
|
@ -157,7 +157,7 @@ inline
|
|||
bool do_serialize(json_archive<true>& ar, std::string& v)
|
||||
{
|
||||
ar.begin_string();
|
||||
ar.stream() << v;
|
||||
ar.stream() << epee::string_tools::buff_to_hex_nodelimer(v);
|
||||
ar.end_string();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -171,3 +171,4 @@ bool do_serialize(json_archive<true>& ar, bool& v)
|
|||
ar.stream() << "false";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ inline bool do_serialize(Archive &ar, T &v)
|
|||
template<> struct has_free_serializer<T> { typedef boost::true_type type; }
|
||||
#define VARIANT_TAG(A, T, Tg) \
|
||||
template <bool W> struct variant_serialization_traits<A<W>, T> { static inline typename A<W>::variant_tag_type get_tag() { return Tg; } }
|
||||
#define BEGIN_SERIALIZE() \
|
||||
template <bool W, template <bool> class Archive> bool do_serialize(Archive<W> &_ser_ar) {uint8_t s_current_version ATTRIBUTE_UNUSED = 0; uint8_t s_version ATTRIBUTE_UNUSED = 0;
|
||||
#define BEGIN_SERIALIZE() BEGIN_SERIALIZE_OBJECT()
|
||||
// template <bool W, template <bool> class Archive> bool do_serialize(Archive<W> &_ser_ar) {uint8_t s_current_version ATTRIBUTE_UNUSED = 0; uint8_t s_version ATTRIBUTE_UNUSED = 0;
|
||||
#define BEGIN_SERIALIZE_OBJECT() \
|
||||
template <bool W, template <bool> class Archive> bool do_serialize(Archive<W> &_ser_ar) {_ser_ar.begin_object(); bool _ser_res = do_serialize_object(_ser_ar); _ser_ar.end_object(); return _ser_res; } \
|
||||
template <bool W, template <bool> class Archive> bool do_serialize_object(Archive<W> &_ser_ar){ uint8_t s_current_version ATTRIBUTE_UNUSED = 0; uint8_t s_version ATTRIBUTE_UNUSED = 0;
|
||||
|
|
@ -83,6 +83,7 @@ do { \
|
|||
if (!_ser_res || !_ser_ar.stream().good()) return false; \
|
||||
} while (0);
|
||||
#define FIELDS(f) \
|
||||
_ser_ar.tag("AGGREGATED"); \
|
||||
bool _ser_res = ::do_serialize(_ser_ar, f); \
|
||||
if (!_ser_res || !_ser_ar.stream().good()) return false;
|
||||
#define FIELD(f) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue