This fuzzer target caught the issue in #28251 within 5 minutes on master branch, and an additional issue which I’ve applied a preliminary patch to cover.
Fuzzer target does the following:
- Picks mempool confgs, including max package size, count, mempool size, etc
- Generates 1 to 26 transactions with arbitrary coins/fees, the first N-1 spending only confirmed outpoints
- Nth transaction, if >1, sweeps all unconfirmed outpoints in mempool
- If N==1, it may submit it through single-tx submission path, to allow for more interesting topologies
- Otherwise submits through package submission interface
- Repeat 1-5 a few hundred times per mempool instance
In other words, it ends up building chains of txns in the mempool using parents-and-children packages, which is currently the topology supported on master.
The test itself is a direct rip of tx_pool.cpp, with a number of assertions removed because they were failing for unknown reasons, likely due to the notification changes of single tx submission to package, which is used to track addition/removal of transactions in the test. I’ll continue working on re-adding these assertions for further invariant testing.