HomePhabricator

inline chain stats updating

Description

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17938

Details

Provenance
PiRKAuthored on Tue, Apr 15, 15:12
PiRKPushed on Thu, Apr 17, 11:10
Reviewer
Restricted Project
Differential Revision
D17938: inline chain stats updating
Parents
rABC5112370f0353: rpc: Add MaybeArg() and Arg() default helper
Branches
Unknown
Tags
Unknown
Reverts
D6308: Make nChainTx private, ass facility to update it
D17872: block index: split ResetChainStats from UpdateChainStats