wallet: remove extra wtx lookup in AddToSpends #25427

pull furszy wants to merge 1 commits into bitcoin:master from furszy:2022_wallet_AddToSpends_extra_wtx_lookup changing 2 files +7 −10
  1. furszy commented at 2:40 PM on June 20, 2022: member

    As AddToSpends is only called from AddToWallet and LoadToWallet, places where we insert the wtx into the wallet map, we can directly feed AddToSpends with the wtx and remove another extra lookup.

  2. fanquake added the label Wallet on Jun 20, 2022
  3. in src/wallet/wallet.cpp:666 in 89e582278e outdated
     662 | @@ -663,16 +663,13 @@ void CWallet::AddToSpends(const COutPoint& outpoint, const uint256& wtxid, Walle
     663 |  }
     664 |  
     665 |  
     666 | -void CWallet::AddToSpends(const uint256& wtxid, WalletBatch* batch)
     667 | +void CWallet::AddToSpends(CWalletTx& wtx, WalletBatch* batch)
    


    laanwj commented at 4:18 PM on June 20, 2022:

    Can't this reference be const?


    furszy commented at 5:24 PM on June 20, 2022:

    yep, added.

  4. Riahiamirreza approved
  5. wallet: avoid extra wtx lookup in AddToSpends
    This method is only called from AddToWallet and LoadToWallet,
    places where we already have the wtx.
    32e5edc0f4
  6. furszy force-pushed on Jun 20, 2022
  7. laanwj commented at 5:45 PM on June 20, 2022: member

    Code review ACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28

  8. theStack approved
  9. theStack commented at 8:50 PM on June 20, 2022: contributor

    Code-review ACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28

  10. DrahtBot commented at 11:58 PM on June 20, 2022: contributor

    <!--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:

    • #25297 (wallet: speedup transactions sync, rescan and load not flushing to db constantly by furszy)
    • #22693 (RPC/Wallet: Add "use_txids" to output of getaddressinfo by luke-jr)

    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.

  11. DrahtBot cross-referenced this on Jun 21, 2022 from issue wallet: group independent db writes on single batched db transaction by furszy
  12. DrahtBot cross-referenced this on Jun 21, 2022 from issue RPC/Wallet: Add "use_txids" to output of getaddressinfo by luke-jr
  13. w0xlt approved
  14. w0xlt commented at 5:09 PM on June 21, 2022: contributor
  15. brunoerg approved
  16. brunoerg commented at 11:55 PM on June 21, 2022: contributor

    crACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28

  17. achow101 commented at 12:51 AM on June 22, 2022: member

    ACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28

  18. achow101 merged this on Jun 22, 2022
  19. achow101 closed this on Jun 22, 2022

  20. sidhujag referenced this in commit e229e8e8ae on Jun 22, 2022
  21. furszy deleted the branch on May 27, 2023
  22. bitcoin locked this on May 26, 2024

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-05-20 06:53 UTC