Rewrite wallet::search_receivable in terms of receivable iterators
This commit is contained in:
parent
873760f345
commit
30a3cc2462
1 changed files with 5 additions and 6 deletions
|
|
@ -1182,15 +1182,14 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact
|
||||||
// Don't search pending for watch-only accounts
|
// Don't search pending for watch-only accounts
|
||||||
if (!nano::wallet_value (i->second).key.is_zero ())
|
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 const & [key, info] = *i;
|
||||||
auto hash (key.hash);
|
auto hash = key.hash;
|
||||||
nano::pending_info pending (j->second);
|
auto amount = info.amount.number ();
|
||||||
auto amount (pending.amount.number ());
|
|
||||||
if (wallets.node.config.receive_minimum.number () <= amount)
|
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))
|
if (wallets.node.ledger.block_confirmed (block_transaction, hash))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue