From ff6f8f407e997244851e366631924c4e99d9460b Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 28 Dec 2016 10:34:39 +0800 Subject: [PATCH] tx checker and pusher updated to use new serialization method https://github.com/monero-project/monero/pull/1507/ --- src/page.h | 64 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/src/page.h b/src/page.h index 797b1a5..00dda9e 100644 --- a/src/page.h +++ b/src/page.h @@ -1530,12 +1530,26 @@ public: if (unsigned_tx_given) { + + bool r {false}; + + string s = decoded_raw_tx_data.substr(magiclen); + ::tools::wallet2::unsigned_tx_set exported_txs; - bool r = serialization::parse_binary(std::string( - decoded_raw_tx_data.c_str() + magiclen, - decoded_raw_tx_data.size() - magiclen), - exported_txs); + try + { + std::istringstream iss(s); + boost::archive::portable_binary_iarchive ar(iss); + ar >> exported_txs; + + r = true; + } + catch (...) + { + cerr << "Failed to parse unsigned tx data " << endl; + } + if (r) { mstch::array& txs = boost::get(context["txs"]); @@ -1779,12 +1793,25 @@ public: return string( "The data is neither unsigned nor signed tx!"); } + + bool r {false}; + + string s = decoded_raw_tx_data.substr(magiclen); + ::tools::wallet2::signed_tx_set signed_txs; - bool r = serialization::parse_binary(std::string( - decoded_raw_tx_data.c_str() + magiclen, - decoded_raw_tx_data.size() - magiclen), - signed_txs); + try + { + std::istringstream iss(s); + boost::archive::portable_binary_iarchive ar(iss); + ar >> signed_txs; + + r = true; + } + catch (...) + { + cerr << "Failed to parse signed tx data " << endl; + } if (!r) { @@ -2067,12 +2094,25 @@ public: return mstch::render(full_page, context); } + bool r {false}; + + string s = decoded_raw_tx_data.substr(magiclen); + ::tools::wallet2::signed_tx_set signed_txs; - bool r = serialization::parse_binary(std::string( - decoded_raw_tx_data.c_str() + magiclen, - decoded_raw_tx_data.size() - magiclen), - signed_txs); + try + { + std::istringstream iss(s); + boost::archive::portable_binary_iarchive ar(iss); + ar >> signed_txs; + + r = true; + } + catch (...) + { + cerr << "Failed to parse signed tx data " << endl; + } + if (!r) {