-
Notifications
You must be signed in to change notification settings - Fork 37.8k
refactor: Move and rename pindexBestHeader
, fHavePruned
#24909
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
Conversation
Now BlockManager::LoadBlockIndex() will ACTUALLY only load BlockMan members. [META] In a later commit, pindexBestHeader will be moved to ChainMan as a member ----- Code Reviewer Notes Call graph of relevant functions: ChainstateManager::LoadBlockIndex() <-- Moved to calls BlockManager::LoadBlockIndexDB() which calls BlockManager::LoadBlockIndex() <-- Moved from There is only one call to each of inner functions, meaning that no behavior is changing.
c1228dc
to
7b434e7
Compare
"most-mostly" -> "move-mostly" ? |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
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.
ACK 7b434e7 ; code review only
- 5d67017 validation: Load pindexBestHeader in ChainMan
- Could make
BlockManager::LoadBlockIndex
private - validation.h:
LoadBlockIndex
does not need to be afriend
ofChainstateManager
?
- Could make
- c51e611 move-mostly: Make pindexBestHeader a ChainMan member
- d66a2c0 style-only: Miscellaneous whitespace changes
- 8cc5f5c Clear pindexBestHeader in ChainstateManager::Unload()
- c32b9d8 move-mostly: Make fHavePruned a BlockMan member
- Seems like
fHavePruned
should someday be private to blockman and the pruning logic should move fromCChainState::FlushStateToDisk
to blockman
- Seems like
- 4032fc9 Clear fHavePruned in BlockManager::Unload()
- 7b434e7 scripted-diff: Rename pindexBestHeader, fHavePruned
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.
review ACK 7b434e7 🌜
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK 7b434e7d6bc5ea92b14694375ac4d429e644e61d 🌜
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhK5AwAnnxOI4tcYCP4IleWGvPN536u+3aq40UauEOEzMSOcfqOzRjfZqpBAqwC
GBvAzOjwaTAkG6S6H77mLAPxDGZZB2GdUWFT1RqMd1GRJmhyeer9wtqQ/NATvETg
qKUoJiCn5o1xZEOkTMgkAJyUJ8vkVF2UxjL/AbeAu3l79/Qzh527vUQ+s7xsR0Pe
fSfJQlrxqaB1p3yrwdsZwEYN2g+nzDIz3xEKG7P2sGoY9Vboh8FqggJW1+LOJfYE
/STQmMjcWGLFzQzUa5lUD64WT5dHruXrLgoJQ+jlOFfNd89he07ybmN8mP91Iu2I
ZNucJcKDoDQVJHIz/vSNWltIeTNfc/Xxj54gCW6N6IUSyRr4uzs9aVkToacWO5kP
e+1hT8EK5gn0an0NWxQmS2PBmsgrAZ/AeenrDuaMkYl5DjBe70v7rX6IG7/kbHu3
d3/pqVWzugeA+LH6XUyt1a0TdH1JEX6IgQo6N06a1i2WzVOpG/Ol4TY4jonziIHy
5/TITCQv
=Uk9X
-----END PGP SIGNATURE-----
In reply to #24909 (review) Seems unrelated to the commits here, see #24917 |
[META] In the next commit, we move the clearing of pindexBestHeader to ChainstateManager::Unload()
...of touched lines and surrounding
----- Code Reviewer Notes Call graph of relevant functions: UnloadBlockIndex() <-- Moved from calls ChainstateManager::Unload() <-- Moved to Safe because ChainstateManager::Unload() is called only by UnloadBlockIndex() and no other callers.
[META] In the next commit, we move the clearing of fHavePruned to BlockManager::Unload()
----- Code Reviewer Notes Call graph of relevant functions: UnloadBlockIndex() <-- Moved from calls ChainstateManager::Unload() which calls BlockManager::Unload() <-- Moved to So calling UnloadBlockIndex() would still run this moved code. The code will also now run when ~BlockManager gets called, which makes sense.
...to m_best_header and m_have_pruned -BEGIN VERIFY SCRIPT- find_regex="\bpindexBestHeader\b" \ && git grep -l -E "$find_regex" -- src \ | xargs sed -i -E "s@$find_regex@m_best_header@g" find_regex="\bfHavePruned\b" \ && git grep -l -E "$find_regex" -- src \ | xargs sed -i -E "s@$find_regex@m_have_pruned@g" -END VERIFY SCRIPT-
7b434e7
to
f0a2fb3
Compare
Looks reasonable at first glance, perhaps you wanna open an issue for that? |
ACK f0a2fb3 -- code review only |
kirby ACK f0a2fb3 😋 Show signatureSignature:
|
Summary: Now BlockManager::LoadBlockIndex() will ACTUALLY only load BlockMan members. [META] In a later commit, pindexBestHeader will be moved to ChainMan as a member ----- Code Reviewer Notes Call graph of relevant functions: `ChainstateManager::LoadBlockIndex()`<-- Moved to calls `BlockManager::LoadBlockIndexDB()` which calls `BlockManager::LoadBlockIndex()` <-- Moved from There is only one call to each of inner functions, meaning that no behavior is changing. This is a partial backport of [[bitcoin/bitcoin#24909 | core#24909]] bitcoin/bitcoin@5d67017 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D13043
Summary: [META] In the next commit, we move the clearing of pindexBestHeader to ChainstateManager::Unload() This is a partial backport of [[bitcoin/bitcoin#24909 | core#24909]] bitcoin/bitcoin@0d567da Depends on D13043 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D13044
Summary: ----- Code Reviewer Notes Call graph of relevant functions: `UnloadBlockIndex()` <-- Moved from calls `ChainstateManager::Unload()` <-- Moved to Safe because `ChainstateManager::Unload()` is called only by `UnloadBlockIndex()` and no other callers. This is a partial backport of [[bitcoin/bitcoin#24909 | core#24909]] bitcoin/bitcoin@c965241 Depends on D13044 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D13045
Summary: [META] In the next commit, we move the clearing of fHavePruned to BlockManager::Unload() This is a partial backport of [[bitcoin/bitcoin#24909 | core#24909]] bitcoin/bitcoin@3308ecd Depends on D13045 Test Plan: `ninja all check-all bench-bitcoin` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D13046
Summary: ----- Code Reviewer Notes Call graph of relevant functions: `UnloadBlockIndex()` <-- Moved from calls `ChainstateManager::Unload()` which calls `BlockManager::Unload()` <-- Moved to So calling UnloadBlockIndex() would still run this moved code. The code will also now run when ~BlockManager gets called, which makes sense. This is a partial backport of [[bitcoin/bitcoin#24909 | core#24909]] bitcoin/bitcoin@a401402 Depends on D13046 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D13047
…and m_have_pruned Summary: ``` -BEGIN VERIFY SCRIPT- find_regex="\bpindexBestHeader\b" \ && git grep -l -E "$find_regex" -- src \ | xargs sed -i -E "s@$find_regex@m_best_header@g" find_regex="\bfHavePruned\b" \ && git grep -l -E "$find_regex" -- src \ | xargs sed -i -E "s@$find_regex@m_have_pruned@g" -END VERIFY SCRIPT- ``` This concludes backport of [[bitcoin/bitcoin#24909 | core#24909]] bitcoin/bitcoin@f0a2fb3 Depends on D13047 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D13048
Split off from #22564 per Marco's suggestion: #22564 (comment)
This is basically the move-mostly parts of #22564. The overall intent is to move mutable globals manually reset by
::UnloadBlockIndex
into appropriate structs such that they are cleared at the appropriate times. Please read #22564's description for more rationale.In summary , this PR moves:
pindexBestHeader
->ChainstateManager::m_best_header
fHavePruned
->BlockManager::m_have_pruned