Revert "Rewrite wallet::search_receivable in terms of receivable iterators"

This reverts commit 30a3cc2462.

# Conflicts:
#	nano/node/wallet.cpp
This commit is contained in:
Colin LeMahieu 2024-08-21 14:39:24 +01:00
commit df2f06dc06
No known key found for this signature in database
GPG key ID: 43708520C8DFB938

View file

@ -1185,14 +1185,15 @@ 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 i = wallets.node.ledger.any.receivable_upper_bound (block_transaction, account, 0), n = wallets.node.ledger.any.receivable_end (); i != n; ++i)
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)
{
auto const & [key, info] = *i;
auto hash = key.hash;
auto amount = info.amount.number ();
nano::pending_key key (j->first);
auto hash (key.hash);
nano::pending_info pending (j->second);
auto amount (pending.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 (), info.source.to_account ());
wallets.node.logger.info (nano::log::type::wallet, "Found a receivable block {} for account {}", hash.to_string (), pending.source.to_account ());
if (wallets.node.ledger.confirmed.block_exists_or_pruned (block_transaction, hash))
{