From df2f06dc0685718fe0a1e08858d59bbf0c917a84 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Wed, 21 Aug 2024 14:39:24 +0100 Subject: [PATCH] Revert "Rewrite wallet::search_receivable in terms of receivable iterators" This reverts commit 30a3cc2462a7083c710f7314dfdaed5c3915312d. # Conflicts: # nano/node/wallet.cpp --- nano/node/wallet.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nano/node/wallet.cpp b/nano/node/wallet.cpp index e8fc2473c..764e3fea1 100644 --- a/nano/node/wallet.cpp +++ b/nano/node/wallet.cpp @@ -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)) {