warningcache
and moves it to ChainstateManager
. Also removes the respective TODO
completely.
warningcache
and moves it to ChainstateManager
. Also removes the respective TODO
completely.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | TheCharlatan, ajtowns, ryanofsky |
Concept ACK | dergoegge |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Reviewers, 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.
5591@@ -5594,8 +5592,7 @@ ChainstateManager::~ChainstateManager()
5592
5593 m_versionbitscache.Clear();
5594
5595- // TODO: The warning cache should probably become non-global
5596- for (auto& i : warningcache) {
5597+ for (auto& i : m_warningcache) {
m_warningcache
will be deleted momentarily too.
892@@ -893,6 +893,8 @@ class ChainstateManager
893 //! that call.
894 std::unique_ptr<Chainstate> m_snapshot_chainstate GUARDED_BY(::cs_main);
895
896+ std::array<ThresholdConditionCache, VERSIONBITS_NUM_BITS> m_warningcache GUARDED_BY(::cs_main);
ACK 552684976b6df34ce563458f73812e6e494e3b0e
Looking at this, it occurs to me that we’re actually being a bit wasteful scanning through ~780k historical headers 29 times (or 2.4M headers 29 times for testnet) every time we startup. Replacing MinBIP9WarningHeight
with MinBIP9WarningStartTime
(set it to say 2022-07-01 initially), and using it for WarningBitsConditionChecker::BeginTime()
, and just bumping it at each release might be worthwhile.
ACK 5526849
Looking at this, it occurs to me that we’re actually being a bit wasteful scanning through ~780k historical headers 29 times (or 2.4M headers 29 times for testnet) every time we startup. Replacing
MinBIP9WarningHeight
withMinBIP9WarningStartTime
(set it to say 2022-07-01 initially), and using it forWarningBitsConditionChecker::BeginTime()
, and just bumping it at each release might be worthwhile.
Good point, should increase the startup time significantly. I’m on it and will address it in a following PR.
Good point, should increase the startup time significantly. I’m on it and will address it in a following PR.
(For the record I don’t think this will affect startup time significantly and that you’d need to add bench logging code to even observe the difference outside of the noise of disk reads and reconnecting on the network)
Please remove the merge commit in this branch. A merge commit will be created by the merge script.
Somehow when I synced my forked repo with the latest changes, it merged this branch too. thx
Good point, should increase the startup time significantly. I’m on it and will address it in a following PR.
(For the record I don’t think this will affect startup time significantly and that you’d need to add bench logging code to even observe the difference outside of the noise of disk reads and reconnecting on the network)
I just assumed that since there would be less block header processing, but what you say makes sense in that regard.
Code review ACK 552684976b6df34ce563458f73812e6e494e3b0e
This change does seem ready to merge, but I notice it conflicts with #27596 so might not be worth creating more rebase churn there. Will leave alone for now and wait for more input or a better opportunity to merge
This change does seem ready to merge, but I notice it conflicts with #27596 so might not be worth creating more rebase churn there. Will leave alone for now and wait for more input or a better opportunity to merge
FWIW, I think the rebase churn is pretty trivial (the PR’s change neighbouring lines in validation.h – this one introduces m_warningcache
while assumeutxo moves GetSnapshotBaseHeight
), #27596 needs rebase anyway (to combine the fixups at least), and it doesn’t conflict with #27746 which I think is the next part of assumevalid, though is still draft.