Skip to content

Interrupted AssumeUTXO validation is reported as a statistics failure #37072

Backlog

Description

@l0rinc

If shutdown interrupts the final UTXO hash, MaybeValidateSnapshot() returns STATS_FAILED, the same result as a real statistics failure.
At startup, a shutdown request during that hash then fails initialization with "UTXO snapshot failed to validate. Restart to resume normal initial block download, or try loading a different snapshot." instead of exiting quietly.

Reproducer
diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp
index d8463f5dc3..0402ee22e5 100644
--- a/src/test/validation_chainstatemanager_tests.cpp
+++ b/src/test/validation_chainstatemanager_tests.cpp
@@ -949,6 +949,14 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_snapshot_completion_hash_mismatch, Sna
     }
 }
 
+BOOST_FIXTURE_TEST_CASE(chainstatemanager_snapshot_hash_interrupted, SnapshotTestSetup)
+{
+    auto [validated, snapshot]{this->SetupSnapshot()};
+    BOOST_REQUIRE((*Assert(m_node.shutdown_signal))());
+    BOOST_CHECK_EQUAL(WITH_LOCK(::cs_main, return Assert(m_node.chainman)->MaybeValidateSnapshot(*validated, *snapshot)), SnapshotCompletionResult::STATS_FAILED);
+    BOOST_REQUIRE(m_node.shutdown_signal->reset());
+}
+
 /** Helper function to parse args into args_man and return the result of applying them to opts */
 template <typename Options>
 util::Result<Options> SetOptsFromArgs(ArgsManager& args_man, Options opts,

The direct fix would be to represent interruption separately and run completion only after validation succeeds (extending the restart problem in #32029), but given that this validation lifecycle disappears with background validation, I'm proposing to remove AssumeUTXO entirely in #36598 instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions