2 suggestions
Optional improvements
[suggestion] · The deterministic test misses crashes during replay
This test would miss losing the old tip in the recovery marker because it never interrupts replay's flush.
Location: test/functional/feature_dbcrash_replay.py:57 (head).
Details and suggested fix
self.start_node(0) uses the original arguments, so the recovery flush completes without another simulated crash. BatchWrite restores old_tip from DB_HEAD_BLOCKS, but its final batch erases that marker. By inspection, removing old_tip = old_heads[1] would still satisfy these assertions. A crash during recovery would then leave [tip, null]; the next replay would skip rollback and leave old-branch outputs on disk.
Before the final restart, add:
with node.assert_debug_log(["Replaying blocks", "Simulating a crash"]):
node.start(extra_args=["-dbcrashratio=1", "-dbbatchsize=1"])
node.wait_until_stopped()
ReplayBlocks runs before InitCoinsCache, and its first partial batch exceeds one byte, so this interrupts recovery deterministically. Keep the existing final restart and tip/UTXO-hash assertions. The wait must stay inside the context because node.start() is asynchronous and assert_debug_log defaults to zero timeout. The randomized extended feature_dbcrash.py covers recovery crashes, but this test currently does not.
[suggestion] · RPC errors are hidden behind the process-stop timeout
An unrelated RPC error or a missing simulated crash can become a generic 60-second timeout, scaled by timeout_factor, because this test discards every exception.
Location: test/functional/feature_dbcrash_replay.py:49 (head).
Details and suggested fix
The broad except Exception discards even a JSONRPCException that leaves node0 running. A normal return without reaching the partial-batch crash takes the same path into wait_until_stopped(). Put a node.assert_debug_log(["Simulating a crash"]) context around just this try/except, ending before the stop wait. BatchWrite writes that message to the unbuffered log before _Exit(0), so a missing crash would fail at the trigger rather than after the process-stop timeout. The later replay-log assertions already prevent a false pass; this change improves failure attribution.