-
Notifications
You must be signed in to change notification settings - Fork 36.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tree-wide: De-globalize ChainstateManager #20158
Closed
+668
−660
Closed
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
333d823
validation: Pass in chainstate to ::LimitMempoolSize
dongcarl 7f51417
validation: Pass in chainstate to IsCurrentForFeeEstimation
dongcarl e83c853
validation: Pass in chainstate to CheckInputsFromMempoolAndCache
dongcarl e5198ef
validation: Pass in chain tip to ::CheckFinalTx
dongcarl 6e0f4ae
scripted-diff: Invoke ::CheckFinalTx with chain tip
dongcarl 3404ac0
validation: Remove old CheckFinalTx w/o chain tip param
dongcarl 76e0811
validation: Pass in chainstate to ::CheckSequenceLocks
dongcarl dd7e989
validation: Add chainstate member to MemPoolAccept
dongcarl 7d90cf9
validation: Pass in chainstate to AcceptToMemoryPoolWithTime
dongcarl cffd76a
validation: Pass in chainstate to ::LoadMempool
dongcarl 314c92b
validation: Pass in chainstate to ::AcceptToMemoryPool
dongcarl 8b65ddd
scripted-diff: Invoke ::AcceptToMemoryPool with chainstate
dongcarl 85f9844
validation: Remove old AcceptToMemoryPool w/o chainstate param
dongcarl d722f7d
tree-wide: Fix erroneous AcceptToMemoryPool replacements
dongcarl b9185dc
validation: Pass in chain to ::TestLockPointValidity
dongcarl 28dd955
validation: Pass in chainstate to CTxMemPool::removeForReorg
dongcarl 5203b85
validation: Pass in chainstate to UpdateMempoolForReorg
dongcarl 64db9d6
validation: Use *this in CChainState::LoadMempool
dongcarl 107a028
COMMITS AFTER THIS ARE NON-BASE
dongcarl eb8fff3
validation: Remove global ::LoadGenesisBlock
dongcarl 7b76fdb
validation: Remove global ::{{Precious,Invalidate}Block,ResetBlockFai…
dongcarl 403c5cb
validation: Pass in chainstate to UpdateTip
dongcarl 081631e
validation: Pass in chainstate to ::PruneBlockFilesManual
dongcarl a756ecb
validation: Remove global ::VersionBitsTip{State,SinceHeight,Statistics}
dongcarl bcf23b5
validation: Pass in chainstate to CVerifyDB::VerifyDB
dongcarl 61a45ad
validation: Move invalid block handling to CChainState
dongcarl fa730f7
validation: Move LoadBlockIndexDB to CChainState
dongcarl 6b7cf5d
validation: Use *this in CChainState::InvalidateBlock
dongcarl a765747
validation: Pass in spendheight to CTxMemPool::check
dongcarl 4582551
validation: Use *this in CChainState::ActivateBestChainStep
dongcarl 55a2f2c
validation: Pass in chain to FindBlockPos+SaveBlockToDisk
dongcarl 1886642
validation: Use existing chain member in CChainState::AcceptBlock
dongcarl f5ee2f3
validation: Use existing chain member in CChainState::LoadGenesisBlock
dongcarl 15b6e6a
COMMITS AFTER THIS ARE NON-BASE
dongcarl f80378c
miner: Pass in chainstate to BlockAssembler::CreateNewBlock
dongcarl 363d6d5
scripted-diff: Invoke CreateNewBlock with chainstate
dongcarl ff53263
miner: Remove old CreateNewBlock w/o chainstate param
dongcarl 4620ba1
miner: Pass in blockman to ::RegenerateCommitments
dongcarl 05083dc
node/coinstats: Pass in BlockManager to GetUTXOStats
dongcarl 973fbe8
node: Use existing NodeContext
dongcarl b652f40
node/ifaces: NodeImpl: Use existing NodeContext member
dongcarl 1bd97da
node/ifaces: ChainImpl: Use existing NodeContext member
dongcarl 2ad7239
net_processing: Move some static functions to PeerManager
dongcarl 4328d09
scripted-diff: net_processing: Use existing chainman
dongcarl 9890464
net_processing: Add review-only assertion to PeerManager
dongcarl fa970fb
COMMITS AFTER THIS ARE NON-BASE
dongcarl 8919757
rpc/*,rest: Add review-only assertion to EnsureChainman
dongcarl 1ac12e9
rpc/blockchain: Use existing NodeContext
dongcarl 2cb0446
rpc/mining: Use existing NodeContext
dongcarl a910e41
rpc/rawtx: Use existing NodeContext
dongcarl 0be47f8
rest: Pass in NodeContext to rest_block
dongcarl 3a2a8cf
rest: Use existing NodeContext
dongcarl 2acbe46
fixup! rpc/mining: Use existing NodeContext
dongcarl 711f37a
COMMITS AFTER THIS ARE NON-BASE
dongcarl 409ebc3
bench: Use existing NodeContext in DuplicateInputs
dongcarl 053893a
bench: Use existing chainman in AssembleBlock
dongcarl b476400
index: Add chainstate member to BaseIndex
dongcarl 9cac0b0
COMMITS AFTER THIS ARE NON-BASE
dongcarl e391187
init: Use existing chainman
dongcarl a7461a5
test/util: Use existing chainman in ::PrepareBlock
dongcarl 755ceea
test/miner_tests: Pass in chain tip to CreateBlockIndex
dongcarl b38c3c9
test: Pass in CoinsTip to ValidateCheckInputsForAllFlags
dongcarl 3d54028
scripted-diff: test: Use existing chainman in unit tests
dongcarl c3efbcb
fuzz: Initialize a TestingSetup for test_one_input
dongcarl b24576e
scripted-diff: wallet/test: Use existing chainman
dongcarl 947b3c5
qt/test: Use existing chainman in ::TestGUI (can be scripted-diff)
dongcarl a3d401c
miner: Remove stray review-only assertion
dongcarl 9b3925b
scripted-diff: tree-wide: Remove all review-only assertions
dongcarl 62893af
qt/test: Reset chainman in ~ChainstateManager instead
dongcarl 6bda9eb
validation: Farewell, global Chainstate!
dongcarl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
miner: Pass in blockman to ::RegenerateCommitments
REQUIRES ATTENTION
- Loading branch information
commit 4620ba194acc269681168497144a9952d8e0fe47
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass directly the result of
LookupBlockIndex(block.hashPrevBlock)
? Block is already known here. Because AFAIU, the lock isn't held onceRegenerateCommitment
argument are loaded on the stack thus do you have guarantee you're calling the newblockman.LookupBlockIndex()
with a lock ?I think so otherwise
LookupBlockIndex
's lock annotation would yelled but I can't convince myself of it...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is a shitty situation where the lock in this diff is only needed because:
bitcoin/src/validation.h
Line 944 in 831675c
and
bitcoin/src/validation.h
Line 840 in 831675c
Then the lock is released as
RegenerateCommitments
's assembly function prologue is run, and the same lock is taken again whenLookupBlockIndex
is called insideRegenerateCommitments
.The original reason why I wanted to just pass in the
blockman
is because I didn't want to impose the constraint of "arg 2 must be the block index of arg 1" onRegenerateCommitments
's arguments, which seems like something that might be easy to cause a bug if someone were to work with multiple blocks or multiple block indices. Perhaps adequate documentation can prevent this?