diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-12-20 17:40:11 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-12-20 17:40:11 +0200 |
commit | b9b9028e50e647073f55a8f32696ff593bc2fc16 (patch) | |
tree | 97376d7c253230f28821ddd9ccb2e3b65df29990 /src/simplewallet | |
parent | Merge pull request #1464 (diff) | |
parent | support importing unportable outputs (diff) | |
download | monero-b9b9028e50e647073f55a8f32696ff593bc2fc16.tar.xz |
Merge pull request #1462
07b9138c support importing unportable outputs (kenshi84)
2ac80075 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp (kenshi84)
d1d6e27a moved boost cpp into hpp since they're supposed to be header only (kenshi84)
66e6af89 added experimental boost::archive::portable_binary_{i|o}archive (kenshi84)
Diffstat (limited to 'src/simplewallet')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index b46447975..251f9c231 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -3882,7 +3882,7 @@ bool simple_wallet::export_outputs(const std::vector<std::string> &args) std::vector<tools::wallet2::transfer_details> outs = m_wallet->export_outputs(); std::stringstream oss; - boost::archive::binary_oarchive ar(oss); + boost::archive::portable_binary_oarchive ar(oss); ar << outs; std::string magic(OUTPUT_EXPORT_FILE_MAGIC, strlen(OUTPUT_EXPORT_FILE_MAGIC)); @@ -3962,10 +3962,19 @@ bool simple_wallet::import_outputs(const std::vector<std::string> &args) std::string body(data, headerlen); std::stringstream iss; iss << body; - boost::archive::binary_iarchive ar(iss); std::vector<tools::wallet2::transfer_details> outputs; - ar >> outputs; - + try + { + boost::archive::portable_binary_iarchive ar(iss); + ar >> outputs; + } + catch (...) + { + iss.str(""); + iss << body; + boost::archive::binary_iarchive ar(iss); + ar >> outputs; + } size_t n_outputs = m_wallet->import_outputs(outputs); success_msg_writer() << boost::lexical_cast<std::string>(n_outputs) << " outputs imported"; } |