support importing unportable outputs
This commit is contained in:
parent
2ac8007544
commit
07b9138cad
1 changed files with 12 additions and 3 deletions
|
@ -3962,10 +3962,19 @@ bool simple_wallet::import_outputs(const std::vector<std::string> &args)
|
||||||
std::string body(data, headerlen);
|
std::string body(data, headerlen);
|
||||||
std::stringstream iss;
|
std::stringstream iss;
|
||||||
iss << body;
|
iss << body;
|
||||||
boost::archive::portable_binary_iarchive ar(iss);
|
|
||||||
std::vector<tools::wallet2::transfer_details> outputs;
|
std::vector<tools::wallet2::transfer_details> outputs;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::archive::portable_binary_iarchive ar(iss);
|
||||||
ar >> outputs;
|
ar >> outputs;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
iss.str("");
|
||||||
|
iss << body;
|
||||||
|
boost::archive::binary_iarchive ar(iss);
|
||||||
|
ar >> outputs;
|
||||||
|
}
|
||||||
size_t n_outputs = m_wallet->import_outputs(outputs);
|
size_t n_outputs = m_wallet->import_outputs(outputs);
|
||||||
success_msg_writer() << boost::lexical_cast<std::string>(n_outputs) << " outputs imported";
|
success_msg_writer() << boost::lexical_cast<std::string>(n_outputs) << " outputs imported";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue