From 256482ab566360bd9d9ae0cb9c16e1a85c2de5ac Mon Sep 17 00:00:00 2001 From: optout <13562139+optout21@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:19:57 +0200 Subject: [PATCH] validation: In AcceptBlock, ignore flush result At the end of `ChainstateManager::AcceptBlock`, errors from `FlushStateToDisk` (e.g. low disk space during pruning) are ignored, so that callers can't mistreat a flush failure as a block validation failure. The internal fatal error notification still fires, so the node will shut down on unrecoverable flush errors. For state a dummy value is used, and the return value is ignored. Previously the in-out `state` parameter was used, so it could return a flush error message. Co-authored-by: Ryan Ofsky --- src/validation.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index 87cf646b8b9..5341c604c49 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4398,7 +4398,14 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr& pblock, // the block files may be pruned, so we can just call this on one // chainstate (particularly if we haven't implemented pruning with // background validation yet). - ActiveChainstate().FlushStateToDisk(state, FlushStateMode::NONE); + // + // Flush errors (e.g. low disk space during pruning) are ignored, so that + // callers can't mistreat a flush failure as a block validation failure. + // The fatal error notification inside FlushStateToDisk still fires, + // so the node will shut down on unrecoverable flush errors regardless. + // For state a dummy value is used, and the return value is ignored. + BlockValidationState flush_state_ignore; + (void)ActiveChainstate().FlushStateToDisk(flush_state_ignore, FlushStateMode::NONE); CheckBlockIndex();