backport: assumeutxo M1 — snapshot persistence (bitcoin#25308, #24513, #25667, #26828)#50
backport: assumeutxo M1 — snapshot persistence (bitcoin#25308, #24513, #25667, #26828)#50PastaPastaPasta wants to merge 5 commits into
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (66)
📝 WalkthroughWalkthroughChangesThe pull request refactors Dash Core around the Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant AppInitMain
participant LoadChainstate
participant VerifyLoadedChainstate
participant ChainstateManager
participant SnapshotStorage
AppInitMain->>LoadChainstate: pass CacheSizes and ChainstateLoadOptions
LoadChainstate->>SnapshotStorage: initialize or load chainstate databases
LoadChainstate-->>AppInitMain: return ChainstateLoadResult
AppInitMain->>VerifyLoadedChainstate: verify loaded chainstate with options
VerifyLoadedChainstate-->>AppInitMain: return status and bilingual error
AppInitMain->>ChainstateManager: activate loaded chainstates
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dbcad8c to
01795d3
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
doc/design/assumeutxo.md (1)
117-118: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate stale
chainstate_[hash]reference to match newchainstate_snapshotnaming.Lines 79-81 were updated to use
chainstate_snapshotas the snapshot chainstate directory name, but line 117 still references the oldchainstate_[hash]naming when describingValidatedSnapshotShutdownCleanup(). This should saychainstate_snapshotfor consistency.📝 Proposed fix
-the background chainstate is cleaned up with -`ValidatedSnapshotShutdownCleanup()`, which renames the `chainstate_[hash]` datadir as -`chainstate`. +the background chainstate is cleaned up with +`ValidatedSnapshotShutdownCleanup()`, which renames the `chainstate_snapshot` datadir as +`chainstate`.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@doc/design/assumeutxo.md` around lines 117 - 118, Update the `ValidatedSnapshotShutdownCleanup()` description in the documentation to replace the stale `chainstate_[hash]` directory reference with `chainstate_snapshot`, matching the naming established elsewhere in the document.
🧹 Nitpick comments (2)
src/test/evo_deterministicmns_tests.cpp (1)
261-264: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the repeated tip-accessor lambdas into a shared helper.
tip_index/tip_height/tip_hash/sync_dmn_tipare redefined nearly identically in ~10 functions in this file. A single helper (e.g. a small struct or free function takingchainman/dmnmanby reference) would remove the duplication and centralize the locking pattern for future changes.♻️ Example helper
struct TipAccessors { ChainstateManager& chainman; CDeterministicMNManager& dmnman; const CBlockIndex* tip_index() const { return WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()); } int tip_height() const { return WITH_LOCK(::cs_main, return chainman.ActiveChain().Height()); } uint256 tip_hash() const { return WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()->GetBlockHash()); } void sync_dmn_tip() const { dmnman.UpdatedBlockTip(tip_index()); } };Also applies to: 299-301, 440-441, 539-540, 598-599, 706-708, 941-942, 989-991, 1180-1182, 1329-1332
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/evo_deterministicmns_tests.cpp` around lines 261 - 264, Introduce one shared helper for the repeated tip accessors, such as a TipAccessors struct holding ChainstateManager and CDeterministicMNManager references, with methods for tip_index, tip_height, tip_hash, and sync_dmn_tip that preserve the existing locking and update behavior. Replace the local lambdas in all affected test functions with this helper and update their call sites accordingly.src/dbwrapper.h (1)
338-344: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider making
StoragePath()const.It only reads
m_is_memory/m_path, so marking itconstlets it be called through aconst CDBWrapper&and better expresses intent.♻️ Proposed change
- //! `@returns` filesystem path to the on-disk data. - std::optional<fs::path> StoragePath() { + //! `@returns` filesystem path to the on-disk data. + std::optional<fs::path> StoragePath() const { if (m_is_memory) { return {}; } return m_path; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/dbwrapper.h` around lines 338 - 344, Mark the CDBWrapper::StoragePath() method const, since it only reads m_is_memory and m_path. Preserve its existing return behavior for memory-backed and on-disk storage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/coinjoin/interfaces.cpp`:
- Line 35: Align the runtime default in CCoinJoinClientOptions initialization
with the documented disabled default by changing the fallback passed to
gArgs.GetBoolArg for -enablecoinjoin from true to false. Leave the existing help
text and option behavior unchanged otherwise.
In `@src/node/utxo_snapshot.h`:
- Around line 9-16: Remove the unnecessary <validation.h> include from the
header and provide only the forward declaration of Chainstate required by
WriteSnapshotBaseBlockhash. Remove the redundant local cs_main declaration, or
retain it only with the established NOLINT(readability-redundant-declaration)
annotation matching src/node/blockstorage.h.
In `@src/rpc/coinjoin.cpp`:
- Around line 281-286: Update the salt validation callbacks in both the
`coinjoinsalt generate` and `coinjoinsalt set` handlers to check the boolean
returned by `node.coinjoin_loader->WithClient`. Assert the wallet lookup
succeeds using the file’s established `CHECK_NONFATAL` pattern, so a failed
lookup cannot bypass the `client.isMixing()` guard.
---
Outside diff comments:
In `@doc/design/assumeutxo.md`:
- Around line 117-118: Update the `ValidatedSnapshotShutdownCleanup()`
description in the documentation to replace the stale `chainstate_[hash]`
directory reference with `chainstate_snapshot`, matching the naming established
elsewhere in the document.
---
Nitpick comments:
In `@src/dbwrapper.h`:
- Around line 338-344: Mark the CDBWrapper::StoragePath() method const, since it
only reads m_is_memory and m_path. Preserve its existing return behavior for
memory-backed and on-disk storage.
In `@src/test/evo_deterministicmns_tests.cpp`:
- Around line 261-264: Introduce one shared helper for the repeated tip
accessors, such as a TipAccessors struct holding ChainstateManager and
CDeterministicMNManager references, with methods for tip_index, tip_height,
tip_hash, and sync_dmn_tip that preserve the existing locking and update
behavior. Replace the local lambdas in all affected test functions with this
helper and update their call sites accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5b15f044-a36c-41eb-9673-00b35b954b77
📒 Files selected for processing (129)
ci/dash/lint-tidy.shdoc/backports/assumeutxo-ledger.mddoc/design/assumeutxo-dash-plan.mddoc/design/assumeutxo.mddoc/developer-notes.mdsrc/Makefile.amsrc/Makefile.test.includesrc/bench/duplicate_inputs.cppsrc/bench/load_external.cppsrc/bitcoin-chainstate.cppsrc/chainlock/clsig.cppsrc/chainlock/clsig.hsrc/chainlock/handler.cppsrc/chainlock/handler.hsrc/chainlock/signing.cppsrc/chainlock/signing.hsrc/coinjoin/client.cppsrc/coinjoin/client.hsrc/coinjoin/coinjoin.cppsrc/coinjoin/coinjoin.hsrc/coinjoin/interfaces.cppsrc/coinjoin/walletman.cppsrc/coinjoin/walletman.hsrc/dbwrapper.cppsrc/dbwrapper.hsrc/dummywallet.cppsrc/governance/net_governance.cppsrc/governance/signing.cppsrc/governance/vote.cppsrc/governance/vote.hsrc/index/base.cppsrc/index/base.hsrc/init.cppsrc/instantsend/net_instantsend.cppsrc/instantsend/net_instantsend.hsrc/instantsend/signing.cppsrc/instantsend/signing.hsrc/interfaces/coinjoin.hsrc/kernel/checks.cppsrc/kernel/checks.hsrc/kernel/coinstats.cppsrc/kernel/coinstats.hsrc/kernel/mempool_persist.cppsrc/kernel/mempool_persist.hsrc/llmq/blockprocessor.cppsrc/llmq/blockprocessor.hsrc/llmq/ehf_signals.cppsrc/llmq/net_quorum.cppsrc/llmq/quorumsman.cppsrc/llmq/quorumsman.hsrc/llmq/signing.hsrc/llmq/signing_shares.cppsrc/net_processing.cppsrc/node/blockstorage.cppsrc/node/blockstorage.hsrc/node/chainstate.cppsrc/node/chainstate.hsrc/node/interfaces.cppsrc/node/miner.cppsrc/node/miner.hsrc/node/utxo_snapshot.cppsrc/node/utxo_snapshot.hsrc/qt/bitcoingui.cppsrc/qt/optionsdialog.cppsrc/qt/overviewpage.cppsrc/qt/test/wallettests.cppsrc/qt/walletmodel.cppsrc/qt/walletmodel.hsrc/rest.cppsrc/rpc/blockchain.cppsrc/rpc/blockchain.hsrc/rpc/coinjoin.cppsrc/rpc/governance.cppsrc/rpc/mempool.cppsrc/rpc/mining.cppsrc/rpc/quorums.cppsrc/rpc/rawtransaction.cppsrc/rpc/txoutproof.cppsrc/serialize.hsrc/spork.hsrc/streams.hsrc/test/block_reward_reallocation_tests.cppsrc/test/blockmanager_tests.cppsrc/test/bls_tests.cppsrc/test/coinstatsindex_tests.cppsrc/test/evo_cbtx_tests.cppsrc/test/evo_deterministicmns_tests.cppsrc/test/evo_mnhf_tests.cppsrc/test/evo_trivialvalidation.cppsrc/test/evo_utils_tests.cppsrc/test/fuzz/mempool_utils.hsrc/test/fuzz/tx_pool.cppsrc/test/governance_vote_wire_tests.cppsrc/test/interfaces_tests.cppsrc/test/llmq_chainlock_tests.cppsrc/test/miner_tests.cppsrc/test/net_tests.cppsrc/test/serialize_tests.cppsrc/test/util/chainstate.hsrc/test/util/mining.cppsrc/test/util/setup_common.cppsrc/test/util/setup_common.hsrc/test/util/validation.hsrc/test/validation_block_tests.cppsrc/test/validation_chainstate_tests.cppsrc/test/validation_chainstatemanager_tests.cppsrc/test/validation_flush_tests.cppsrc/txdb.hsrc/txmempool.hsrc/validation.cppsrc/validation.hsrc/wallet/init.cppsrc/wallet/test/availablecoins_tests.cppsrc/wallet/test/coinjoin_tests.cppsrc/wallet/test/spend_tests.cppsrc/wallet/test/util.cppsrc/wallet/test/util.hsrc/wallet/test/wallet_tests.cppsrc/wallet/wallet.cppsrc/wallet/wallet.hsrc/walletinitinterface.htest/functional/feature_init.pytest/functional/feature_remove_pruned_files_on_startup.pytest/functional/feature_sporks.pytest/functional/p2p_quorum_data.pytest/functional/rpc_coinjoin.pytest/functional/test_runner.pytest/lint/lint-circular-dependencies.pytest/sanitizer_suppressions/tsan
💤 Files with no reviewable changes (1)
- test/functional/feature_init.py
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
doc/design/assumeutxo.md (1)
117-118: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate stale
chainstate_[hash]reference to match newchainstate_snapshotnaming.Lines 79-81 were updated to use
chainstate_snapshotas the snapshot chainstate directory name, but line 117 still references the oldchainstate_[hash]naming when describingValidatedSnapshotShutdownCleanup(). This should saychainstate_snapshotfor consistency.📝 Proposed fix
-the background chainstate is cleaned up with -`ValidatedSnapshotShutdownCleanup()`, which renames the `chainstate_[hash]` datadir as -`chainstate`. +the background chainstate is cleaned up with +`ValidatedSnapshotShutdownCleanup()`, which renames the `chainstate_snapshot` datadir as +`chainstate`.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@doc/design/assumeutxo.md` around lines 117 - 118, Update the `ValidatedSnapshotShutdownCleanup()` description in the documentation to replace the stale `chainstate_[hash]` directory reference with `chainstate_snapshot`, matching the naming established elsewhere in the document.
🧹 Nitpick comments (2)
src/test/evo_deterministicmns_tests.cpp (1)
261-264: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the repeated tip-accessor lambdas into a shared helper.
tip_index/tip_height/tip_hash/sync_dmn_tipare redefined nearly identically in ~10 functions in this file. A single helper (e.g. a small struct or free function takingchainman/dmnmanby reference) would remove the duplication and centralize the locking pattern for future changes.♻️ Example helper
struct TipAccessors { ChainstateManager& chainman; CDeterministicMNManager& dmnman; const CBlockIndex* tip_index() const { return WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()); } int tip_height() const { return WITH_LOCK(::cs_main, return chainman.ActiveChain().Height()); } uint256 tip_hash() const { return WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()->GetBlockHash()); } void sync_dmn_tip() const { dmnman.UpdatedBlockTip(tip_index()); } };Also applies to: 299-301, 440-441, 539-540, 598-599, 706-708, 941-942, 989-991, 1180-1182, 1329-1332
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/evo_deterministicmns_tests.cpp` around lines 261 - 264, Introduce one shared helper for the repeated tip accessors, such as a TipAccessors struct holding ChainstateManager and CDeterministicMNManager references, with methods for tip_index, tip_height, tip_hash, and sync_dmn_tip that preserve the existing locking and update behavior. Replace the local lambdas in all affected test functions with this helper and update their call sites accordingly.src/dbwrapper.h (1)
338-344: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider making
StoragePath()const.It only reads
m_is_memory/m_path, so marking itconstlets it be called through aconst CDBWrapper&and better expresses intent.♻️ Proposed change
- //! `@returns` filesystem path to the on-disk data. - std::optional<fs::path> StoragePath() { + //! `@returns` filesystem path to the on-disk data. + std::optional<fs::path> StoragePath() const { if (m_is_memory) { return {}; } return m_path; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/dbwrapper.h` around lines 338 - 344, Mark the CDBWrapper::StoragePath() method const, since it only reads m_is_memory and m_path. Preserve its existing return behavior for memory-backed and on-disk storage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/coinjoin/interfaces.cpp`:
- Line 35: Align the runtime default in CCoinJoinClientOptions initialization
with the documented disabled default by changing the fallback passed to
gArgs.GetBoolArg for -enablecoinjoin from true to false. Leave the existing help
text and option behavior unchanged otherwise.
In `@src/node/utxo_snapshot.h`:
- Around line 9-16: Remove the unnecessary <validation.h> include from the
header and provide only the forward declaration of Chainstate required by
WriteSnapshotBaseBlockhash. Remove the redundant local cs_main declaration, or
retain it only with the established NOLINT(readability-redundant-declaration)
annotation matching src/node/blockstorage.h.
In `@src/rpc/coinjoin.cpp`:
- Around line 281-286: Update the salt validation callbacks in both the
`coinjoinsalt generate` and `coinjoinsalt set` handlers to check the boolean
returned by `node.coinjoin_loader->WithClient`. Assert the wallet lookup
succeeds using the file’s established `CHECK_NONFATAL` pattern, so a failed
lookup cannot bypass the `client.isMixing()` guard.
---
Outside diff comments:
In `@doc/design/assumeutxo.md`:
- Around line 117-118: Update the `ValidatedSnapshotShutdownCleanup()`
description in the documentation to replace the stale `chainstate_[hash]`
directory reference with `chainstate_snapshot`, matching the naming established
elsewhere in the document.
---
Nitpick comments:
In `@src/dbwrapper.h`:
- Around line 338-344: Mark the CDBWrapper::StoragePath() method const, since it
only reads m_is_memory and m_path. Preserve its existing return behavior for
memory-backed and on-disk storage.
In `@src/test/evo_deterministicmns_tests.cpp`:
- Around line 261-264: Introduce one shared helper for the repeated tip
accessors, such as a TipAccessors struct holding ChainstateManager and
CDeterministicMNManager references, with methods for tip_index, tip_height,
tip_hash, and sync_dmn_tip that preserve the existing locking and update
behavior. Replace the local lambdas in all affected test functions with this
helper and update their call sites accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5b15f044-a36c-41eb-9673-00b35b954b77
📒 Files selected for processing (129)
ci/dash/lint-tidy.shdoc/backports/assumeutxo-ledger.mddoc/design/assumeutxo-dash-plan.mddoc/design/assumeutxo.mddoc/developer-notes.mdsrc/Makefile.amsrc/Makefile.test.includesrc/bench/duplicate_inputs.cppsrc/bench/load_external.cppsrc/bitcoin-chainstate.cppsrc/chainlock/clsig.cppsrc/chainlock/clsig.hsrc/chainlock/handler.cppsrc/chainlock/handler.hsrc/chainlock/signing.cppsrc/chainlock/signing.hsrc/coinjoin/client.cppsrc/coinjoin/client.hsrc/coinjoin/coinjoin.cppsrc/coinjoin/coinjoin.hsrc/coinjoin/interfaces.cppsrc/coinjoin/walletman.cppsrc/coinjoin/walletman.hsrc/dbwrapper.cppsrc/dbwrapper.hsrc/dummywallet.cppsrc/governance/net_governance.cppsrc/governance/signing.cppsrc/governance/vote.cppsrc/governance/vote.hsrc/index/base.cppsrc/index/base.hsrc/init.cppsrc/instantsend/net_instantsend.cppsrc/instantsend/net_instantsend.hsrc/instantsend/signing.cppsrc/instantsend/signing.hsrc/interfaces/coinjoin.hsrc/kernel/checks.cppsrc/kernel/checks.hsrc/kernel/coinstats.cppsrc/kernel/coinstats.hsrc/kernel/mempool_persist.cppsrc/kernel/mempool_persist.hsrc/llmq/blockprocessor.cppsrc/llmq/blockprocessor.hsrc/llmq/ehf_signals.cppsrc/llmq/net_quorum.cppsrc/llmq/quorumsman.cppsrc/llmq/quorumsman.hsrc/llmq/signing.hsrc/llmq/signing_shares.cppsrc/net_processing.cppsrc/node/blockstorage.cppsrc/node/blockstorage.hsrc/node/chainstate.cppsrc/node/chainstate.hsrc/node/interfaces.cppsrc/node/miner.cppsrc/node/miner.hsrc/node/utxo_snapshot.cppsrc/node/utxo_snapshot.hsrc/qt/bitcoingui.cppsrc/qt/optionsdialog.cppsrc/qt/overviewpage.cppsrc/qt/test/wallettests.cppsrc/qt/walletmodel.cppsrc/qt/walletmodel.hsrc/rest.cppsrc/rpc/blockchain.cppsrc/rpc/blockchain.hsrc/rpc/coinjoin.cppsrc/rpc/governance.cppsrc/rpc/mempool.cppsrc/rpc/mining.cppsrc/rpc/quorums.cppsrc/rpc/rawtransaction.cppsrc/rpc/txoutproof.cppsrc/serialize.hsrc/spork.hsrc/streams.hsrc/test/block_reward_reallocation_tests.cppsrc/test/blockmanager_tests.cppsrc/test/bls_tests.cppsrc/test/coinstatsindex_tests.cppsrc/test/evo_cbtx_tests.cppsrc/test/evo_deterministicmns_tests.cppsrc/test/evo_mnhf_tests.cppsrc/test/evo_trivialvalidation.cppsrc/test/evo_utils_tests.cppsrc/test/fuzz/mempool_utils.hsrc/test/fuzz/tx_pool.cppsrc/test/governance_vote_wire_tests.cppsrc/test/interfaces_tests.cppsrc/test/llmq_chainlock_tests.cppsrc/test/miner_tests.cppsrc/test/net_tests.cppsrc/test/serialize_tests.cppsrc/test/util/chainstate.hsrc/test/util/mining.cppsrc/test/util/setup_common.cppsrc/test/util/setup_common.hsrc/test/util/validation.hsrc/test/validation_block_tests.cppsrc/test/validation_chainstate_tests.cppsrc/test/validation_chainstatemanager_tests.cppsrc/test/validation_flush_tests.cppsrc/txdb.hsrc/txmempool.hsrc/validation.cppsrc/validation.hsrc/wallet/init.cppsrc/wallet/test/availablecoins_tests.cppsrc/wallet/test/coinjoin_tests.cppsrc/wallet/test/spend_tests.cppsrc/wallet/test/util.cppsrc/wallet/test/util.hsrc/wallet/test/wallet_tests.cppsrc/wallet/wallet.cppsrc/wallet/wallet.hsrc/walletinitinterface.htest/functional/feature_init.pytest/functional/feature_remove_pruned_files_on_startup.pytest/functional/feature_sporks.pytest/functional/p2p_quorum_data.pytest/functional/rpc_coinjoin.pytest/functional/test_runner.pytest/lint/lint-circular-dependencies.pytest/sanitizer_suppressions/tsan
💤 Files with no reviewable changes (1)
- test/functional/feature_init.py
🛑 Comments failed to post (3)
src/coinjoin/interfaces.cpp (1)
35-35: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Default value mismatch for
-enablecoinjoinbetween help text and runtime default.The constructor sets
CCoinJoinClientOptions::SetEnabled(gArgs.GetBoolArg("-enablecoinjoin", true))with a default oftrue, but the help text insrc/wallet/init.cppline 107 documents the default as0(disabled):argsman.AddArg("-enablecoinjoin", strprintf("Enable use of CoinJoin for funds stored in this wallet (0-1, default: %u)", 0), ...)Users who omit
-enablecoinjoinwill have CoinJoin enabled at runtime, contradicting the documented default. Either change the runtime default tofalseto match the help text, or update the help text to reflectdefault: 1.🔧 Proposed fix (align runtime default to help text)
- CCoinJoinClientOptions::SetEnabled(gArgs.GetBoolArg("-enablecoinjoin", true)); + CCoinJoinClientOptions::SetEnabled(gArgs.GetBoolArg("-enablecoinjoin", false));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.CCoinJoinClientOptions::SetEnabled(gArgs.GetBoolArg("-enablecoinjoin", false));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/coinjoin/interfaces.cpp` at line 35, Align the runtime default in CCoinJoinClientOptions initialization with the documented disabled default by changing the fallback passed to gArgs.GetBoolArg for -enablecoinjoin from true to false. Leave the existing help text and option behavior unchanged otherwise.src/node/utxo_snapshot.h (1)
9-16: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash rg -n '`#include`' src/validation.h | rg -i 'utxo_snapshot' rg -n '`#include`' src/node/utxo_snapshot.h rg -n 'class Chainstate' src/node/utxo_snapshot.h src/validation.h rg -n 'extern RecursiveMutex cs_main' -A1 src/node/blockstorage.h src/node/utxo_snapshot.hRepository: PastaPastaPasta/dash
Length of output: 664
🏁 Script executed:
#!/bin/bash sed -n '1,120p' src/node/utxo_snapshot.h printf '\n--- validation.h excerpt ---\n' sed -n '1,120p' src/validation.h printf '\n--- references in utxo_snapshot.h ---\n' rg -n 'Chainstate|SnapshotMetadata|cs_main|WriteSnapshotBaseBlockhash|ReadSnapshotBaseBlockhash' src/node/utxo_snapshot.h src/validation.hRepository: PastaPastaPasta/dash
Length of output: 19311
Drop
<validation.h>here.WriteSnapshotBaseBlockhashonly needs a forward declaration ofChainstate, and the extraextern RecursiveMutex cs_main;is redundant with the declaration already pulled in byvalidation.h. If you keep the local declaration, add the sameNOLINT(readability-redundant-declaration)used insrc/node/blockstorage.h.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/node/utxo_snapshot.h` around lines 9 - 16, Remove the unnecessary <validation.h> include from the header and provide only the forward declaration of Chainstate required by WriteSnapshotBaseBlockhash. Remove the redundant local cs_main declaration, or retain it only with the established NOLINT(readability-redundant-declaration) annotation matching src/node/blockstorage.h.src/rpc/coinjoin.cpp (1)
281-286: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Inconsistent error handling for
WithClientreturn value in salt RPCs.The
coinjoinsalt generateandcoinjoinsalt sethandlers ignore theboolreturn ofWithClient. If the wallet is not found by the loader (returnsfalse), theisMixing()check is silently bypassed and salt generation proceeds without verifying mixing is inactive. All other CoinJoin RPC handlers in this file useCHECK_NONFATALto assert the wallet is found.If the wallet was already validated by
GetWalletForJSONRPCRequest, theWithClientcall should always succeed — but the defensive gap means a race or unexpected loader state would allow salt changes during active mixing rather than failing safely.Consider either asserting the return value (matching the other handlers) or returning an RPC error when
WithClientreturnsfalse.🔧 Suggested fix for `coinjoinsalt generate`
const NodeContext& node = EnsureAnyNodeContext(request.context); - if (node.coinjoin_loader != nullptr) { - node.coinjoin_loader->WithClient(wallet->GetName(), [&](auto& client) { + CHECK_NONFATAL(CHECK_NONFATAL(node.coinjoin_loader)->WithClient(wallet->GetName(), [&](auto& client) { if (client.isMixing()) { throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Wallet \"%s\" is currently mixing, cannot change salt!", str_wallet)); } - }); - } + }));Also applies to: 384-389
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/rpc/coinjoin.cpp` around lines 281 - 286, Update the salt validation callbacks in both the `coinjoinsalt generate` and `coinjoinsalt set` handlers to check the boolean returned by `node.coinjoin_loader->WithClient`. Assert the wallet lookup succeeds using the file’s established `CHECK_NONFATAL` pattern, so a failed lookup cannot bypass the `client.isMixing()` guard.
956367c to
dc94574
Compare
Upstream verification script: sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*') Verification: PASS. Applying the replacement to the parent tree reproduces this commit exactly across all 51 affected files, with no missing, unexpected, or non-mechanical changes.
dc94574 to
35d0d60
Compare
Upstream commits: d14bebf db: add StoragePath to CDBWrapper/CCoinsViewDB f9f1735 validation: rename snapshot chainstate dir 252abd1 init: add utxo snapshot detection 34d1590 add utilities for deleting on-disk leveldb data ad67ff3 validation: remove snapshot datadirs upon validation failure 8153bd9 blockmanager: avoid undefined behavior during FlushBlockFile 3a29dfb move-only: test: make snapshot chainstate setup reusable 00b357c validation: add ResetChainstates() 3c36139 test: add reset_chainstate parameter for snapshot unittests 51fc924 test: allow on-disk coins and block tree dbs in tests cced4e7 test: move-only-ish: factor out LoadVerifyActivateChainstate() e4d7995 test: add testcases for snapshot initialization bf95976 doc: add note about snapshot chainstate init
Thread on-disk database options through Dash's generalized TestChainSetup hierarchy, and make snapshot restart tests tear down and recreate Dash managers and txindex around ChainstateManager replacement.
…ad of two exist checks
35d0d60 to
183f168
Compare
Issue being fixed or feature implemented
Dash's assumeutxo support predates upstream Bitcoin Core's post-bitcoin#25667 work: we
have multi-chainstate/
ActivateSnapshot/dumptxoutset, but nothing frombitcoin#25667onward (no persistedchainstate_snapshotdir, no crash-safesnapshot bookkeeping). This is milestone 1 (of 7) of a plan to bring Dash's
assumeutxo implementation up to a modern,
loadtxoutset-capable baselinewhile preserving Dash's masternode/LLMQ/EvoDB/credit-pool extensions. The
execution plan and per-unit ledger (M1 section) are tracked outside the repo
in a private gist, not checked in: https://gist.github.com/PastaPastaPasta/aa52b1f89fb74a0566ba3b5e15afab6a
This is PR 1/7 in a stacked series (M1 → M7), based on
developatd9364c15e0.What was done?
Backported the snapshot-persistence layer that later milestones build on:
bitcoin#25308— snapshot chainstate persistence to disk (chainstate_snapshotdir, options/status/result plumbing). Dash extras (
dash_dbs_in_memory,bls_threads,worker_count,max_recsigs_age,notify_bls_state) foldedinto the same options struct; all Dash error strings preserved.
bitcoin#24513— mechanicalChainstaterename (scripted diff, 52 files, 205insertions/205 deletions, zero non-rename lines) so the rest of the upstream
series applies against matching identifiers. Inserted as a discovered
prerequisite not in the original plan.
bitcoin#25667—ActivateExistingSnapshot, following Dash's existingshared-EvoDB pattern (the EvoDB-role redesign itself is deferred to M2 by
design).
utxo_snapshot.{h,cpp}are byte-identical to upstream post-state.bitcoin#26828— small snapshot-path fix, verbatim vs. upstream.bitcoin#21585audited and found already-present (arrived via an earlierbatched backport without its own merge commit); documented in the ledger
rather than re-applied.
bitcoin#27862was originally planned for M1 but depends onSnapshotCompletionResultfrombitcoin#25740, so it moved to M3.How Has This Been Tested?
make check: exit 0.feature_init,feature_reindex,feature_pruning,feature_abortnode,feature_utxo_set_hash,rpc_blockchain×2,wallet_hd×2 — all passed.review) recorded per-commit in the ledger; milestone gate PASS on 2026-07-10.
Breaking Changes
None. This is unreleased assumeutxo groundwork; no user-facing RPC or format
changes ship in this PR (
loadtxoutsetitself stays unexposed until M4/M5).Checklist: