AssumeUTXO snapshot activation leaves tip notifications on the old chain #37058

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

    ActivateSnapshot() switches the active tip without updating KernelNotifications::TipBlock(). Until another block arrives, mining and IPC waits on that tip stop blocking, so waitNext keeps rebuilding the same template.

    <details> <summary>Reproducer</summary>

    diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp
    index d8463f5dc3..a06e915dad 100644
    --- a/src/test/validation_chainstatemanager_tests.cpp
    +++ b/src/test/validation_chainstatemanager_tests.cpp
    @@ -4,10 +4,12 @@
     //
     #include <chainparams.h>
     #include <consensus/validation.h>
    +#include <interfaces/types.h>
     #include <kernel/disconnected_transactions.h>
     #include <node/block_template_manager.h>
     #include <node/chainstatemanager_args.h>
     #include <node/kernel_notifications.h>
    +#include <node/miner.h>
     #include <node/utxo_snapshot.h>
     #include <random.h>
     #include <rpc/blockchain.h>
    @@ -1014,4 +1016,39 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_args, BasicTestingSetup)
         BOOST_CHECK(!get_opts({"-prevoutfetchthreads=-1"}));
     }
     
    +BOOST_FIXTURE_TEST_CASE(chainstatemanager_activate_snapshot_leaves_stale_tip_notification, TestChain100Setup)
    +{
    +    ChainstateManager& chainman = *Assert(m_node.chainman);
    +    KernelNotifications& notifications = *Assert(m_node.notifications);
    +    mineBlocks(10);
    +
    +    uint256 snapshot_hash;
    +    int64_t snapshot_time{0};
    +    {
    +        LOCK(::cs_main);
    +        BOOST_REQUIRE_EQUAL(chainman.ActiveHeight(), 110);
    +        snapshot_hash = chainman.ActiveTip()->GetBlockHash();
    +        snapshot_time = chainman.ActiveTip()->GetBlockTime();
    +    }
    +
    +    BOOST_REQUIRE(CreateAndActivateUTXOSnapshot(this, NoMalleation, /*reset_chainstate=*/true, /*in_memory_chainstate=*/true));
    +    BOOST_REQUIRE_EQUAL(WITH_LOCK(::cs_main, return chainman.ActiveTip()->GetBlockHash()), snapshot_hash);
    +
    +    BOOST_CHECK_NE(WITH_LOCK(notifications.m_tip_block_mutex, return notifications.TipBlock()).value_or(uint256{}), snapshot_hash);
    +
    +    SetMockTime(std::chrono::seconds{snapshot_time});
    +    node::BlockTemplateManager& btm = *Assert(m_node.block_template_manager);
    +    const node::BlockCreateOptions create_opts{.use_mempool = false};
    +    auto tmpl = btm.CreateNewTemplate(create_opts);
    +    BOOST_REQUIRE_EQUAL(tmpl->block.hashPrevBlock, snapshot_hash);
    +
    +    bool interrupt_wait{false};
    +    const node::BlockWaitOptions wait_opts{.timeout = 0ms, .fee_threshold = MAX_MONEY};
    +    auto next_tmpl = btm.WaitAndCreateNewBlock(*tmpl, wait_opts, create_opts, interrupt_wait);
    +    BOOST_CHECK(next_tmpl != nullptr);
    +    SetMockTime(0s);
    +
    +    m_node.validation_signals->SyncWithValidationInterfaceQueue();
    +}
    +
     BOOST_AUTO_TEST_SUITE_END()
    

    </details>

    The direct fix would be to send the normal tip notification after activation (as #31346 does after startup LoadChainTip()), but given that AssumeUTXO fixes haven't attracted much review, I'm proposing to remove AssumeUTXO entirely in #36598 instead.

  2. l0rinc renamed this:
    Snapshot activation leaves tip notifications on the old chain
    AssumeUTXO snapshot activation leaves tip notifications on the old chain
    on Dec 2, 2026

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