Hi Bitcoin Core maintainers.
This PR is the second part of #34651 and provides the following two fuzzing harnesses:
activate_best_chain_step: Test the ActivateBestChainStep() function responsible of activating the most worked-chain (not selecting it). The harness is written in a way that enable the fuzzer triggering a chain reorganization if it generates two valid branches.activate_best_chain: Test the ActivateBestChain() function responsible of selecting and activating the most worked-chain.
In the two later harnesses, some internal state cleaning is required to avoid non-reproducibility issues. Also they might produce file artifacts on disk by means of writing blocks.
These two harnesses are built upon the connect_block harness thus the PR shall be merged first.
These harnesses enables improving function coverage on ActivateBestChainStep, removeForBlock and to
cover function uncovered by fuzzing at the time of fuzzing harness development (mid-2025).
Functions newly covered include DisconnectTip, DisconnectBlock, ApplyTxInUndo, MaybeUpdateMempoolForReorg, removeForReorg etc.
Authored by @RobinDavid and @nsurbay
(note shall be rebased on the other PR so that it only contains 1 commit)