If a child of the snapshot base is stored before loadtxoutset, it waits in m_blocks_unlinked. Snapshot activation gives the base a chain transaction count but does not propagate it to that child, so the snapshot chain remains stuck even after the next child arrives. With -checkblockindex (on by default on regtest), the node aborts in CheckBlockIndex() instead, which is why the reproducer turns it off.
<details> <summary>Reproducer</summary>
diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py
index fa9466f2d8..dc75d12f59 100755
--- a/test/functional/feature_assumeutxo.py
+++ b/test/functional/feature_assumeutxo.py
@@ -68,7 +68,7 @@ class AssumeutxoTest(BitcoinTestFramework):
[],
["-fastprune", "-prune=1", "-blockfilterindex=1", "-coinstatsindex=1"],
["-persistmempool=0","-txindex=1", "-blockfilterindex=1", "-coinstatsindex=1"],
- []
+ ["-checkblockindex=0"],
]
def setup_network(self):
@@ -375,6 +375,18 @@ class AssumeutxoTest(BitcoinTestFramework):
assert 'NETWORK' not in node_services
assert 'NETWORK_LIMITED' in node_services
+ def test_snapshot_activation_leaves_preloaded_child_unlinked(self, snapshot_path):
+ n0 = self.nodes[0]
+ node = self.nodes[3]
+ node.submitblock(n0.getblock(n0.getblockhash(SNAPSHOT_BASE_HEIGHT + 1), 0))
+ node.loadtxoutset(snapshot_path)
+ node.submitblock(n0.getblock(n0.getblockhash(SNAPSHOT_BASE_HEIGHT + 2), 0))
+ assert_equal(node.getblockcount(), SNAPSHOT_BASE_HEIGHT) # TODO: Advance through both available children
+
+ self.restart_node(node.index, extra_args=["-reindex", *self.extra_args[node.index]])
+ for height in range(START_HEIGHT + 1, SNAPSHOT_BASE_HEIGHT + 1):
+ node.submitheader(n0.getblock(n0.getblockhash(height), 0))
+ [@contextlib](/bitcoin-bitcoin/contributor/contextlib/).contextmanager
def assert_disk_cleanup(self, node, assumeutxo_used):
"""
@@ -517,6 +529,7 @@ class AssumeutxoTest(BitcoinTestFramework):
self.test_invalid_file_path()
self.test_snapshot_block_invalidated(dump_output['path'])
self.test_snapshot_not_on_most_work_chain(dump_output['path'])
+ self.test_snapshot_activation_leaves_preloaded_child_unlinked(dump_output['path'])
# Prune-node sanity check
assert 'NETWORK' not in n1.getnetworkinfo()['localservicesnames']
</details>
The direct fix would be to drain waiting descendants when the snapshot base becomes linkable, but given that this special linkage transition exists only for AssumeUTXO, I'm proposing to remove AssumeUTXO entirely in #36598 instead.