This addresses the problem from #11600 that the Rolling Forward process after a crash (ReplayBlocks()
) is uninterruptible. ReplayBlocks
can take a long time to finish, and this can be especially annoying to GUI users who are taunted to “press q to shutdown” even though pressing “q” does nothing.
Now, when an interrupt is received during ReplayBlocks()
, the intermediate progress is saved:
In addition to writing the updated coins to disk, the flush adjusts the lower head block (saved in DB_HEAD_BLOCKS
), so that with the next restart, the replay continues from where it was stopped without losing progress.
I tested this manually on signet: A situation where ReplayBlocks()
becomes necessary can be created by syncing with -dbcrashratio=1
and stopping the node after ~70k blocks. Then, after the next restart, the replay process can be interrupted. I then used the dumptxoutset
output to check that the final utxo-set hash is unaffected by how many times the process is interrupted.