-
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
Changes from 1 commit
333d823
7f51417
e83c853
e5198ef
6e0f4ae
3404ac0
76e0811
dd7e989
7d90cf9
cffd76a
314c92b
8b65ddd
85f9844
d722f7d
b9185dc
28dd955
5203b85
64db9d6
107a028
eb8fff3
7b76fdb
403c5cb
081631e
a756ecb
bcf23b5
61a45ad
fa730f7
6b7cf5d
a765747
4582551
55a2f2c
1886642
f5ee2f3
15b6e6a
f80378c
363d6d5
ff53263
4620ba1
05083dc
973fbe8
b652f40
1bd97da
2ad7239
4328d09
9890464
fa970fb
8919757
1ac12e9
2cb0446
a910e41
0be47f8
3a2a8cf
2acbe46
711f37a
409ebc3
053893a
b476400
9cac0b0
e391187
a7461a5
755ceea
b38c3c9
3d54028
c3efbcb
b24576e
947b3c5
a3d401c
9b3925b
62893af
6bda9eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Tip: versionbitscache is currently a global so we didn't need to pass it in to any of ::VersionBitsTip*'s callers
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4973,24 +4973,6 @@ CBlockFileInfo* GetBlockFileInfo(size_t n) | |
return &vinfoBlockFile.at(n); | ||
} | ||
|
||
ThresholdState VersionBitsTipState(const Consensus::Params& params, Consensus::DeploymentPos pos) | ||
{ | ||
LOCK(cs_main); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In commit "validation: Remove global ::VersionBitsTip{State,SinceHeight,Statistics}" (b60c7e5) I'm a little unclear why it's safe to drop these locks, or why they were here to begin with, or if VersionBits or ChainActive or Tip functions should have been annotated to require cs_main. It seems like something should have be annotated if cs_main was required here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Digging in the git history a bit, it seems that the earliest of this trio -- namely I'm not entirely sure about the original intent here, so perhaps @sipa can enlighten me and make sure I'm not missing something! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least add a comment about the fact the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re: #20158 (comment) In commit "validation: Remove global ::VersionBitsTip{State,SinceHeight,Statistics}" (ff894f9)
Thanks for checking! I see
Line 1317 seems to be referring to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ariard @ryanofsky would it be preferable to add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re: #20158 (comment) In commit "validation: Remove global ::VersionBitsTip{State,SinceHeight,Statistics}" (6ed743d)
I'd keep what you have now unless there's a reason to think conclusion from digging into history is incorrect. It would be confusing to add a lock required annotation if we don't think a lock is required. In theory you could write |
||
return VersionBitsState(::ChainActive().Tip(), params, pos, versionbitscache); | ||
} | ||
|
||
BIP9Stats VersionBitsTipStatistics(const Consensus::Params& params, Consensus::DeploymentPos pos) | ||
{ | ||
LOCK(cs_main); | ||
return VersionBitsStatistics(::ChainActive().Tip(), params, pos); | ||
} | ||
|
||
int VersionBitsTipStateSinceHeight(const Consensus::Params& params, Consensus::DeploymentPos pos) | ||
{ | ||
LOCK(cs_main); | ||
return VersionBitsStateSinceHeight(::ChainActive().Tip(), params, pos, versionbitscache); | ||
} | ||
|
||
static const uint64_t MEMPOOL_DUMP_VERSION = 1; | ||
|
||
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate) | ||
|
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.
Maybe add a friendly comment in commit about the fact that
versionbitscache
is currently a global and thus the stays the same. Though we can't assert it ?