wallet2: only export necessary outputs and key images

and disable annoying test that requires ridiculous amounts
of skullduggery every time some format changes
This commit is contained in:
moneromooo-monero 2018-10-24 18:24:11 +00:00
parent 769ae42a7b
commit 8d71b2b1b3
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
9 changed files with 125 additions and 65 deletions

View file

@ -2460,12 +2460,13 @@ namespace tools
if (!m_wallet) return not_open(er);
try
{
std::vector<std::pair<crypto::key_image, crypto::signature>> ski = m_wallet->export_key_images();
res.signed_key_images.resize(ski.size());
for (size_t n = 0; n < ski.size(); ++n)
std::pair<size_t, std::vector<std::pair<crypto::key_image, crypto::signature>>> ski = m_wallet->export_key_images();
res.offset = ski.first;
res.signed_key_images.resize(ski.second.size());
for (size_t n = 0; n < ski.second.size(); ++n)
{
res.signed_key_images[n].key_image = epee::string_tools::pod_to_hex(ski[n].first);
res.signed_key_images[n].signature = epee::string_tools::pod_to_hex(ski[n].second);
res.signed_key_images[n].key_image = epee::string_tools::pod_to_hex(ski.second[n].first);
res.signed_key_images[n].signature = epee::string_tools::pod_to_hex(ski.second[n].second);
}
}
@ -2518,7 +2519,7 @@ namespace tools
ski[n].second = *reinterpret_cast<const crypto::signature*>(bd.data());
}
uint64_t spent = 0, unspent = 0;
uint64_t height = m_wallet->import_key_images(ski, spent, unspent);
uint64_t height = m_wallet->import_key_images(ski, req.offset, spent, unspent);
res.spent = spent;
res.unspent = unspent;
res.height = height;