tx checker and pusher updated to use new serialization method

https://github.com/monero-project/monero/pull/1507/
This commit is contained in:
moneroexamples 2016-12-28 10:34:39 +08:00
parent c03ec8b2a8
commit ff6f8f407e

View file

@ -1530,12 +1530,26 @@ public:
if (unsigned_tx_given) if (unsigned_tx_given)
{ {
bool r {false};
string s = decoded_raw_tx_data.substr(magiclen);
::tools::wallet2::unsigned_tx_set exported_txs; ::tools::wallet2::unsigned_tx_set exported_txs;
bool r = serialization::parse_binary(std::string( try
decoded_raw_tx_data.c_str() + magiclen, {
decoded_raw_tx_data.size() - magiclen), std::istringstream iss(s);
exported_txs); boost::archive::portable_binary_iarchive ar(iss);
ar >> exported_txs;
r = true;
}
catch (...)
{
cerr << "Failed to parse unsigned tx data " << endl;
}
if (r) if (r)
{ {
mstch::array& txs = boost::get<mstch::array>(context["txs"]); mstch::array& txs = boost::get<mstch::array>(context["txs"]);
@ -1779,12 +1793,25 @@ public:
return string( "The data is neither unsigned nor signed tx!"); 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; ::tools::wallet2::signed_tx_set signed_txs;
bool r = serialization::parse_binary(std::string( try
decoded_raw_tx_data.c_str() + magiclen, {
decoded_raw_tx_data.size() - magiclen), std::istringstream iss(s);
signed_txs); boost::archive::portable_binary_iarchive ar(iss);
ar >> signed_txs;
r = true;
}
catch (...)
{
cerr << "Failed to parse signed tx data " << endl;
}
if (!r) if (!r)
{ {
@ -2067,12 +2094,25 @@ public:
return mstch::render(full_page, context); return mstch::render(full_page, context);
} }
bool r {false};
string s = decoded_raw_tx_data.substr(magiclen);
::tools::wallet2::signed_tx_set signed_txs; ::tools::wallet2::signed_tx_set signed_txs;
bool r = serialization::parse_binary(std::string( try
decoded_raw_tx_data.c_str() + magiclen, {
decoded_raw_tx_data.size() - magiclen), std::istringstream iss(s);
signed_txs); boost::archive::portable_binary_iarchive ar(iss);
ar >> signed_txs;
r = true;
}
catch (...)
{
cerr << "Failed to parse signed tx data " << endl;
}
if (!r) if (!r)
{ {