From 6f3c2fcbccdff69263cb8eea94c8c0e3e0c1b6f9 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Tue, 30 Apr 2019 22:41:01 +0200 Subject: [PATCH] fixed linux serialization --- src/currency_core/currency_format_utils.h | 2 +- src/serialization/serialization.h | 25 +++++++++++++++ src/serialization/stl_containers.h | 39 +++++++++++------------ src/wallet/wallet2.cpp | 2 +- src/wallet/wallet2.h | 2 +- 5 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/currency_core/currency_format_utils.h b/src/currency_core/currency_format_utils.h index a43c66ae..01b7328c 100644 --- a/src/currency_core/currency_format_utils.h +++ b/src/currency_core/currency_format_utils.h @@ -61,7 +61,7 @@ namespace currency typedef boost::multiprecision::uint128_t uint128_tl; struct tx_source_entry { - typedef std::pair output_entry; // txout_v is either global output index or ref_by_id; public_key - is output ephemeral pub key + typedef serializable_pair output_entry; // txout_v is either global output index or ref_by_id; public_key - is output ephemeral pub key std::vector outputs; //index + key uint64_t real_output; //index in outputs vector of real output_entry diff --git a/src/serialization/serialization.h b/src/serialization/serialization.h index 138a0377..8278b938 100644 --- a/src/serialization/serialization.h +++ b/src/serialization/serialization.h @@ -110,6 +110,31 @@ do { \ if (!r || !ar.stream().good()) return false; \ } while (0); +template +class serializable_pair : public std::pair +{ + typedef std::pair base; +public: + serializable_pair() + {} + serializable_pair(const first_type& a, const second_type& b) :std::pair(a, b) + {} + serializable_pair(const serializable_pair& sp) :std::pair(sp.first, sp.second) + {} + + BEGIN_SERIALIZE_OBJECT() + FIELD(base::first) + FIELD(base::second) + END_SERIALIZE() +}; + +template +serializable_pair make_serializable_pair(const first_type& first_value, const second_type& second_value) +{ + return serializable_pair(first_value, second_value); +} + + namespace serialization { namespace detail { diff --git a/src/serialization/stl_containers.h b/src/serialization/stl_containers.h index c3bb800e..34981ede 100644 --- a/src/serialization/stl_containers.h +++ b/src/serialization/stl_containers.h @@ -9,12 +9,28 @@ #include #include +//#include "serialization.h" +template