The debug-only -fastprune
option used in several tests is not always safe to use:
If a -fastprune
node receives a block larger than the maximum blockfile size of 64kb
bad things happen: The while loop in BlockManager::FindBlockPos
never terminates, and the node runs oom because memory for m_blockfile_info
is allocated in each iteration of the loop.
The same would happen if a naive user used -fastprune
on anything other than regtest (so this can be tested by syncing on signet for example, the first block that crashes the node is at height 2232).
Change the approach by raising the blockfile size to the size of the block, if that block otherwise wouldn’t fit (idea by TheCharlatan).