wallet: Remove first parameter to ScanForWalletTransactions start_hash #19216
pull pstratem wants to merge 1 commits into bitcoin:master from pstratem:2020-06-07-wallet-scanforwallettransactions changing 5 files +13 −37-
pstratem commented at 3:56 am on June 9, 2020: contributorEvery caller looks up the block hash from a block height immediately before calling.
-
fanquake added the label Wallet on Jun 9, 2020
-
DrahtBot commented at 10:25 am on June 9, 2020: member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #19310 (wallet: BerkeleyDatabase make BerkeleyDatabase::Create, CreateMock, and CreateDummy non-static functions by achow101)
- #19195 (wallet: ScanForWalletTransactions cleanup by pstratem)
- #19137 (wallettool: Add dump and createfromdump commands by achow101)
- #19102 (wallet: Introduce and use DummyDatabase instead of dummy BerkeleyDatabase by achow101)
- #19077 (wallet: Add sqlite as an alternative wallet database and use it for new descriptor wallets by achow101)
- #18971 (wallet: Refactor the classes in wallet/db.{cpp/h} by achow101)
- #18354 (Use shared pointers only in validation interface by bvbfan)
- #15719 (Wallet passive startup by ryanofsky)
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.
-
in src/wallet/rpcwallet.cpp:3564 in 5586ef7a06 outdated
3566@@ -3567,7 +3567,7 @@ UniValue rescanblockchain(const JSONRPCRequest& request) 3567 }
MarcoFalke commented at 11:41 am on June 9, 2020:Is there a reason you didn’t remove thestart_block
variable?
pstratem commented at 4:44 am on June 11, 2020:i didn’t want to change the function called but i guess i should
promag commented at 9:24 pm on June 11, 2020:I think this can be removed now that block hash is gone.
pstratem commented at 10:05 pm on June 11, 2020:indeedpromag commented at 9:13 pm on June 10, 2020: memberConcept ACK dropping one of the start args. I have a preference to keep start_block hash instead.pstratem force-pushed on Jun 11, 2020wallet: Remove first parameter to ScanForWalletTransactions start_hash
Every caller looks up the block hash from a block height immediately before calling.
pstratem force-pushed on Jun 11, 2020promag commented at 10:39 pm on June 11, 2020: memberCode review ACK dbd8498b8134cb4cefa351eb21bef2769a7bdf18, dropped unnecessary statement since last reviewDrahtBot commented at 9:48 pm on June 18, 2020: member🐙 This pull request conflicts with the target branch and needs rebase.
DrahtBot added the label Needs rebase on Jun 18, 2020ryanofsky commented at 9:35 pm on June 30, 2020: memberThis isn’t a good change, I think. It doesn’t simplify the code very much, and makes the scanning code less correct and more fragile. The problem is the new
getBlockHash
call added here:getBlockHash
is a synchronous method that will assert and the crash the process if it is called with an invalid height. Since #16426, the wallet can no longer lock the node, so reorgs can happen any time, andgetBlockHash
isn’t safe to call after startup. The last remaining uses ofgetBlockHash
are removed in #15719.Calling
getBlockHash
here can also lead to less correct behavior even if it doesn’t fully crash the process.RescanFromTime
andCreateWalletFromFile
both locate starting blocks based on time, but after this change they only pass the starting block height, not the starting block hash toScanForWalletTransactions
, meaning if there is a reorg, blocks that should be scanned might not be and no errors will be returned.In general, the only correct way for wallet code to reference blocks is by hash and not by height, and this PR moves in the less correct direction.
Also, while
ScanForWalletTransactions
code is very messy, I think effort would be better spent deleting it and trying to move rescans outside the wallet with ariard’s changes #11756 (comment), than trying to clean it uppromag commented at 10:30 am on July 1, 2020: memberConcept ACK dropping one of the start args. I have a preference to keep start_block hash instead.
@pstratem the interface uses heights but internally block hash is unambiguous - a block at a certain height can change after a reorg - but not a strong opinion.
I’ve mentioned this before, but considering @ryanofsky comment #19216 (comment) and @ariard work I agree that this is not worth it.
ryanofsky commented at 3:51 pm on July 1, 2020: memberAnother option could be to drop the start_height argument and keep the start_block argumentfanquake commented at 8:00 am on August 18, 2021: memberClosing for now.fanquake closed this on Aug 18, 2021
DrahtBot locked this on Aug 18, 2022
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: 2024-12-18 18:12 UTC
More mirrored repositories can be found on mirror.b10c.me