Below are the steps to reproduce the bug:
0$ cmake -B build -DENABLE_WALLET=OFF
1$ cmake --build build
2$ ./build/test/functional/feature_pruning.py --tmpdir $(pwd)/tmp
32025-12-29T18:31:27.385714Z TestFramework (INFO): PRNG seed is: 6842027149269818275
42025-12-29T18:31:27.386337Z TestFramework (INFO): Initializing test directory /home/hebasto/dev/bitcoin/tmp
52025-12-29T18:31:28.135416Z TestFramework (INFO): Warning! This test requires 4GB of disk space
62025-12-29T18:31:28.135533Z TestFramework (INFO): Mining a big blockchain of 995 blocks
72025-12-29T18:31:49.087269Z TestFramework (INFO): Check that we haven't started pruning yet because we're below PruneAfterHeight
82025-12-29T18:31:49.087331Z TestFramework (INFO): Success
92025-12-29T18:31:49.087425Z TestFramework (INFO): Though we're already using more than 550MiB, current usage: 592.1861515045166
102025-12-29T18:31:49.087446Z TestFramework (INFO): Mining 25 more blocks should cause the first block file to be pruned
112025-12-29T18:31:49.917042Z TestFramework (INFO): Success
122025-12-29T18:31:49.917238Z TestFramework (INFO): Usage should be below target: 480.3139057159424
132025-12-29T18:31:49.917265Z TestFramework (INFO): Check that we'll exceed disk space target if we have a very high stale block rate
142025-12-29T18:31:49.917287Z TestFramework (INFO): Mine 24 (stale) blocks on Node 1, followed by 25 (main chain) block reorg from Node 0, for 12 rounds
152025-12-29T18:32:23.946016Z TestFramework (INFO): Usage can be over target because of high stale rate: 640.085205078125
162025-12-29T18:32:23.947212Z TestFramework (INFO): Check that we can survive a 288 block reorg still
172025-12-29T18:32:23.947673Z TestFramework (INFO): Current block height: 1320
182025-12-29T18:32:23.948098Z TestFramework (INFO): Invalidating block 170863767faea392ccf9ff5b962cc758ebe9991b2562af2f3aa044c321d175e2 at height 1033
192025-12-29T18:32:24.322179Z TestFramework (INFO): New best height: 1032
202025-12-29T18:32:24.429004Z TestFramework (INFO): Generating new longer chain of 300 more blocks
212025-12-29T18:32:24.562884Z TestFramework (INFO): Reconnect nodes
222025-12-29T18:32:25.769411Z TestFramework (INFO): Verify height on node 2: 1332
232025-12-29T18:32:25.769654Z TestFramework (INFO): Usage possibly still high because of stale blocks in block files: 640.085205078125
242025-12-29T18:32:25.769682Z TestFramework (INFO): Mine 220 more large blocks so we have requisite history
252025-12-29T18:32:32.175362Z TestFramework (INFO): Usage should be below target: 448.4003086090088
262025-12-29T18:32:32.175530Z TestFramework (INFO): Test that we can rerequest a block we previously pruned if needed for a reorg
272025-12-29T18:32:33.817865Z TestFramework (INFO): Will need to redownload block 1033
282025-12-29T18:32:33.938875Z TestFramework (INFO): Rewind node 0 to prev main chain to mine longer chain to trigger redownload. Blocks needed: 233
292025-12-29T18:32:35.807399Z TestFramework (INFO): Verify node 2 reorged back to the main chain, some blocks of which it had to redownload
302025-12-29T18:32:38.244340Z TestFramework (INFO): Test manual pruning with block indices
312025-12-29T18:32:39.327901Z TestFramework (INFO): Success
322025-12-29T18:32:39.327948Z TestFramework (INFO): Test manual pruning with timestamps
332025-12-29T18:32:40.410622Z TestFramework (INFO): Success
342025-12-29T18:32:40.410722Z TestFramework (INFO): Test invalid pruning command line options
352025-12-29T18:32:40.580461Z TestFramework (INFO): Test scanblocks can not return pruned data
362025-12-29T18:32:40.583664Z TestFramework (ERROR): Unexpected exception
37Traceback (most recent call last):
38 File "/home/hebasto/dev/bitcoin/test/functional/test_framework/test_framework.py", line 142, in main
39 self.run_test()
40 ~~~~~~~~~~~~~^^
41 File "/home/hebasto/dev/bitcoin/./build/test/functional/feature_pruning.py", line 481, in run_test
42 self.test_scanblocks_pruned()
43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
44 File "/home/hebasto/dev/bitcoin/./build/test/functional/feature_pruning.py", line 496, in test_scanblocks_pruned
45 assert_raises_rpc_error(-1, "Block not available (pruned data)", node.scanblocks,
46 ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 "start", [{"desc": f"raw({false_positive_spk.hex()})"}], 0, 0, "basic", {"filter_false_positives": True})
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49 File "/home/hebasto/dev/bitcoin/test/functional/test_framework/util.py", line 157, in assert_raises_rpc_error
50 assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
51 ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52AssertionError: No exception raised
532025-12-29T18:32:40.636711Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
542025-12-29T18:32:40.636826Z TestFramework (WARNING): Not cleaning up dir /home/hebasto/dev/bitcoin/tmp
552025-12-29T18:32:40.636857Z TestFramework (ERROR): Test failed. Test logging available at /home/hebasto/dev/bitcoin/tmp/test_framework.log
562025-12-29T18:32:40.636939Z TestFramework (ERROR):
572025-12-29T18:32:40.637012Z TestFramework (ERROR): Hint: Call /home/hebasto/dev/bitcoin/test/functional/combine_logs.py '/home/hebasto/dev/bitcoin/tmp' to consolidate all logs
582025-12-29T18:32:40.637031Z TestFramework (ERROR):
592025-12-29T18:32:40.637048Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
602025-12-29T18:32:40.637086Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
612025-12-29T18:32:40.637103Z TestFramework (ERROR):
62[node 5] Cleaning up leftover process
63[node 4] Cleaning up leftover process
64[node 3] Cleaning up leftover process
65[node 2] Cleaning up leftover process
66[node 1] Cleaning up leftover process
The combined log appears to be too large to upload to GitHub.
This was initially observed on NetBSD and was later reproduced on Fedora 43.