Skip to content

AssumeUTXO restart can treat an unlinked snapshot block as a chain candidate #37070

Backlog

Description

@l0rinc

During background sync, the snapshot block can be stored before one of its ancestors and remain in m_blocks_unlinked only in memory. After restart, its hardcoded chain transaction count makes it a background-chain candidate, and FindMostWorkChain() aborts when it reaches the unlinked parent.

Reproducer
diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py
index fa9466f2d8..6564171fb4 100755
--- a/test/functional/feature_assumeutxo.py
+++ b/test/functional/feature_assumeutxo.py
@@ -677,6 +677,13 @@ class AssumeutxoTest(BitcoinTestFramework):
         snapshot_block = n0.getblock(snapshot_hash, 0)
         n1.submitblock(snapshot_block)
 
+        self.log.info("Restart while some of the snapshot block's ancestors are missing")
+        self.restart_node(1, extra_args=self.extra_args[1], wait_for_full_init=False)
+        n1.getblock(snapshot_hash)
+        normal, snapshot = n1.getchainstates()['chainstates']
+        assert_equal(normal['blocks'], START_HEIGHT)
+        assert_equal(snapshot['blocks'], PAUSE_HEIGHT)
+
         self.connect_nodes(0, 1)
 
         self.log.info(f"Ensuring snapshot chain syncs to tip. ({FINAL_HEIGHT})")

The direct fix would be to restore the snapshot block's unlinked state and keep it out of the background candidate set until its parent links (as #36702 proposes, while remaining compatible with #36149), but given that this candidate exception exists only for AssumeUTXO, 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