Repository navigation
feat: load AssumeUTXO snapshots with loadtxoutset and validate them in the background (regtest only) - #8078
Draft
PastaPastaPasta wants to merge 59 commits into
Draft
feat: load AssumeUTXO snapshots with loadtxoutset and validate them in the background (regtest only)#8078PastaPastaPasta wants to merge 59 commits into
PastaPastaPasta wants to merge 59 commits into
Conversation
1 of 3 tasks
Collaborator
|
🕓 Review not started yet because this PR is a draft.
Commit f891476. Normal review starts when eligible; priority review starts as soon as a slot is available. |
|
This pull request has conflicts, please rebase. |
PastaPastaPasta
force-pushed
the
feat/assumeutxo-loader
branch
from
November 9, 2026 19:14
9957dfa to
23122e9
Compare
PastaPastaPasta
force-pushed
the
feat/assumeutxo-loader
branch
from
November 9, 2026 23:07
23122e9 to
3fc404a
Compare
This was referenced Nov 10, 2026
|
This pull request has conflicts, please rebase. |
PastaPastaPasta
force-pushed
the
feat/assumeutxo-loader
branch
from
November 10, 2026 17:28
3fc404a to
b15e459
Compare
|
This pull request has conflicts, please rebase. |
PastaPastaPasta
force-pushed
the
feat/assumeutxo-loader
branch
from
November 10, 2026 22:48
b15e459 to
307bd3f
Compare
|
This pull request has conflicts, please rebase. |
PastaPastaPasta
force-pushed
the
feat/assumeutxo-loader
branch
from
November 11, 2026 03:40
307bd3f to
f8551ed
Compare
|
This pull request has conflicts, please rebase. |
Completion now rebuilds the entire evo section from the state background validation derived and requires its hash to equal the retained section's, which must still equal the pin. This replaces the interim refusal to validate a DIP3-active snapshot. The rebuild and the shared preflight report why they failed: missing input, local corruption, an internal error, or a disagreement (at export, where nothing is compared, a base the section cannot be built for). Only a disagreement rejects the snapshot (EVO_STATE_MISMATCH). Missing input (EVO_DATA_UNAVAILABLE) leaves it neither validated nor rejected, with a warning that says the next restart retries. Data this node has but cannot read or finds inconsistent (a retained section that is gone, does not decode or no longer matches its pin, which startup checked; an unreadable body; EvoDB best blocks that differ from their coins tips) stops the node with EVO_LOCAL_FAILURE, and an internal error (including a missing record of the background chainstate's list at the base) with EVO_INTERNAL_ERROR; neither rejects the snapshot, and startup then fails with the same advice instead of retrying at every restart. The advice says that -reindex-chainstate discards the snapshot. A coin of the background chainstate that cannot be read, so that its UTXO set hash cannot be computed, is local corruption too. Upstream rejects the snapshot there, which would leave the node on the coins it cannot read and tell the user the snapshot was invalid; this is a deliberate divergence. A snapshot still in use that cannot be rejected stops the node rather than being kept. The inputs only block bodies provide (the v20 work-block modifiers, the credit-pool window, the base coinbase and its branch, and the base's credit pool, which folds in blocks back to the last pool on disk) are captured as the background chainstate connects those blocks, in its block transaction, or at activation for blocks it has already connected; activation refuses a base whose such body is gone. The capture plan refuses a credit window reaching below genesis, since the chain checks run only after it. The rebuild prefers the captures over the bodies. A local Evo error while capturing the base pool stalls the background chainstate as other local Evo errors do. Capturing follows the registered plan, so a block the still-active chainstate connects between preparation and the switch is captured too. Since promotion repeats completion at the next startup, the captures stay until promotion; they are also dropped on rejection, when activation fails (after flushing that chainstate's coins), and at startup when no generation is live or the one left never activated (after a crash before or after publication). No prune lock is kept for them: it would not cover what either chainstate reads, and pruning is to be refused while a snapshot is in use. The MN-list work captures and the old comparison block that the design removes do not exist on this base; the existing base MN-list marker comparison is kept. Tests, on the deterministic DIP3 fixture, with sections pinned as they are: - a mutated currentLimit, credit-pool index range, signal height, rotation quarter bit or credit-window entry passes every load gate and the snapshot chainstate's own blocks, and is rejected only at completion, with no block marked invalid; a wrong modifier is, on a node without the work-block bodies at load; - a corrupted capture is a mismatch; a missing one whose block is gone is missing input with a warning naming the retry, after which completion succeeds once the body is back; activation refuses a base whose connected input body is gone; with real quorums, completion succeeds from the captures alone once every body at or below the base is gone and the caches are cold, both for those activation wrote on a synced node (a withdrawal in the window) and for those the background chainstate of a node with only the headers wrote as it connected the blocks, across a restart; - the honest run on a node with only the headers completes across a restart and dropped caches; the background chainstate announces none of the MN-list changes it connects and its ForceSignalDBUpdate writes only its own view; the captures last until promotion; NORMAL consumers read the promoted MN list and credit pool; - a published generation is refused after a V24 min_activation_height change, naming the generation, base, phase and recovery and saying the changed part is unknown, with nothing changed on disk; so is a promotion interrupted mid-merge, whose failing recovery names the way out; both resume under the original configuration; - blocks the still-active chainstate connects between preparation and the switch, through the base, are captured and its base list recorded, so completion succeeds; - a crash right after a refused switch restarts without an Evo/coins mismatch, although the chainstate connected blocks meanwhile; - an unreadable body, a changed retained section and mismatched best blocks stop the node as local corruption, an internal error and a missing base list record as internal errors, none rejecting the snapshot; startup then fails the same way, fails as local corruption on an unreadable background coin, and promotes once the data is whole again; - with real quorums: a carried safety commitment with another public key, signature or mined block in the same window is rejected only at completion; the honest section completes, the next cycle's mined commitment is NORMAL's after promotion, and a quorum-signed signal for an unused bit mined at the base is carried raw and kept by promotion; - a crash before or after publication leaves no captures after restart; - a chainstate stalled on a missing carried record keeps its warning past completion, and after the restart that promotes the snapshot the warning is gone and the stalled block connects. The completion warning and its clear raise the GUI alert through kernel::Notifications::evoStateWarningChanged(), only when the warning changes. The alert counts in chainstatemanager_evo_snapshot_completion_uses_the_captures pin one alert for the warning and one for its clear: they are parity checks, not tests that fail without a fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
edbed31 chainparams: add signet assumeutxo param at height 160_000 b8cafe3 chainparams: add testnet assumeutxo param at height 2_500_000 99839bb doc: add note about confusing HaveTxsDownloaded name 7ee46a7 contrib: add script to demo/test assumeutxo 42cae39 test: add feature_assumeutxo functional test 0f64bac rpc: add getchainstates bb05857 refuse to activate a UTXO snapshot if mempool not empty ce585a9 rpc: add loadtxoutset 62ac519 validation: do not activate snapshot if behind active chain 9511fb3 validation: assumeutxo: swap m_mempool on snapshot activation 7fcd215 blockstorage: segment normal/assumedvalid blockfiles 4c3b8ca validation: populate nChainTx value for assumedvalid chainstates 49ef778 test: adjust chainstate tests to use recognized snapshot base 1019c39 validation: pruning for multiple chainstates 373cf91 validation: indexing changes for assumeutxo 1fffdd7 net_processing: validationinterface: ignore some events for bg chain fbe0a7d wallet: validationinterface: only handle active chain notifications f073917 validationinterface: only send zmq notifications for active 4d8f4dc validation: pass ChainstateRole for validationinterface calls 1e59acd validation: only call UpdatedBlockTip for active chainstate c6af23c validation: add ChainstateRole 9f2318c validation: MaybeRebalanceCaches when chain leaves IBD 434495a chainparams: add blockhash to AssumeutxoData c711ca1 assumeutxo: remove snapshot during -reindex{-chainstate} c93ef43 bugfix: correct is_snapshot_cs in VerifyDB b73d3bb net_processing: Request assumeutxo background chain blocks Pull request description: Part of the assumeutxo project: the loadtxoutset RPC, background block download, ChainstateRole on validation-interface notifications, indexing and pruning across two chainstates. Dash adaptations: - loadtxoutset and getchainstates are hidden and regtest-only, and dumptxoutset stays hidden: no network but regtest authorizes a snapshot. - Validation-interface events of the background chainstate, which used to be suppressed, now carry their role. The Dash subscribers (ChainLock handler and signer, InstantSend, CoinJoin and masternode notifications, the coinbase ChainLock check in net_processing) ignore background events, as the wallet and zmq do, so they see only the active chain as before. - Indexes, the governance collateral index included, follow the indexing chainstate. GovCollateralIndex::CanSync is evaluated on it at startup, so a restart while the background chainstate is syncing keeps governance on. The indexes are restarted from init's list of running indexes. - Snapshot activation needs strictly more work than the active tip, at load and at the switch, where it replaces the switch's interim rule. The work comparator would let a base through that has the same work as an active tip on another branch: it breaks the tie by nSequenceId, which is assigned only when a block's data is received, so a headers-only base keeps its initial value and ranks ahead of any equal-work block received in this run. Startup completion would then find the active tip at the base height and reject the honest snapshot. The unit fixtures that load the snapshot of their own tip hide it from the active chain where activation compares work, but not while the snapshot is prepared, so that preparation still captures what the active chain has connected. - AssumeutxoData keeps its evo pin. The regtest entries at 110 and 200 get their block hashes. feature_assumeutxo.py authorizes its snapshot with -assumeutxodata instead of an entry at 299: the blocks it mines depend on how long its syncs take, which move the mock time on, so the snapshot differs between runs. It checks the dump's nChainTx and coin count against the node rather than fixed values, and expects txindex and the governance collateral index, which Dash nodes keep by default, among the synced indexes. Two of the blocks the loading nodes lack below the base carry a transaction besides the coinbase, so that their background sync meets the nChainTx case below. A fourth node lets its snapshot chainstate connect the blocks above the base, drops the snapshot with -reindex-chainstate before it is validated and then syncs normally, which meets the second nChainTx case below. - CheckBlockIndex skips 4c3b8ca's monotonic nChainTx check for blocks at or below the snapshot base while a snapshot chainstate exists. Their nTx and nChainTx can still be the values faked at activation, or derived from them: receiving a block recomputes its own nChainTx but not that of a faked child, so the check aborted a node whose downloaded blocks below the base held two or more transactions more than were faked. Above the base the counts never exceed the real ones and start from the pinned nChainTx at the base, so the check stays there. The faked counts are persisted, though: a snapshot chainstate dropped by -reindex-chainstate, or by a rejection and a restart, leaves them in the block index, and the plain sync that follows failed the check the same way. BlockManager::LoadBlockIndex() therefore records the highest block it loads with a faked count (nTx set without BLOCK_VALID_TRANSACTIONS, the compatibility case bitcoin#29370 describes), and the check also skips a block whose parent is at or below it. After the load a block's count changes only when the block itself or its parent is received, so a pair that went stale has a faked parent, which also covers the block right above the highest faked one. A fork that branches below the base, crosses the base height and arrives out of order can still fail the check, until bitcoin#29370 stops faking the counts and replaces these exceptions. - A local Evo stall of the active chainstate does not stop the background chainstate, as in the import loops: ProcessNewBlock() still runs the background chainstate's ActivateBestChain() after the active one stalls, and then returns false. Every other failure returns early, as upstream does. A stall lasts until a restart, so returning early on it would freeze background validation, and with it the promotion that ends the stall. - ChainstateRole's kernel/chain.h, now included by validation and node/blockstorage, closes an include cycle through Dash's blockfilter -> evo/specialtx_filter -> evo/assetlocktx path; it is listed in lint-circular-dependencies.py. - The nChainTx bootstrap at startup skips a base missing from the block index, which ChainstateManager::LoadBlockIndex() reports as a startup error. - The mempool swap and the -reindex snapshot deletion are already in place: ActivateSnapshot() moves the mempool at the switch, and startup deletes a snapshot chainstate before detecting it when reindexing. The VerifyDB fix is already present. - FindFilesToPrune() caps the minimum share of each chainstate at the -prune budget itself. Upstream's MIN_DISK_SPACE_FOR_BLOCK_FILES equals its -prune minimum. Dash's is 945 MiB, but regtest accepts -prune=550, so a single regtest chainstate's target rose to 945 MiB and it stopped pruning (wallet_pruning.py). One chainstate again prunes to exactly its budget. With two, mainnet and testnet split the budget as upstream does, using Dash's constant. - Dropped: the blockfile segmentation (7fcd215), which only serves pruning each chainstate separately, while a node with a snapshot chainstate does not prune; the testnet and signet parameters; the demo script, for lack of a network with a snapshot; and the release notes, as the RPCs are hidden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7e40032 tests: assumeutxo: accept final height from either chainstate 5bd2010 test: assumeutxo: avoid race in functional test 7005a01 test: add wait_for_connect to BitcoinTestFramework.connect_nodes Pull request description: Fixes some races in the assumeutxo functional test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a list of chainstates a9ef702 assumeutxo: change getchainstates RPC to return a list of chainstates Pull request description: Current `getchainstates` RPC returns "normal" and "snapshot" fields which are not ideal because it requires new "normal" and "snapshot" terms to explain, and the field names will be confusing when a snapshot chainstate becomes validated. Return a list of chainstates ordered by work with a "validated" field for each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5d227a6 rpc: Use Ensure(Any)Chainman in assumeutxo related RPCs 710e5db doc: Drop references to assumevalid in assumeutxo docs 1ff1c34 test: Rename wait_until_helper to wait_until_helper_internal a482f86 chain: Rename HaveTxsDownloaded to HaveNumChainTxs 82e48d2 blockstorage: Let FlushChainstateBlockFile return true in case of missing cursor 73700fb validation, test: Improve and document nChainTx check for testability 2c9354f doc: Add snapshot chainstate removal warning to reindexing documentation 4e915e9 test: Improvements of feature_assumeutxo a47fbe7 doc: Add and edit some comments around assumeutxo 0a39b8c validation: remove unused mempool param in DetectSnapshotChainstate Pull request description: Addressing comments from bitcoin#27596 Dash adaptations: - 82e48d2 is dropped: it changes FlushChainstateBlockFile, which comes with the blockfile segmentation this tree does not take from bitcoin#27596. - 73700fb keeps bitcoin#27596's monotonic nChainTx check in CheckBlockIndex instead of requiring nChainTx to equal the sum of nTx. Until bitcoin#29370 removes the faking of nTx at snapshot activation, a headers-only chain below a base whose blocks hold more than one transaction each fails the stricter check. The corrected regtest nChainTx values (counting the genesis coinbase) are taken, for the 200 entry too. - The wait_until_helper rename covers the Dash-only functional tests as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssumeUTXO parameters fails 2e31250 test: check that loading snapshot not matching AssumeUTXO parameters fails Pull request description: This PR adds a first test for loading an invalid snapshot: the snapshot base block is not in the assumeutxo parameters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tadata constructor, fix test, add test fafde92 test: Check snapshot file with wrong number of coins faa90f6 refactor: Remove unused nchaintx from SnapshotMetadata constructor Pull request description: Remove unused nchaintx from SnapshotMetadata constructor and add a test. develop's partial merge of this PR (ed19c19) already removed nchaintx from the SnapshotMetadata constructor and dumptxoutset; this adds the feature_assumeutxo.py test it left out. Dash adaptation: the evo section follows the coins, so with one coin too many the last one is read from the section and fails one of the coin checks rather than at the end of the file; the test matches the common part of those logs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…esn't match AssumeUTXO parameters 9620cb4 assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO parameters Pull request description: Fail early in `loadtxoutset` if the snapshot block hash is not one of the AssumeUTXO parameters, instead of waiting up to ten minutes for its header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fa68571 test: Add assumeutxo test for wrong hash Pull request description: Add a test for a snapshot file whose first outpoint hash was changed, so its content hash does not match the AssumeUTXO parameters. Dash adaptation: the snapshot differs between runs (see bitcoin#27596's port), so the test checks the expected content hash in the log, not the changed file's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
621db2f test: assumeutxo file with unknown block hash Pull request description: Check that a snapshot file whose base block hash is unknown is refused right away as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… index + de-duplications d322368 test: De-dublicate/optimize assumeutxo test for further extensions 0a576d6 test: check au file with changed outpoint index Pull request description: Extend the invalid-snapshot cases with a changed outpoint index and share the error checking between the cases. Dash adaptation: as for bitcoin#28647, the cases do not list the content hash of each changed file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two cases of bitcoin#28685's "assumeutxo: Check deserialized coins for out of range values" commit, which change a coin's height and coinbase flag in the snapshot file: the UTXO set hash commits to both since bitcoin#28685 (in the base of this stack), so the snapshot is refused. The backport of bitcoin#28685 left these hunks out because this test did not exist yet. As for bitcoin#28647, the test checks the expected content hash only. The first coin differs between runs, so instead of upstream's fixed bytes, which may equal the original or change the code's length, the cases flip the coinbase flag and the height's lowest bit in the code's last byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nvalid hash 811067c test: add coverage for snapshot chainstate not matching AssumeUTXO parameters 4a5be10 assumeutxo, blockstorage: prevent core dump on invalid hash Pull request description: A snapshot chainstate whose base block hash is not in the AssumeUTXO parameters stops startup with an error instead of an Assert crash. Dash adaptations: the block manager reports the error through AbortNode, as its other fatal errors. Startup finds the bogus chainstate_snapshot directory of the test earlier, because the node has no EvoDB state for it, so the test expects that error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on the assumeutxo invalid hash dump - follow-up bitcoin#28698 7de7685 test, assumeutxo: Use assert_debug_log for error details Pull request description: Check the logged error details of the invalid snapshot chainstate case with assert_debug_log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
997b9a7 test: add assumeutxo wallet test Pull request description: Add a wallet test for assumeutxo: a wallet backup cannot be restored while the background chainstate is still syncing, and can once it is done. Dash adaptation: node 1 authorizes node 0's snapshot with -assumeutxodata, as in feature_assumeutxo.py, instead of the test checking a fixed UTXO set hash. The wallet already writes its best block before a backup (the wallet hunk of bitcoin#30678), so a backup taken at the snapshot base needs no rescan and loads during the background sync. The test takes bitcoin#30678's test change with it: that backup loads, and one taken before the base is refused until the background sync is done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pshot completion bc43eca test: add functional test for balance after snapshot completion 226d03d validation: Send correct notification during snapshot completion Pull request description: When background validation completes during an ActivateBestChain() call, GetRole() returns NORMAL instead of BACKGROUND for the background chainstate when its BlockConnected notifications are sent. The wallet, which ignores background notifications, then sets its last processed block to the old snapshot height. The role is now captured before ActivateBestChainStep(). Dash adaptations: - The role is captured right before each ActivateBestChainStep() call inside Dash's inner loop, which can run more than one step after a stall. - The Dash subscribers that ignore background notifications (the ChainLock handler and signer, InstantSend, CoinJoin, net_processing) no longer handle the blocks of the background chainstate's final step either. - wallet_assumeutxo.py checks the third node's wallet by its last processed block instead of its balance: the test does not fund the wallet, which needs bitcoin#29354, and ensure_for() needs bitcoin#30893. The third node authorizes the snapshot with -assumeutxodata like node 1. Its snapshot chain reaches the tip by submitblock before it connects to node 0: without the snapshot-first block download of bitcoin#29519, active blocks arriving after completion would set the wallet's last processed block again and hide the bug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ith legacy indexes A pruned node keeps neither the blocks the background chainstate needs nor those Evo state below the snapshot base is read from, a masternode cannot run its duties from an unvalidated snapshot chainstate, and the -addressindex, -spentindex and -timestampindex indexes are not supported together with a snapshot chainstate. Snapshot activation now refuses all of these, in any prune mode, together with the conditions the switch already re-checked: a non-empty mempool, a base without more work than the active tip, and an invalid or ChainLock-conflicting block in the base's chain. They are checked when the snapshot is loaded, before any state is set up, and again at the switch under the same cs_main hold as before. The load check also refuses a second snapshot after one was rejected in this run, which used to reach the switch and abort on assert(!m_snapshot_chainstate), and a snapshot while the chainstate of one rejected earlier is still in chainstate_snapshot_INVALID. A rejection moves the snapshot chainstate there and tells the user it is kept, but a second rejection could not move its own there, and startup recovery then deleted it. At startup, a node with a snapshot chainstate directory, validated or not, refuses to start with -prune, one of those indexes or -masternodeblsprivkey until a restart has promoted the snapshot. -assumeutxodata is refused off regtest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hainstate While a snapshot is validated in the background, the governance collateral index, like every index, follows the background chainstate, and reports itself synced once it reaches that chainstate's tip. Governance read that as "every block up to the active tip has been read": it stopped holding governance announcements back and processed proposals whose collateral lies above the background tip, which the index cannot have yet. The lookup failed as "Can't find collateral tx", and the honest peer that relayed each such proposal got Misbehaving(20). This happened both after loading a snapshot and after a restart while it was not yet validated. GovCollateralIndex now records the chainstate it was initialized on, in CustomInit(), within the same cs_main hold in which BaseIndex::Init() sets m_synced, and IsCollateralSynced() also requires that chainstate to be the active one. Governance therefore waits until background validation has completed and the index, restarted on the active chainstate, has caught up. With a single chainstate, and after a rejection, nothing changes. A cached flag would not do, as the active chainstate changes at runtime activation, which the index does not observe. CanSync() still decides at startup on the indexing chainstate. IsCollateralSynced() takes cs_main itself. Each caller either holds cs_main already, so the acquisition is recursive and records no lock-order pair (the collateral check, AlreadyHave(), the INV loop, CheckPostponedObjects(), governance message processing), or holds no lock that is taken after cs_main elsewhere (the sync manager's tick, the release of held announcements in SendMessages(), the RPCs). While the index is behind, CheckPostponedObjects() leaves postponed proposals alone, since a failed lookup would drop them. The new functional test cannot reach this, as mnsync stays at its governance step while the index is behind; it was verified from the source. gobject prepare and gobject submit refuse with RPC_MISC_ERROR instead of failing on the lookup. Snapshot activation can leave the index behind after ProcessMessage() checked it. The object handler checks again in the cs_main hold in which it consumes the request authorization and processes the object, and when the index is behind it drops the object without consuming the authorization or penalizing the sender. Votes need no such check: processing one never looks up proposal collateral. feature_assumeutxo_refusals.py has a peer that serves no blocks announce a valid proposal whose collateral is above the background tip: the node holds the announcement without penalty, and gobject submit refuses. Once background validation completes and the index catches up, the node requests the proposal from that peer and accepts it. The test framework's CGovernanceObject.serialize() is fixed, and msg_govobj added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two activations could run at once: the snapshot chainstate is only installed at the end, so the check for an existing one let a second loadtxoutset through. The second one failed, at the latest on the first one's database lock, and its cleanup then rebalanced the caches, deleted the snapshot directory and abandoned the generation of the activation still running. ActivateSnapshot now refuses, before it changes anything, while another activation is running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Promotion renames the background chainstate directory to chainstate_todelete and deletes it at the end. When that deletion failed, or the node stopped before it, the directory stays; the next startup removes it, unless it reindexes. A snapshot loaded after such a reindex then failed its promotion on the rename, and startup aborted until the user removed the directory. The leftover is of no use, so promotion removes it durably before the rename. A failure to remove it aborts the node with its own message, as a failed rename does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n a snapshot is rejected The rejection makes the background chainstate active, but its candidates held only ancestors of the base. Blocks the snapshot chain had connected above the base were missing, so the next CheckBlockIndex aborted (with -checkblockindex, the regtest default). Re-list them with RestoreBlockIndexCandidates, the rule startup applies. Inherited from bitcoin#25740; bitcoin/master still has it, so there is no upstream fix to backport. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…check in ActivateSnapshot 33c48c1 validation: Check if mempool exists before asserting in ActivateSnapshot (TheCharlatan) Pull request description: The mempool is an optional component of the chainstate manager, so don't assume its presence and instead check if it is there first. Dash: pulled forward from the later assumeutxo backports. After a snapshot rejection the active chainstate has no mempool (next commit), so a second activation in the same run must reach the "a snapshot chainstate already exists" refusal instead of this assert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rejected snapshot handed its mempool to the validated chainstate. The mempool's transactions were accepted against the snapshot tip, so with -checkmempool (the regtest default) the check that follows completion aborted on a child of a transaction mined above the base, instead of the node stopping with its error. After a rejection raised while the snapshot chainstate connects a block, the validated chainstate can be far below the base, and it met that mempool with historical blocks. Leaving the mempool with the rejected chainstate is not enough: a rejection raised mid-step returns through that chainstate's mempool update after its coins views were reset. Detach the mempool from both chainstates for the rest of the run. Transactions are refused with no-mempool. Nothing is removed, so no InstantSend lock is dropped through the removal notification, and DumpMempool still saves the mempool for the next startup to re-validate. This drops the handback from "validation: move the mempool to the snapshot chainstate on activation" (dashpay#7553); develop cannot reach it without the snapshot loader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onger holds the mempool A snapshot rejection detaches the mempool from both chainstates, and a snapshot activation moves it from the background chainstate to the snapshot one. A mempool load (importmempool, or the load at startup) that started on the other chainstate, or after the rejection, then reached AcceptToMemoryPool's assertion that the chainstate has a mempool. Stop the load instead. bitcoin/master has the same gap after a rejection. If the mempool moved to another chainstate while the startup load ran, the load is not marked as tried. The shutdown dump then keeps mempool.dat instead of overwriting it with a partial pool, and savemempool refuses until the next start, which loads the file again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chainstatemanager_activate_snapshot deferred an InstantSend conflict on a stalled snapshot chainstate but never retried it. Keep the NetInstantSend alive and retry the deferred conflict through RetryUnresolvedConflicts: - on the next tip, while the stall persists, the retry defers it again and leaves no block invalid and the lock in place; - once a ChainLock covers the conflicting block, the retry drops the lock and leaves the chain where it is. A retry that succeeds once the unavailability clears is not reachable in a run: stalls stick until restart, and the queue is in memory. The work thread's call to RetryUnresolvedConflicts stays covered by review only: catching its removal would mean running the thread on a timer, which makes the test timing-dependent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feature_assumeutxo_dash.py checked only the evo section dumptxoutset writes. Extend it so that three cold nodes, which know only the headers, load node 0's dumps at bases 3, 23 and 18 blocks into a rotation cycle (the last inside the mining window), with the regtest default -checkblockindex: - node X refuses a mutated coin, a mutated evo section, and a pin with either hash of another dump. -reindex and then -reindex-chainstate drop snapshots whose chains connected blocks above the base, and plain IBD follows. - node R loads a section that adds an EHF signal, under a pin taken from that section. Background validation over P2P rejects it at completion: the node stops, keeps chainstate_snapshot_INVALID, misbehaves no peer and marks no block invalid. After the restart it refuses another snapshot while the rejected one is kept, then syncs from blocks. R's mempool holds a child of a transaction mined at base+1, valid only on the snapshot chain: node 0 takes the parent's InstantSend lock before mine_quorum mines it and keeps its output locked (lockunspent) for R. Completion must still stop the node cleanly with that child in the mempool. - node A takes a transaction spending snapshot coins into its mempool with an InstantSend lock from a carried quorum, and connects InstantSend, withdrawal and EHF traffic above the base. A carried platform quorum verifies the withdrawal's signature. An InstantSend lock disconnects a block A mined with a conflicting spend. With the background chainstate just past blocks before v19, a basic-scheme ChainLock is accepted with no misbehaviour. An EHF signal of a quorum the snapshot does not carry stalls the snapshot chain, also across a restart; background validation still completes in the same run, and an InstantSend lock two cycles old verifies after completion (bitcoin#31556). A masternode key is refused while the snapshot is unpromoted, and the restart that promotes it connects the stalled block. The network adds two EvoNodes for platform quorums and activates v19 at height 60, so a background chainstate can be before v19 while the snapshot chain is after it. The test now takes about 100 s, so test_runner.py lists it first among the base tests under five minutes.
…tate is readable registeredCollateralExclusion checks that the wizard keeps its collateral candidates and shows the "state unavailable" label while the masternode list cannot be read, as it cannot under a snapshot view below the base. Once the list is readable again, a refresh cleared that label only through the collateral combo box's index-change signal. A refresh that lists no candidate, with the combo box empty before and after, emits no signal, so the label stayed until the page changed. Clear the label on the readable path of the refresh, and check both halves: with one candidate, and with none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PastaPastaPasta
force-pushed
the
feat/assumeutxo-loader
branch
from
November 14, 2026 16:29
f475480 to
f891476
Compare
|
This pull request has conflicts, please rebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
The AssumeUTXO series so far (#7887, #7593, #7601) isolates Evo state per chainstate, defines and verifies a v4 Evo snapshot section, and seeds and promotes it. But nothing in the tree can actually load a snapshot. There is no
loadtxoutset, no background block download, and no node ever runs two chainstates outside unit fixtures. So the central claim of the series, that a snapshot node accepts and rejects exactly what a fully validated node does and stops when it cannot decide, has only been tested against fixtures that fake the activation.Update (2026-11-09). Rebased onto develop
6271b740e99d, after #8071, #8073 and #8067 merged. #8067's two commits dropped out of the stack as already upstream (same patch-ids). bitcoin#28218 (in #8071) movesIsInitialBlockDownloadto theChainstateManager; the stack now callsm_chainman.IsInitialBlockDownload(), as upstream's AssumeUTXO code does, and every changed caller previously asked the active chainstate, so behaviour is unchanged. At the new heads, every commit builds (gcc-11--enable-werror), the targeted unit suites pass at each layer tip, and fork CI passed on the rebased head before the W11 fixes (run 42681488491).W11 review (2026-11-09). An independent validation review found the Dash fixes correct and raised small items, now applied: the wizard clears its state-unavailable label itself when masternode state is readable again (a zero-candidate test row fails without it); a mempool load stopped by the guard is not counted as tried, so the shutdown dump keeps
mempool.dat; the guard test asserts the guard's log line; test-only clean-ups in the end-to-end and retry tests. Fork CI passed on the new head3fc404ac3725(run 42717789997), including the ASan, TSan and multiprocess jobs.Update (2026-11-10, rebase). Rebased onto develop
041e450769b, after #8070, #8081 and #8083 merged, with #8069's rebased commits underneath. #8070 made four changes the stack had to follow:llmq/options.hintollmq/utils.handllmq/options_args.h. The stack's includes switch to match.Params()tom_chainman.GetParams()inllmq/quorumsman.cpp. The stack keeps the chainman lookup on the lines it moves.CGovernanceManagerconstructor a data-directory argument. Two new test constructions pass it.node/interface_ui.hfromvalidation.cpp(kernel: Remove util/system from kernel library, interface_ui from validation. bitcoin/bitcoin#27636). Because of this, the Evo-state warning now reaches the GUI through a newkernel::Notifications::evoStateWarningChanged()hook. Its node override callsuiInterface.NotifyAlertChanged(), as the direct call did before;-alertnotifyis still not run for this warning. From feat: emit, pin, seed and verify the v4 evo snapshot section #7601 on, validation raises it only when the warning text changes. Two existing test scenarios now count these alerts.The commit count is unchanged. Every changed commit builds, the targeted unit suites pass at the #7887, #7601 and #8079 tips, and the kernel library still links on its own. All PR checks passed on the pushed head
b15e4593c1ab, and fork CI passed on it too (run 42865396767), including the ASan, TSan and multiprocess jobs.Update (2026-11-10, second rebase). Rebased onto develop
9c981d925b4, after #7939, #7815, #7678, #8085, #8088 and #8092 merged, with #8069's rebased commits underneath. Every commit replays without a conflict. One test needed a change: #8085 adds a unit test that sendsQFCOMMITMENTmessages from the test body, so the commit that turns-checkevobindingon in the unit-test fixtures now opens an active-chain view for it, as it already did for that file's other tests. At the #8079 tip the build and every unit suite pass. So do the AssumeUTXO functional tests,feature_loadblockandfeature_remove_pruned_files_on_startup, both with default settings and with-blockcompression=3(#7939 leaves compression off by default), andfeature_pruningandrpc_rawtransaction. All PR checks passed on the pushed head307bd3f4e1de, including the ASan, TSan and multiprocess jobs.linux64_nowallet-testneeded one rerun: its first run hit a timing race inp2p_invalid_tx.py --v1transportthat develop has too, where an orphan from a peer still inside its 100 ms disconnect linger is also erased by the next block.Update (2026-11-11, third rebase). Rebased onto develop
b4b4d852e34, after #8082 and #8084 merged. The only conflict was insrc/init.cpp: develop's bitcoin#26296 backport drops the/* Continued */log markers, including one in the startup repair block that #7887 moves intoFinishImportedStartup(). The block stays moved and loses the marker. The one marker the stack added itself, on the refusal to activate a snapshot while an earlier rejected one is still on disk (#8078), is gone too, and every log call the stack adds ends its format with a newline, as the new clang-tidy check requires. #7887's GETDATA changes merge onto bitcoin#27675's rewrite of that path unchanged. The commit count is unchanged. At the #8079 tip the build and every unit suite pass, and so do the AssumeUTXO functional tests,feature_loadblock,feature_remove_pruned_files_on_startup,feature_pruning,rpc_rawtransaction,mempool_reorg,mempool_limit, and the P2P tests on the paths bitcoin#27675 changed (p2p_getdata,p2p_tx_download,p2p_invalid_txandp2p_filter).Update (2026-11-11, fourth rebase). Rebased onto develop
b2172a9cf8a, after #7623, #8076, #7975, #7835 and #8052 merged. It also takes #8049's new revision (e392e45): a DKG phase thread now checks for a stop request first, and while background validation is incomplete it waits only at round start. The commit count is unchanged. #8052 applied without conflicts; two develop changes needed adapting:chainman.m_options.datadir; here that change lands in theRestartChainstateManager()helper this stack factors out (feat: emit, pin, seed and verify the v4 evo snapshot section #7601). refactor: Add [[nodiscard]] where ignoring a Result return type is an error bitcoin/bitcoin#27774's[[nodiscard]]onApplyArgsManOptions()sits next to the newLegacyIndexesEnabled()declaration (feat: load AssumeUTXO snapshots with loadtxoutset and validate them in the background (regtest only) #8078).ProcessBlock()and intoConnectTip(), after the tip update and for the active chainstate only. When a connect fails,ConnectTip()now rolls back the Evo transaction and drops the failed block's cached masternode list.-checkevobinding.Update (2026-11-11, fifth rebase). Takes #8049's newer revision (
5aa5ad6), which changes only its unit test: instead of a 200 ms timeout, the test now waits for the DKG handler's "waiting for snapshot background validation" log line. Apart from context lines next to that test, the stack's own commits are unchanged.All PR checks passed on the pushed head
9bd45557fa60, including the ASan, TSan and multiprocess jobs.At the #8079 tip the build, every unit suite and
test_dash-qtpass, and so do the AssumeUTXO functional tests andp2p_platform_ban. One develop merge earlier, on the same patches,feature_llmq_rotationandfeature_llmq_signing(with and without--spork21) passed. Before #8049's new revision was taken, the functional tests listed for the third rebase passed too, along withwallet_assumeutxo,wallet_backup,wallet_basicandwallet_importdescriptors.Update (2026-11-11, sixth rebase). Rebased onto develop
7d85e330840, after #8095, #8105, #8080, #8097 and #8094 merged. It also takes #8049's newer revision (ec71e73), which again changes only its unit test and a header comment: the in-round check now runs the wait on another thread from Idle, so only the snapshot check can end it. Every commit replays without a conflict. #8095 changes how the miner picks its best ChainLock, in the same function where this stack reads the previous block's coinbase ChainLock (#7593). The two changes are independent, and the stack's commit applies unchanged. At the #8079 tip the build and five runs ofvalidation_chainstatemanager_testspass. So do the AssumeUTXO functional tests,wallet_assumeutxo,feature_llmq_chainlocksandfeature_governance.Update (2026-11-11, seventh rebase). Rebased onto develop
ce9ef663c9e, after #8104 merged. #8104 takes a block's final commitments out of the mineable pool only once the block has been accepted, instead of inProcessCommitment(). Three commits needed adapting. InProcessCommitment()this stack keeps its per-view mined-commitment cache and drops the pool removal, as #8104 does (#7887). InRollforwardBlock()the removal runs after this stack's snapshot-input capture, which can still fail, so a block that fails there keeps its commitments in the pool (#7601). The third change is a reflowed declaration. As before #8104, the removal runs for blocks that either chainstate connects, and it reads no Evo state. A block that stalls on missing snapshot data now also keeps its commitments in the pool. Each adapted commit compiles on its own. At the #8079 tip the build passes, and so dollmq_blockprocessor_tests,validation_chainstatemanager_tests,validation_chainstate_tests,feature_llmq_dkgerrors,feature_llmq_rotation, the AssumeUTXO functional tests andwallet_assumeutxo.Update (2026-11-11, eighth rebase). Rebased onto develop
95cfb5b8f2a, after #8110 merged. #8110 replaces functional casts in Dash code withstatic_cast. One commit needed adapting: the commit that makes work modifiers exact (#7593) deletes the block-basedGetNonNullCoinbaseChainlock()overload, in which #8110 had changed a cast, so the deletion stands. Every other commit applies unchanged, and a source check found no new C-style or functional casts in the stack's Dash files. At the #8079 tip the build passes, includingdash-qt, and so doquorum_proofs_tests,llmq_commitment_tests,evo_cbtx_tests,coinjoin_tests,evo_snapshot_tests,test_dash-qt,feature_llmq_chainlocks,feature_llmq_rotation, the AssumeUTXO functional tests andwallet_assumeutxo.Update (2026-11-12, ninth rebase). Rebased onto develop
c68d3cd81fc, after #8116, #8100, #8112, #8119, #8114, #8120, #8121 and #8127 merged. One commit needed adapting: #8100 adds a governance reorg unit test, and this stack's commit that rejects unbound Evo reads (#7887) now opens an active-chain turn at the start of that test, as it does for the file's other tests that call into the node. Without it the test fails withEvoViewBindingErrorunder-checkevobinding. Every other commit applies unchanged. #8121's ChainLock check inCreateNewBlock()andgetblocktemplateruns before any Evo read, and #8119'sPeriodicStats()runs inside the stack's scheduler binding. At the #8079 tip the build passes, includingdash-qt, and so dogovernance_vote_processing_tests,llmq_chainlock_tests,spork_tests,coinjoin_inouts_tests,validation_chainstatemanager_tests,test_dash-qt,feature_governance,feature_llmq_chainlocks,feature_stats,interface_bitcoin_cli,mining_basic, the AssumeUTXO functional tests andwallet_assumeutxo. #8099, which merged after this rebase, touches no file in this stack, and a trial merge passesinterface_restandrpc_deprecated.All PR checks passed on the pushed head
e13c339be25b, including the ASan, TSan and multiprocess jobs.Update (2026-11-13, tenth rebase). Rebased onto develop
5c34dcfbf79, after #8099, #8135, #8130 and #8131 merged, and onto the reworked #8066 (db5aac0) and #8069 (b8e3318); #8049 is unchanged.ScanMinedCommitments*scans,CDBIterator::HasErroror the table-corruption test helper.CDBIterator::HasErrorin a new commit (feat(dbwrapper): report LevelDB iterator read errors), because its generation walkers need it. The corruption helper moved intoevo_db_tests.cpp, its only user.scan_mined_commitments_reports_missing_history). The scan-coverage proofs (TraverseScanSequencesand its tests) are unchanged.getPlatformQuorumnow returns UNAVAILABLE instead of FOUND for a quorum in the readable part of a window that reaches history the view lacks.interfaces_testsrows changed to match.CBLSBatchVerifierorCBLSWorker. No stack path runs either inside a scheme override or for the background chainstate.test_dash-qt, and the AssumeUTXO, governance, ChainLock, stats, CLI and mining functional tests.HasErrorcommit and its first caller compile at their own positions, and aHasError-always-false mutant failsevo_db_tests.All PR checks passed on the pushed head
6587b7dcc3b7, including the ASan, TSan and multiprocess jobs.Update (2026-11-13, eleventh rebase). Rebased onto develop
01023ded78b, after #8141, #8108, #8111, #8113, #8115, #8117, #8118, #8122 and #8069 merged. #8069 merged atb8e3318, the revision this stack already carried, so its commit leaves the bottom of the stack and nothing above it changes; #8049 and #8066 are unchanged. Every commit replays without a conflict. #8113 added a CoinJoin unit test,coinjoin_maintenance_runs_for_every_wallet, that callsDoMaintenancedirectly rather than through the scheduler, so it tripped-checkevobinding. "feat(evo): reject unbound Evo reads during dual operation" now binds the active Evo view in that test, as it already does in the other tests that drive the node the way a dispatcher does; in the node, CoinJoin maintenance already runs inside the scheduler's binding. Apart from those two test lines,git range-diffshows all 66 stack commits and the four #8049 and #8066 commits identical. At the tip the build has no warnings, every unit test suite passes, and so do the AssumeUTXO, ChainLock, CLI, mining, CoinJoin RPC, address-index,rpc_blockchainandrpc_masternodefunctional tests.All PR checks passed on the pushed head
f47548097986, including the ASan, TSan and multiprocess jobs.Update (2026-11-14, twelfth rebase). #8145 replaces #8066. Instead of a per-thread override of the process-wide BLS scheme flag, it removes the flag and takes every scheme from the data or the block. The stack now sits on #8145 (
537d8a7, ondevelopd2fb5e7) and #8049. #8078 is the first layer that can run a snapshot chainstate next to a background one, so it needs one of the two fixes; the layers below it were written against the flag. Seventeen of the 66 stack commits changed. Four differ only in context, one of them the fuzz RPC lists in the bitcoin#27596 merge, which keeploadtxoutsetandgetchainstatesbeside develop's new entries. One keeps both sides of a regtest checkpoint conflict. The other twelve drop what existed only for the flag: the scheme guards inConnectTipandDisconnectTip, the scheme restore before anevo::LocalStateErroris rethrown, and the scheme override inForceSignalDBUpdate. They also take #8145's scheme-free signatures for CbTx decoding,GetNonNullCoinbaseChainlock,VerifyEvoSnapshotBaseBlockand the work-block modifier, whose hash now uses #8145's expression. Two tests changed: the mid-connect rejection test, still run with v19 activating above the snapshot base, now checks that the background chainstate takes over instead of checking the flag, and the work-modifier test now covers the mined signature, because a pre-v19 legacy coinbase ChainLock cannot exist (it needs v20). The commit that turns-checkevobindingon in the unit-test fixtures also binds three tests that #8145 adds and the CoinJoin queue test that develop gained in #7955, and one commit's edit to a test #8145 deletes is gone. No commit was dropped. Every layer tip builds with no warnings and passes #8145'slint-bls-scheme.py. Every unit suite passes at the #7887 and #8079 tips. At the #8079 tiptest_dash-qtpasses, and so do the AssumeUTXO, ChainLock, asset-lock, EHF, ProTx-version, quorum-RPC andrpc_dumptxoutsetfunctional tests and the functional tests develop changed since the last rebase, apart from the ZMQ test, which needs a ZMQ build.All PR checks passed on the pushed head
f891476c18a5, including the ASan, TSan and multiprocess jobs.This PR adds the loader and the background validation on top of that series: the bitcoin#27596 family (
loadtxoutset,getchainstates,ChainstateRoleon validation-interface events, background block download, indexing and pruning across two chainstates) with its follow-ups, the Dash refusals the design requires, and an end-to-end test on a Dash masternode network. Running real two-chainstate nodes exposed defects that the fixtures could not reach; their fixes are in this PR and listed under "What was done".loadtxoutsetandgetchainstatesare hidden and regtest-only, anddumptxoutsetstays hidden. No network except regtest authorizes a snapshot, because no network has a pin, and-assumeutxodatais refused off regtest. So nothing a mainnet or testnet user can reach changes.Stack position. This is the fourth layer of a stack. It depends on #8145 and #8049, then #7887, #7593 and #7601, none of which has merged (#8067, bitcoin#28685, and #8069 have). Against
developthe PR therefore shows 59 commits; only the top 26 belong to this PR. It stays a draft until the layers below it merge. The next layer, the upstream hardening ports, is a separate draft PR on top of this one.This PR reverts the mempool handback of
ab3b6711675(#7553). That commit hands the snapshot chainstate's mempool to the validated chainstate when a snapshot is rejected. The mempool's transactions were accepted against the snapshot tip, so with-checkmempool(the regtest default) the check after completion aborted on a child of a transaction mined above the base, and a rejection raised while the snapshot chainstate connects a block ran historical blocks against that mempool. Keeping the mempool with the rejected chainstate, as upstream does, aborts too, because Dash's mid-step rejection resets that chainstate's coins views while its mempool update is still unwinding. So the mempool is detached from both chainstates on rejection instead. Develop cannot reach the handback without the loader, so no change on develop is needed.What was done?
26 commits: 15 upstream merges and 11 Dash commits.
Upstream ports (each commit message lists the upstream commits and the Dash adaptations):
loadtxoutset,getchainstates,ChainstateRole, background block download, indexing and pruning across chainstates.test: add the feature_assumeutxo.py cases of bitcoin#28685(a Dash commit): the functional cases for the hash change in backport: bitcoin#28685 #8067.Dash adaptations of bitcoin#27596 (the full list is in its commit message):
nSequenceId, which would admit an equal-work sibling and make startup completion reject an honest snapshot.-prunebudget, so a single regtest chainstate with-prune=550still prunes (Dash's minimum is 945 MiB).ProcessNewBlockstill runs itsActivateBestChain, otherwise background validation, and the promotion that ends the stall, would freeze.CheckBlockIndexskips the monotonicnChainTxcheck at and below the base while a snapshot chainstate exists, andBlockManager::m_faked_tx_heightrecords the highest block loaded with a faked count.Other Dash commits:
feat(validation): refuse snapshots on pruned nodes, masternodes and with legacy indexes: refusals at load and again at the switch, and at startup while a snapshot chainstate exists. This also refuses a second snapshot after a rejection in the same run (it used to abort onassert(!m_snapshot_chainstate)), and a snapshot whilechainstate_snapshot_INVALIDexists.fix(governance): wait for the collateral index to follow the active chainstate: the index reported itself synced at the background tip, so governance processed proposals whose collateral lies above it and penalized honest peers withMisbehaving(20).IsCollateralSynced()now also requires the index to follow the active chainstate.gobject submitandgobject preparerefuse withRPC_MISC_ERRORwhile it is behind.fix(validation): serialize snapshot activations: a second concurrentloadtxoutsetcould delete the first one's directory.fix(validation): replace a leftover chainstate_todelete at promotion: after a reindex a leftover directory made promotion fail on the rename.fix(validation): keep the validated chainstate's block candidates when a snapshot is rejected: blocks the snapshot chain connected above the base were missing from the candidates, so the nextCheckBlockIndexaborted. Inherited from assumeutxo: background validation completion bitcoin/bitcoin#25740; bitcoin/master still has it.fix(validation): detach the mempool when a snapshot is rejected: described above.fix(validation): stop loading a mempool file once its chainstate no longer holds the mempool:LoadMempool(startup load andimportmempool, new on develop via rpc: Add importmempool RPC bitcoin/bitcoin#27460) accepts each saved transaction on the chainstate it was given; after a rejection detached the mempool that reachedAcceptToMemoryPool's mempool assert. It now stops when that chainstate no longer holds the pool. bitcoin/master has the same gap.test: retry InstantSend conflicts that a snapshot stall deferred.test: add an end-to-end AssumeUTXO test on a Dash masternode network(feature_assumeutxo_dash.py). Three cold nodes that know only the headers load dumps at bases 3, 23 and 18 blocks into a rotation cycle (the last inside the mining window). It covers a mutated coin, a mutated Evo section and a pin with the wrong hash (all rejected);-reindexand-reindex-chainstatein dual mode; rejection at completion with a mempool child of an above-base transaction (the node stops with exit 1 and recovers); a real InstantSend conflict on the snapshot chain; a basic-scheme ChainLock accepted while the background chainstate is before V19; an EHF signal of an uncarried quorum stalling the snapshot chain, across a restart, with background validation still completing; restart and promotion.fix(qt): clear the wizard's state-unavailable label once masternode state is readable: the label was cleared only as a side effect of the collateral list changing, so a wallet with no candidates kept it; the test checks the recovered label, including with no candidates.Known gap until the next PR: with bitcoin#28218 on develop, the background chainstate's fork-warning check uses the node-wide IBD state until bitcoin#30962 (in #8079) disables it for the background chainstate, so dual mode can show a false "We do not appear to fully agree" warning. Dual mode is regtest-only here, and this PR and #8079 merge together.
Not in this PR: pins for any network, un-hiding the RPCs, dual-mode pruning, user documentation, the upstream ports that fix inherited behaviour found later (next PR), and the production-enablement items recorded in the plan.
How Has This Been Tested?
Environment: gcc-11
--enable-werror(release and BDB--enable-debugconfigurations, Qt, sqlite, zmq) and clang-19 with-Wthread-safety -Werror, in containers on Linux x86_64. "Fork CI" is the CI workflow on PastaPastaPasta/dash for the same commit.3fc404ac3725): fork CI run 42717789997 passed. Earlier heads passed too: the rebased head before the W11 fixes (run 42681488491), the pre-rebase head9957dfae3b1a(run 42609423696), and0e72434f306, which differs from it only by a test-only change (run 42596251639). The local results below were taken at9957dfae3b1a.make checkexit 0 with 173 Boost suites, no errors;test_dash-qt163 passed, 0 failed, 2 skipped. Each review round also ran per-commit gcc-11 builds with the targeted suites for the commits it changed.test_runner.py -j8 --extended --exclude feature_pruning,feature_dbcrashwithout failfast: 340 tests. The last full run on a head with the same C++ ran 325 passed, 13 skipped, 2 failed. One failure wasfeature_assumeutxo_dash.py(the test-only flake fixed in the last commit: node 0's wallet could spend the parent output before the child was signed); the other,p2p_platform_ban.py, is a DKG-timing flake under load that passes 3/3 alone at the tip and 3/3 at the previous head. The preceding full run on the earlier L4a head had 0 failures in 340 tests. The end-to-end test alone passed 12/12 stress runs at the final head, with the child signed every time.chainstatemanager_rejection_mid_connect_keeps_active_bls_schemeatvalidation.h:667; reverting validation: Check if mempool exists before size check in ActivateSnapshot bitcoin/bitcoin#30388 abortschainstatemanager_evo_snapshot_refused_when_loadedinActivateSnapshot; restoring the handback makes the end-to-end test's node exit with-6onmempoolDuplicate.HaveCoin(txin.prevout)(txmempool.cpp:1436) instead of exit 1, and its control run passes;[20 != 0].ci/dash/lint.shover the 54 commits,cppcheck-dash.pyand clang-tidy 19 onvalidation.cppreport nothing; a negative control for the clang-tidy method reports a planted finding.feature_masternode_shares.pycan fail at line 408 with "Timeout downloading block" in node1's log. It is a test race (a block still in flight when the mock time is bumped past the download timeout) exposed by what looks like a lost wakeup in the net layer on develop. The reviewers judged it not caused by this PR.DumpMempoolfollowed by a reload of a detached mempool (the end-to-end test runs with-persistmempool=0).Breaking Changes
None for any network except regtest. On regtest with a snapshot directory present, the node refuses
-prune,-addressindex,-spentindex,-timestampindexand-masternodeblsprivkeyuntil a restart has promoted the snapshot, and-assumeutxodatais refused everywhere else. A single regtest chainstate with a small-prunetarget again prunes to exactly that target.Checklist:
🤖 Generated with Claude Code