validation: `Assertion failed: ((pindexFirstNeverProcessed == nullptr || pindex == snap_base) == pindex->HaveNumChainTxs())`
- Dominant language
- C++
- Stars
- 90.2k
- Forks
- 39.4k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 88
Description
Can be triggered by submitting the missing parent block at the end of the `feature_prune_stale_block` functional test. The restart isn't even needed.
```diff
diff --git a/test/functional/feature_prune_stale_fork.py b/test/functional/feature_prune_stale_fork.py
index 5badca0a7c..0ecb9f2b47 100755
--- a/test/functional/feature_prune_stale_fork.py
+++ b/test/functional/feature_prune_stale_fork.py
@@ -30,8 +30,12 @@ class FeaturePruneStaleForkTest(BitcoinTestFramework):
node.pruneblockchain(node.getblockcount() - 100)
assert_raises_rpc_error(-1, "Block not available (pruned data)", node.getblock, side_child.hash_hex)
- self.log.info("Restart and mine; node must reload cleanly after the stale-fork child was pruned")
- self.restart_node(0)
+ self.log.info("Submit the missing parent block")
+ node.submitblock(side_parent.serialize().hex())
+
self.generate(node, 1)
```
So it’s the same stale-fork pruned block setup as https://github.com/bitcoin/bitcoin/issues/35050 and https://github.com/bitcoin/bitcoin/pull/35168, but without the restart requirement.
_This was found with a test running on [Antithesis](https://antithesis.com/)._
Contributor guide
Research direction
Start with test/functional/feature_prune_stale_fork.py and reproduce the assertion by submitting the missing parent block after the stale-fork child has been pruned. Review the validation path implicated by the assertion and compare the setup with issue #35050 and pull request #35168. Done means the functional test passes without triggering the assertion, including without a restart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- blockchain, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100