db2d39f642fuzz: add subtest for re-downloading a previously pruned block (Eugene Siegel)45f5b2dac3fuzz: Add fuzzer for block index (Martin Zumsande)c011e3aa54test: Wrap validation functions with TestChainstateManager (Martin Zumsande) Pull request description: This adds a fuzz target for the block index and various events in validation that interact with it. It can create arbitrary tree-like structure of block indexes, simulating (so far) the following events: - Adding a header - Receiving the full block (may be valid or not) - `ActivateBestChain()` - Reorging the chain to a new chain tip (possibly encountering invalid blocks on the way) - Pruning a block in the best chain - Receiving a previously pruned block again (`getblockfrompeer`) It might be interesting / possible to extend this to more events, such as dealing with more than one chainstate (assumeutxo). The test skips all actual validation of header/ block / transaction data by just simulating the outcome, and also doesn't interact with the data directory. The main goal is to ensure the integrity of the block index tree in all fuzzed constellations, by calling `CheckBlockIndex()` at the end of each iteration. Compared to #29158 this approach has a more limited scope (by skipping all actual validation), but it is fast - it doesn't do a full init sequence on each iteration, but "cleans up" after itself by resetting the global validation state after each iteration. ACKs for top commit: Crypt-iQ: reACKdb2d39f642maflcko: review ACKdb2d39f642🍶 sedited: Re-ACKdb2d39f642Tree-SHA512: 76cd5f8f4d7d7258620b46d7438bad4508c3bdc98825b48b60f694b5a9838e2b2cf4967c0ead181f86f66f4939ddfe552471851b9d18f84f584c03dd7e09fc43
src/node/
The src/node/ directory contains code that needs to access node state
(state in CChain, CBlockIndex, CCoinsView, CTxMemPool, and similar
classes).
Code in src/node/ is meant to be segregated from code in
src/wallet/ and src/qt/, to ensure wallet and GUI
code changes don't interfere with node operation, to allow wallet and GUI code
to run in separate processes, and to perhaps eventually allow wallet and GUI
code to be maintained in separate source repositories.
As a rule of thumb, code in one of the src/node/,
src/wallet/, or src/qt/ directories should avoid
calling code in the other directories directly, and only invoke it indirectly
through the more limited src/interfaces/ classes.
This directory is at the moment
sparsely populated. Eventually more substantial files like
src/validation.cpp and
src/txmempool.cpp might be moved there.