AssumeUTXO snapshot activation can abort when a transaction arrives during loading #37076

issue l0rinc opened this issue on December 2, 2026
  1. l0rinc commented at 9:10 PM on December 2, 2026: contributor

    loadtxoutset checks that the mempool is empty, then releases cs_main while it loads the snapshot. A transaction accepted in that interval leaves the mempool nonempty when AddChainstate() asserts the opposite, aborting the node.

    <details> <summary>Reproducer</summary>

    The node aborts on the empty-mempool assertion in AddChainstate(), so the final check fails.

    diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py
    index fa9466f2d8..65cba8e172 100755
    --- a/test/functional/feature_assumeutxo.py
    +++ b/test/functional/feature_assumeutxo.py
    @@ -10,6 +10,8 @@ The assumeutxo value generated and used here is committed to in
     `CRegTestParams::m_assumeutxo_data` in `src/kernel/chainparams.cpp`.
     """
     import contextlib
    +import os
    +import threading
     
     from dataclasses import dataclass
     from test_framework.blocktools import (
    @@ -207,6 +209,24 @@ class AssumeutxoTest(BitcoinTestFramework):
     
             self.restart_node(2, extra_args=self.extra_args[2])
     
    +    def test_mempool_arrival_during_load(self, snapshot_path):
    +        node = self.nodes[2]
    +        with open(snapshot_path, "rb") as f:
    +            snapshot = f.read()
    +        fifo_path = os.path.join(self.options.tmpdir, "snapshot.fifo")
    +        os.mkfifo(fifo_path)
    +
    +        loader = threading.Thread(target=node.create_new_rpc_connection().loadtxoutset, args=(fifo_path,))
    +        loader.start()
    +        with open(fifo_path, "wb") as fifo:
    +            with node.busy_wait_for_debug_log([b"[snapshot] loading"]):
    +                fifo.write(snapshot[:51])
    +                fifo.flush()
    +            node.sendrawtransaction(MiniWallet(node).create_self_transfer()["hex"])
    +            fifo.write(snapshot[51:])
    +        loader.join()
    +        assert node.process.poll() is None  # TODO: A transaction arriving during loading must not abort activation
    +
         def test_invalid_file_path(self):
             self.log.info("Test bitcoind should fail when file path is invalid.")
             node = self.nodes[0]
    @@ -511,6 +531,7 @@ class AssumeutxoTest(BitcoinTestFramework):
             assert_equal(n0.getblockchaininfo()["blocks"], FINAL_HEIGHT)
     
             self.test_snapshot_with_less_work(dump_output['path'])
    +        self.test_mempool_arrival_during_load(dump_output['path'])
             self.test_invalid_mempool_state(dump_output['path'])
             self.test_invalid_snapshot_scenarios(dump_output['path'])
             self.test_invalid_chainstate_scenarios()
    

    </details>

    A narrow fix could block mempool admission during loading (as closed #36346 proposed) or recheck the mempool before activation. Both add snapshot-specific mempool handling, so I'm proposing to remove AssumeUTXO entirely in #36598 instead.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-12-03 02:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me