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.
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-
furszy commented at 2:40 PM on June 20, 2022: member
- fanquake added the label Wallet on Jun 20, 2022
-
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.
Riahiamirreza approved32e5edc0f4wallet: avoid extra wtx lookup in AddToSpends
This method is only called from AddToWallet and LoadToWallet, places where we already have the wtx.
furszy force-pushed on Jun 20, 2022laanwj commented at 5:45 PM on June 20, 2022: memberCode review ACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28
theStack approvedtheStack commented at 8:50 PM on June 20, 2022: contributorCode-review ACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28
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.
w0xlt approvedw0xlt commented at 5:09 PM on June 21, 2022: contributorbrunoerg approvedbrunoerg commented at 11:55 PM on June 21, 2022: contributorcrACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28
achow101 commented at 12:51 AM on June 22, 2022: memberACK 32e5edc0f454c59c8e0d8d86a9abfa9a3f25ca28
achow101 merged this on Jun 22, 2022achow101 closed this on Jun 22, 2022sidhujag referenced this in commit e229e8e8ae on Jun 22, 2022furszy deleted the branch on May 27, 2023bitcoin 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-04-16 00:13 UTC
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-16 00:13 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me