wallet, refactor: Remove duplicate/unnecessary lookups #19279

pull promag wants to merge 3 commits into bitcoin:master from promag:2020-06-wallet-duplicate-lookups changing 1 files +5 −9
  1. promag commented at 11:35 PM on June 14, 2020: member

    No change in behavior.

  2. wallet, refactor: Remove duplicate mapTxSpends lookup 6ec0a69c12
  3. wallet, refactor: Remove duplicate set lookup 642e8a5cb3
  4. wallet, doc: Fix typo though to through bad0f4d608
  5. fanquake added the label Wallet on Jun 14, 2020
  6. fanquake requested review from achow101 on Jun 15, 2020
  7. DrahtBot commented at 5:46 AM on June 15, 2020: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16910 (wallet: reduce loading time by using unordered maps by achow101)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  8. promag closed this on Jun 15, 2020

  9. promag reopened this on Jun 15, 2020

  10. in src/wallet/wallet.cpp:1021 in 642e8a5cb3 outdated
    1017 | @@ -1018,9 +1018,7 @@ bool CWallet::AbandonTransaction(const uint256& hashTx)
    1018 |              // Iterate over all its outputs, and mark transactions in the wallet that spend them abandoned too
    1019 |              TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
    1020 |              while (iter != mapTxSpends.end() && iter->first.hash == now) {
    1021 | -                if (!done.count(iter->second)) {
    1022 | -                    todo.insert(iter->second);
    1023 | -                }
    1024 | +                todo.emplace(iter->second);
    


    meshcollider commented at 11:52 AM on July 11, 2020:

    I'm not sure if I understand this change, but the first check is in the set done not todo so it isn't obvious to me why this is correct


    MarcoFalke commented at 11:57 AM on July 11, 2020:

    I think the assumption is that sha256 hashes don't collide, but I agree the explanation/reasoning can be a bit more verbose

  11. promag closed this on Jul 12, 2020

  12. promag deleted the branch on Jul 12, 2020
  13. DrahtBot locked this on Feb 15, 2022


achow101

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me