improve over all tx to json serialization

This commit is contained in:
cryptozoidberg 2025-04-17 22:07:36 +04:00
parent a7a4505b79
commit 02da52eb0d
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
2 changed files with 5 additions and 3 deletions

View file

@ -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;
}

View file

@ -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) \