Page MenuHomePhabricator

inline chain stats updating
ClosedPublic

Authored by PiRK on Tue, Apr 15, 15:32.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC01b4aa9a8761: inline chain stats updating
Summary

D6308 used to be an elegant way of factoring the check for "is the block the genesis or all parents have data" and the updating of nChainTx. But now with assumeutxo developments, the code branches in the code loading blocks from disk and code processing blocks from the network have diverged, we no longer need to maintain a nChainSize stat (D17878), and the refactored solution has additional complexity.

It will make reasoning about the state of the block easier to just inline the different computations where they are needed. And it will also make future backports easier by following what Core is doing.

Revert D6308, D17872 and reapply D17873 accordingly.
The only change in behavior should be that now we don't hit the Assume(....) assertion that used to be in UpdateChainStats when pindexNew is not the genesis block and some parent blocks are missing data.

Test Plan

On D17931, with a Debug build, run the functional test feature_assumeutxo.py

Event Timeline

PiRK retitled this revision from don't log "Internal bug detected" for the snapshot base block to inline chain stats updating.
PiRK edited the summary of this revision. (Show Details)

change everything (see updated summary)

PiRK published this revision for review.Wed, Apr 16, 11:45
PiRK added inline comments.
src/node/blockstorage.cpp
311 ↗(On Diff #53506)

Review hint: this should now be identical with Core's current master (+- variable renaming)

Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/node/blockstorage.cpp
311–327 ↗(On Diff #53506)

This is correct and I'm sure this matches core, but this is ugly.

This revision is now accepted and ready to land.Wed, Apr 16, 13:07

reduce indentation as per review

This revision was automatically updated to reflect the committed changes.