Merge pull request #4336

5f8f5631 wallet2.get_reserve_proof: throw when specified amount is zero (stoffu)
This commit is contained in:
Riccardo Spagni 2018-09-14 13:06:06 +02:00
commit b182dc8262
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -9472,6 +9472,7 @@ std::string wallet2::get_reserve_proof(const boost::optional<std::pair<uint32_t,
if (account_minreserve)
{
THROW_WALLET_EXCEPTION_IF(account_minreserve->second == 0, error::wallet_internal_error, "Proved amount must be greater than 0");
// minimize the number of outputs included in the proof, by only picking the N largest outputs that can cover the requested min reserve amount
std::sort(selected_transfers.begin(), selected_transfers.end(), [&](const size_t a, const size_t b)
{ return m_transfers[a].amount() > m_transfers[b].amount(); });