aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-01-08 16:41:44 -0800
committerRiccardo Spagni <ric@spagni.net>2017-01-08 16:41:44 -0800
commitba9744d4000268dedb08a00125776ccf526064f7 (patch)
treee1bc533f628fcc85356eba84653e10517eb04352 /src/wallet/wallet2.h
parentMerge pull request #1514 (diff)
parentportable serializer: tests added (diff)
downloadmonero-ba9744d4000268dedb08a00125776ccf526064f7.tar.xz
Merge pull request #1515
ada7c7da portable serializer: tests added (kenshi84) f390a0e2 portable serializer: make signerd/unsigned tx portable, ignore archive version checking (kenshi84)
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r--src/wallet/wallet2.h81
1 files changed, 49 insertions, 32 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index b69c477e9..e1eafbae3 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -58,6 +58,8 @@
#include <iostream>
#define WALLET_RCP_CONNECTION_TIMEOUT 200000
+class Serialization_portability_wallet_Test;
+
namespace tools
{
class i_wallet2_callback
@@ -86,6 +88,7 @@ namespace tools
class wallet2
{
+ friend class ::Serialization_portability_wallet_Test;
public:
enum RefreshType {
RefreshFull,
@@ -201,17 +204,6 @@ namespace tools
uint64_t unlock_time;
bool use_rct;
std::vector<cryptonote::tx_destination_entry> dests; // original setup, does not include change
-
- BEGIN_SERIALIZE_OBJECT()
- FIELD(sources)
- FIELD(change_dts)
- FIELD(splitted_dsts)
- FIELD(selected_transfers)
- FIELD(extra)
- VARINT_FIELD(unlock_time)
- FIELD(use_rct)
- FIELD(dests)
- END_SERIALIZE()
};
typedef std::vector<transfer_details> transfer_container;
@@ -232,39 +224,18 @@ namespace tools
std::vector<cryptonote::tx_destination_entry> dests;
tx_construction_data construction_data;
-
- BEGIN_SERIALIZE_OBJECT()
- FIELD(tx)
- VARINT_FIELD(dust)
- VARINT_FIELD(fee)
- FIELD(dust_added_to_fee)
- FIELD(change_dts)
- FIELD(selected_transfers)
- FIELD(key_images)
- FIELD(tx_key)
- FIELD(dests)
- FIELD(construction_data)
- END_SERIALIZE()
};
struct unsigned_tx_set
{
std::vector<tx_construction_data> txes;
wallet2::transfer_container transfers;
- BEGIN_SERIALIZE_OBJECT()
- FIELD(txes)
- FIELD(transfers)
- END_SERIALIZE()
};
struct signed_tx_set
{
std::vector<pending_tx> ptx;
std::vector<crypto::key_image> key_images;
- BEGIN_SERIALIZE_OBJECT()
- FIELD(ptx)
- FIELD(key_images)
- END_SERIALIZE()
};
struct keys_file_data
@@ -668,6 +639,10 @@ BOOST_CLASS_VERSION(tools::wallet2::payment_details, 1)
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 6)
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 3)
BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 16)
+BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 0)
+BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 0)
+BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 0)
+BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 0)
namespace boost
{
@@ -865,6 +840,48 @@ namespace boost
a & x.m_payment_id;
a & x.m_description;
}
+
+ template <class Archive>
+ inline void serialize(Archive &a, tools::wallet2::unsigned_tx_set &x, const boost::serialization::version_type ver)
+ {
+ a & x.txes;
+ a & x.transfers;
+ }
+
+ template <class Archive>
+ inline void serialize(Archive &a, tools::wallet2::signed_tx_set &x, const boost::serialization::version_type ver)
+ {
+ a & x.ptx;
+ a & x.key_images;
+ }
+
+ template <class Archive>
+ inline void serialize(Archive &a, tools::wallet2::tx_construction_data &x, const boost::serialization::version_type ver)
+ {
+ a & x.sources;
+ a & x.change_dts;
+ a & x.splitted_dsts;
+ a & x.selected_transfers;
+ a & x.extra;
+ a & x.unlock_time;
+ a & x.use_rct;
+ a & x.dests;
+ }
+
+ template <class Archive>
+ inline void serialize(Archive &a, tools::wallet2::pending_tx &x, const boost::serialization::version_type ver)
+ {
+ a & x.tx;
+ a & x.dust;
+ a & x.fee;
+ a & x.dust_added_to_fee;
+ a & x.change_dts;
+ a & x.selected_transfers;
+ a & x.key_images;
+ a & x.tx_key;
+ a & x.dests;
+ a & x.construction_data;
+ }
}
}