Rewrite wallet::search_receivable in terms of receivable iterators

This commit is contained in:
Colin LeMahieu 2024-03-15 23:31:57 +00:00
commit 30a3cc2462
No known key found for this signature in database
GPG key ID: 43708520C8DFB938

View file

@ -1182,15 +1182,14 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact
// Don't search pending for watch-only accounts
if (!nano::wallet_value (i->second).key.is_zero ())
{
for (auto j (wallets.node.store.pending.begin (block_transaction, nano::pending_key (account, 0))), k (wallets.node.store.pending.end ()); j != k && nano::pending_key (j->first).account == account; ++j)
for (auto i = wallets.node.ledger.receivable_upper_bound (block_transaction, account, 0), n = wallets.node.ledger.receivable_end (); i != n; ++i)
{
nano::pending_key key (j->first);
auto hash (key.hash);
nano::pending_info pending (j->second);
auto amount (pending.amount.number ());
auto const & [key, info] = *i;
auto hash = key.hash;
auto amount = info.amount.number ();
if (wallets.node.config.receive_minimum.number () <= amount)
{
wallets.node.logger.info (nano::log::type::wallet, "Found a receivable block {} for account {}", hash.to_string (), pending.source.to_account ());
wallets.node.logger.info (nano::log::type::wallet, "Found a receivable block {} for account {}", hash.to_string (), info.source.to_account ());
if (wallets.node.ledger.block_confirmed (block_transaction, hash))
{