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
1 changed files with 52 additions and 12 deletions

View File

@ -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<mstch::array>(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)
{