There are a few cases where we can mark a block and undo file as pruned in our block index, but not actually remove the files from disk.
- If we call FindFilesToPrune or FindFilesToPruneManual and crash before UnlinkPrunedFiles.
- If on Windows there is an open file handle to the file somewhere else when calling fs::remove in UnlinkPrunedFiles. This could be from another process, or if we are calling ReadBlockFromDisk/ReadRawBlockFromDisk without having a lock on cs_main (allowed since D2979).
This PR mitigates this by scanning all pruned block files on startup after LoadBlockIndexDB and unlinking them again.
This is a backport of core#26533