forked from lthn/blockchain
binary serialization won't mess with 'r' members anymore (fixes range proofs serialization)
This commit is contained in:
parent
7f5d58ca6d
commit
458f347e1e
1 changed files with 22 additions and 22 deletions
|
|
@ -61,10 +61,10 @@ inline bool do_serialize(Archive &ar, T &v)
|
|||
#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> &ar) {
|
||||
template <bool W, template <bool> class Archive> bool do_serialize(Archive<W> &_ser_ar) {
|
||||
#define BEGIN_SERIALIZE_OBJECT() \
|
||||
template <bool W, template <bool> class Archive> bool do_serialize(Archive<W> &ar) { ar.begin_object(); bool r = do_serialize_object(ar); ar.end_object(); return r; } \
|
||||
template <bool W, template <bool> class Archive> bool do_serialize_object(Archive<W> &ar){
|
||||
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){
|
||||
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec) ::serialization::detail::prepare_custom_vector_serialization(size, vec, typename Archive<W>::is_saving())
|
||||
|
||||
#define END_SERIALIZE() return true;}
|
||||
|
|
@ -72,30 +72,30 @@ inline bool do_serialize(Archive &ar, T &v)
|
|||
|
||||
#define VALUE(f) \
|
||||
do { \
|
||||
ar.tag(#f); \
|
||||
bool r = ::do_serialize(ar, f); \
|
||||
if (!r || !ar.stream().good()) return false; \
|
||||
_ser_ar.tag(#f); \
|
||||
bool _ser_res = ::do_serialize(_ser_ar, f); \
|
||||
if (!_ser_res || !_ser_ar.stream().good()) return false; \
|
||||
} while (0);
|
||||
#define FIELD_N(t, f) \
|
||||
do { \
|
||||
ar.tag(t); \
|
||||
bool r = ::do_serialize(ar, f); \
|
||||
if (!r || !ar.stream().good()) return false; \
|
||||
_ser_ar.tag(t); \
|
||||
bool _ser_res = ::do_serialize(_ser_ar, f); \
|
||||
if (!_ser_res || !_ser_ar.stream().good()) return false; \
|
||||
} while (0);
|
||||
#define FIELDS(f) \
|
||||
bool r = ::do_serialize(ar, f); \
|
||||
if (!r || !ar.stream().good()) return false;
|
||||
bool _ser_res = ::do_serialize(_ser_ar, f); \
|
||||
if (!_ser_res || !_ser_ar.stream().good()) return false;
|
||||
#define FIELD(f) \
|
||||
do { \
|
||||
ar.tag(#f); \
|
||||
bool r = ::do_serialize(ar, f); \
|
||||
if (!r || !ar.stream().good()) return false; \
|
||||
_ser_ar.tag(#f); \
|
||||
bool _ser_res = ::do_serialize(_ser_ar, f); \
|
||||
if (!_ser_res || !_ser_ar.stream().good()) return false; \
|
||||
} while (0);
|
||||
#define VARINT_FIELD(f) \
|
||||
do { \
|
||||
ar.tag(#f); \
|
||||
ar.serialize_varint(f); \
|
||||
if (!ar.stream().good()) return false; \
|
||||
_ser_ar.tag(#f); \
|
||||
_ser_ar.serialize_varint(f); \
|
||||
if (!_ser_ar.stream().good()) return false; \
|
||||
} while (0);
|
||||
|
||||
#define DEFINE_SERIALIZATION_VERSION(v) inline static uint32_t get_serialization_version() { return v; }
|
||||
|
|
@ -103,11 +103,11 @@ do { \
|
|||
|
||||
#define VERSION_ENTRY(f) \
|
||||
do { \
|
||||
ar.tag(#f); \
|
||||
if (ar.is_saving_arch()) \
|
||||
_ser_ar.tag(#f); \
|
||||
if (_ser_ar.is_saving_arch()) \
|
||||
f = this->get_serialization_version(); \
|
||||
bool r = ::do_serialize(ar, f); \
|
||||
if (!r || !ar.stream().good()) return false; \
|
||||
bool _ser_res = ::do_serialize(_ser_ar, f); \
|
||||
if (!_ser_res || !_ser_ar.stream().good()) return false; \
|
||||
} while (0);
|
||||
|
||||
template<typename first_type, typename second_type>
|
||||
|
|
@ -243,7 +243,7 @@ struct transition_t<false, destination_t>
|
|||
}
|
||||
};
|
||||
|
||||
#define CHAIN_TRANSITION_VER(tx_version, old_type) if (tx_version == version) return transition_t<W, old_type>::chain_serialize(ar, *this);
|
||||
#define CHAIN_TRANSITION_VER(tx_version, old_type) if (tx_version == version) return transition_t<W, old_type>::chain_serialize(_ser_ar, *this);
|
||||
|
||||
#include "serialize_basic_types.h"
|
||||
#include "string.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue