-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: merge bitcoin#24595 (move g_versionbitscache global to ChainstateManager) #6933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
…ry-only db for `EvoDb` and `LLMQContext` 3c85563 fix: keep databases in memory if running unit tests (Kittywhiskers Van Gogh) 8763104 refactor: clean up {c,d}tor for `TestingSetup`s (Kittywhiskers Van Gogh) 5b2e54a refactor: introduce `util::DbWrapperParams` and helper to pull out args (Kittywhiskers Van Gogh) a7bec54 refactor: move EvoDb cache size to constructor, use `std::unique_ptr` (Kittywhiskers Van Gogh) 556d0b8 refactor: move dtor to source file, delete extra ctors for notif int. (Kittywhiskers Van Gogh) 5dd2e99 refactor: delete extra ctors for netfulfilled, spork (Kittywhiskers Van Gogh) 5163e85 refactor: move ctor/dtor to source file, delete extra ctors for mn (Kittywhiskers Van Gogh) 52f7160 refactor: move ctor/dtor to source file, delete extra ctors for evo (Kittywhiskers Van Gogh) adb5117 refactor: delete extra ctors for chainlock, instantsend, governance (Kittywhiskers Van Gogh) 301bc70 refactor: move ctor/dtor to source file, delete extra ctors for CoinJoin (Kittywhiskers Van Gogh) 88a2375 refactor: move ctor/dtor to source file, delete extra ctors for LLMQ (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for #6933 * There is a mild performance improvement when restoring memory-only databases in unit tests **Build arguments:** ```bash CC=clang CXX=clang++ ./configure --prefix=$(pwd)/depends/arm64-apple-darwin25 --enable-werror --enable-debug --enable-crash-hooks --enable-stacktraces --enable-zmq --enable-suppress-external-warnings --disable-ccache --disable-hardening ``` **develop (b82450a):** ``` $ ttime ./src/test/test_dash Running 676 test cases... *** No errors detected real: 100.50s user: 61.92s system: 12.90s memory: 399920KB ``` **This PR (969e2c4):** ``` $ ttime ./src/test/test_dash # PR Running 676 test cases... *** No errors detected real: 75.06s user: 58.18s system: 10.03s memory: 394896KB ``` ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 3c85563 Tree-SHA512: 75d6059acb808edd122b492e3fa29e7202c4de4cf02dddbce047e720cf29a92ff20719e6489e2d286ead13a1762a13a67c9631da41dc6de41b7f316933685ed7
WalkthroughThis pull request refactors the codebase to centralize blockchain state access through Sequence Diagram(s)sequenceDiagram
participant Old as Old Pattern
participant New as New Pattern
participant Chainman as ChainstateManager
Old->>Old: 1. Caller has CChainState/CChain
Old->>Old: 2. Caller calls Params().GetConsensus()
Old->>Old: 3. Multiple params passed to functions
New->>Chainman: 1. Caller has ChainstateManager
New->>Chainman: 2. chainman.GetConsensus()
New->>Chainman: 3. chainman.m_versionbitscache
New->>New: Single chainman passed to functions
rect rgb(200, 220, 255)
Note over Chainman: Benefits: Centralized state access,<br/>reduced parameter coupling,<br/>unified cache management
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Key areas requiring extra attention:
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/instantsend/signing.h (1)
11-80: Add the missingChainstateManagerdeclarationThis header now names
ChainstateManager, but there’s no forward declaration or include that introduces the type. As written, compilation fails with “unknown type name ‘ChainstateManager’”. Please declare it (or include the defining header) before use.Apply this diff:
class CMasternodeSync; class CSporkManager; class CTxMemPool; struct MessageProcessingResult; +class ChainstateManager;src/instantsend/instantsend.h (1)
24-104: Forward declareChainstateManagerhere as well
ChainstateManageris used for the member and constructor but never declared in this header, so any TU including it fails to compile. Add the forward declaration (or the appropriate include) alongside the other class forward declarations.Apply this diff:
class CBlockIndex; -class CChainState; +class CChainState; +class ChainstateManager;src/evo/deterministicmns.cpp (1)
1-1413: Fix clang-format violations.CI’s clang-format-diff step failed on this file. Please rerun the project formatter (e.g.,
contrib/devtools/clang-format-diff.pyon the touched ranges) so the pipeline passes before we merge.
🧹 Nitpick comments (1)
src/qt/rpcconsole.cpp (1)
1350-1361: Null‑check MnList before lookups in detail panelSame risk as above; guard the pointer before getMNByService().
- auto dmn = clientModel->getMasternodeList().first->getMNByService(stats->nodeStats.addr); + const auto mnListPtr = clientModel->getMasternodeList().first; + auto dmn = mnListPtr ? mnListPtr->getMNByService(stats->nodeStats.addr) : nullptr;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (90)
src/bench/duplicate_inputs.cpp(2 hunks)src/chainlock/chainlock.cpp(5 hunks)src/chainlock/chainlock.h(3 hunks)src/chainlock/signing.h(1 hunks)src/coinjoin/client.cpp(1 hunks)src/deploymentstatus.cpp(0 hunks)src/deploymentstatus.h(1 hunks)src/evo/cbtx.cpp(9 hunks)src/evo/cbtx.h(2 hunks)src/evo/creditpool.cpp(7 hunks)src/evo/creditpool.h(4 hunks)src/evo/deterministicmns.cpp(21 hunks)src/evo/deterministicmns.h(7 hunks)src/evo/mnhftx.cpp(8 hunks)src/evo/mnhftx.h(3 hunks)src/evo/providertx.cpp(5 hunks)src/evo/providertx.h(6 hunks)src/evo/smldiff.cpp(6 hunks)src/evo/smldiff.h(1 hunks)src/evo/specialtxman.cpp(18 hunks)src/governance/classes.cpp(3 hunks)src/governance/classes.h(3 hunks)src/governance/governance.cpp(2 hunks)src/governance/governance.h(1 hunks)src/governance/signing.cpp(2 hunks)src/index/coinstatsindex.cpp(2 hunks)src/init.cpp(2 hunks)src/instantsend/instantsend.cpp(7 hunks)src/instantsend/instantsend.h(2 hunks)src/instantsend/signing.cpp(3 hunks)src/instantsend/signing.h(2 hunks)src/interfaces/node.h(3 hunks)src/llmq/blockprocessor.cpp(19 hunks)src/llmq/blockprocessor.h(4 hunks)src/llmq/commitment.cpp(6 hunks)src/llmq/commitment.h(1 hunks)src/llmq/context.cpp(1 hunks)src/llmq/debug.cpp(1 hunks)src/llmq/dkgsession.cpp(8 hunks)src/llmq/dkgsession.h(2 hunks)src/llmq/dkgsessionhandler.cpp(5 hunks)src/llmq/dkgsessionhandler.h(3 hunks)src/llmq/dkgsessionmgr.cpp(6 hunks)src/llmq/dkgsessionmgr.h(3 hunks)src/llmq/ehf_signals.cpp(2 hunks)src/llmq/options.cpp(2 hunks)src/llmq/options.h(2 hunks)src/llmq/quorums.cpp(10 hunks)src/llmq/quorums.h(3 hunks)src/llmq/signing_shares.cpp(2 hunks)src/llmq/signing_shares.h(2 hunks)src/llmq/utils.cpp(26 hunks)src/llmq/utils.h(2 hunks)src/masternode/active/context.cpp(1 hunks)src/masternode/payments.cpp(5 hunks)src/net_processing.cpp(3 hunks)src/node/chainstate.cpp(4 hunks)src/node/interfaces.cpp(3 hunks)src/node/miner.cpp(8 hunks)src/qt/clientmodel.cpp(3 hunks)src/qt/clientmodel.h(2 hunks)src/qt/governancelist.cpp(3 hunks)src/qt/masternodelist.cpp(10 hunks)src/qt/masternodelist.h(2 hunks)src/qt/rpcconsole.cpp(3 hunks)src/rpc/blockchain.cpp(5 hunks)src/rpc/evo.cpp(6 hunks)src/rpc/governance.cpp(3 hunks)src/rpc/masternode.cpp(10 hunks)src/rpc/mining.cpp(10 hunks)src/rpc/quorums.cpp(13 hunks)src/rpc/rawtransaction.cpp(2 hunks)src/test/block_reward_reallocation_tests.cpp(7 hunks)src/test/blockfilter_index_tests.cpp(4 hunks)src/test/dynamic_activation_thresholds_tests.cpp(5 hunks)src/test/evo_deterministicmns_tests.cpp(22 hunks)src/test/evo_trivialvalidation.cpp(5 hunks)src/test/evo_utils_tests.cpp(1 hunks)src/test/fuzz/utxo_snapshot.cpp(2 hunks)src/test/miner_tests.cpp(1 hunks)src/test/subsidy_tests.cpp(2 hunks)src/test/util/mining.cpp(3 hunks)src/test/util/mining.h(1 hunks)src/test/util/setup_common.cpp(5 hunks)src/test/validation_block_tests.cpp(4 hunks)src/test/validation_chainstate_tests.cpp(1 hunks)src/test/versionbits_tests.cpp(10 hunks)src/validation.cpp(32 hunks)src/validation.h(11 hunks)test/lint/lint-circular-dependencies.py(1 hunks)
💤 Files with no reviewable changes (1)
- src/deploymentstatus.cpp
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/bench/duplicate_inputs.cppsrc/llmq/debug.cppsrc/index/coinstatsindex.cppsrc/evo/providertx.hsrc/test/miner_tests.cppsrc/test/versionbits_tests.cppsrc/qt/masternodelist.hsrc/net_processing.cppsrc/evo/smldiff.hsrc/llmq/dkgsessionhandler.hsrc/init.cppsrc/governance/signing.cppsrc/test/blockfilter_index_tests.cppsrc/rpc/rawtransaction.cppsrc/llmq/options.hsrc/instantsend/instantsend.cppsrc/chainlock/chainlock.hsrc/governance/governance.hsrc/chainlock/signing.hsrc/test/evo_trivialvalidation.cppsrc/llmq/ehf_signals.cppsrc/test/util/mining.cppsrc/llmq/context.cppsrc/llmq/commitment.cppsrc/evo/cbtx.hsrc/evo/smldiff.cppsrc/instantsend/signing.cppsrc/test/evo_utils_tests.cppsrc/test/util/mining.hsrc/governance/classes.hsrc/node/interfaces.cppsrc/instantsend/instantsend.hsrc/test/validation_chainstate_tests.cppsrc/rpc/governance.cppsrc/test/block_reward_reallocation_tests.cppsrc/interfaces/node.hsrc/deploymentstatus.hsrc/llmq/signing_shares.hsrc/llmq/quorums.hsrc/llmq/signing_shares.cppsrc/llmq/quorums.cppsrc/node/chainstate.cppsrc/masternode/payments.cppsrc/evo/mnhftx.cppsrc/test/validation_block_tests.cppsrc/evo/deterministicmns.hsrc/governance/classes.cppsrc/rpc/evo.cppsrc/llmq/dkgsession.hsrc/llmq/dkgsessionmgr.hsrc/validation.hsrc/instantsend/signing.hsrc/rpc/blockchain.cppsrc/llmq/dkgsessionmgr.cppsrc/governance/governance.cppsrc/coinjoin/client.cppsrc/qt/clientmodel.cppsrc/test/fuzz/utxo_snapshot.cppsrc/llmq/blockprocessor.cppsrc/test/subsidy_tests.cppsrc/test/evo_deterministicmns_tests.cppsrc/rpc/quorums.cppsrc/masternode/active/context.cppsrc/rpc/masternode.cppsrc/evo/creditpool.hsrc/llmq/utils.cppsrc/llmq/dkgsessionhandler.cppsrc/chainlock/chainlock.cppsrc/llmq/blockprocessor.hsrc/evo/cbtx.cppsrc/qt/clientmodel.hsrc/qt/governancelist.cppsrc/evo/providertx.cppsrc/validation.cppsrc/evo/mnhftx.hsrc/node/miner.cppsrc/evo/creditpool.cppsrc/test/dynamic_activation_thresholds_tests.cppsrc/rpc/mining.cppsrc/llmq/options.cppsrc/evo/specialtxman.cppsrc/llmq/commitment.hsrc/llmq/dkgsession.cppsrc/evo/deterministicmns.cppsrc/qt/masternodelist.cppsrc/qt/rpcconsole.cppsrc/llmq/utils.hsrc/test/util/setup_common.cpp
src/bench/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Performance benchmarks should be placed in src/bench/ and use nanobench
Files:
src/bench/duplicate_inputs.cpp
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Masternode lists must use immutable data structures (Immer library) for thread safety
Files:
src/evo/providertx.hsrc/evo/smldiff.hsrc/evo/cbtx.hsrc/evo/smldiff.cppsrc/masternode/payments.cppsrc/evo/mnhftx.cppsrc/evo/deterministicmns.hsrc/masternode/active/context.cppsrc/evo/creditpool.hsrc/evo/cbtx.cppsrc/evo/providertx.cppsrc/evo/mnhftx.hsrc/evo/creditpool.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests for C++ code should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests
Files:
src/test/miner_tests.cppsrc/test/versionbits_tests.cppsrc/test/blockfilter_index_tests.cppsrc/test/evo_trivialvalidation.cppsrc/test/util/mining.cppsrc/test/evo_utils_tests.cppsrc/test/util/mining.hsrc/test/validation_chainstate_tests.cppsrc/test/block_reward_reallocation_tests.cppsrc/test/validation_block_tests.cppsrc/test/fuzz/utxo_snapshot.cppsrc/test/subsidy_tests.cppsrc/test/evo_deterministicmns_tests.cppsrc/test/dynamic_activation_thresholds_tests.cppsrc/test/util/setup_common.cpp
🧠 Learnings (21)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/bench/duplicate_inputs.cppsrc/test/miner_tests.cppsrc/test/versionbits_tests.cppsrc/test/evo_trivialvalidation.cppsrc/test/evo_utils_tests.cppsrc/rpc/governance.cppsrc/test/block_reward_reallocation_tests.cppsrc/masternode/payments.cppsrc/coinjoin/client.cppsrc/test/fuzz/utxo_snapshot.cppsrc/test/subsidy_tests.cppsrc/test/evo_deterministicmns_tests.cppsrc/rpc/masternode.cppsrc/test/util/setup_common.cpp
📚 Learning: 2025-08-19T14:57:31.801Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Applied to files:
src/bench/duplicate_inputs.cppsrc/test/miner_tests.cppsrc/net_processing.cppsrc/test/blockfilter_index_tests.cppsrc/evo/mnhftx.cppsrc/test/validation_block_tests.cppsrc/test/fuzz/utxo_snapshot.cppsrc/llmq/blockprocessor.cppsrc/llmq/blockprocessor.hsrc/rpc/mining.cpp
📚 Learning: 2025-10-02T18:29:54.756Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6840
File: src/net_processing.cpp:2882-2886
Timestamp: 2025-10-02T18:29:54.756Z
Learning: Across net_processing.cpp, once LLMQContext (m_llmq_ctx) is asserted non-null, its subcomponents (e.g., isman, qdkgsman, quorum_block_processor) are treated as initialized and used without extra null checks.
Applied to files:
src/llmq/debug.cppsrc/llmq/dkgsessionhandler.hsrc/llmq/options.hsrc/llmq/context.cppsrc/llmq/commitment.cppsrc/instantsend/signing.cppsrc/llmq/signing_shares.hsrc/llmq/quorums.hsrc/llmq/quorums.cppsrc/node/chainstate.cppsrc/evo/mnhftx.cppsrc/llmq/dkgsession.hsrc/llmq/blockprocessor.cppsrc/rpc/quorums.cppsrc/masternode/active/context.cppsrc/llmq/utils.cppsrc/llmq/dkgsessionhandler.cppsrc/llmq/blockprocessor.hsrc/evo/cbtx.cppsrc/evo/mnhftx.hsrc/node/miner.cppsrc/llmq/options.cppsrc/evo/specialtxman.cppsrc/llmq/dkgsession.cppsrc/llmq/utils.h
📚 Learning: 2025-06-06T11:53:09.094Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6665
File: src/evo/providertx.h:82-82
Timestamp: 2025-06-06T11:53:09.094Z
Learning: In ProTx serialization code (SERIALIZE_METHODS), version checks should use hardcoded maximum flags (/*is_basic_scheme_active=*/true, /*is_extended_addr=*/true) rather than deployment-based flags. This is because serialization code should be able to deserialize any structurally valid ProTx up to the maximum version the code knows how to handle, regardless of current consensus validity. Validation code, not serialization code, is responsible for checking whether a ProTx version is consensus-valid based on deployment status.
Applied to files:
src/evo/providertx.hsrc/test/versionbits_tests.cppsrc/test/evo_trivialvalidation.cppsrc/deploymentstatus.hsrc/rpc/evo.cppsrc/test/evo_deterministicmns_tests.cppsrc/evo/cbtx.cppsrc/evo/providertx.cppsrc/validation.cppsrc/rpc/mining.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-07-09T15:02:26.899Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6729
File: src/evo/deterministicmns.cpp:1313-1316
Timestamp: 2025-07-09T15:02:26.899Z
Learning: In Dash's masternode transaction validation, `IsVersionChangeValid()` is only called by transaction types that update existing masternode entries (like `ProUpServTx`, `ProUpRegTx`, `ProUpRevTx`), not by `ProRegTx` which creates new entries. This means validation logic in `IsVersionChangeValid()` only applies to the subset of transaction types that actually call it, not all masternode transaction types.
Applied to files:
src/evo/providertx.hsrc/evo/deterministicmns.hsrc/rpc/evo.cppsrc/governance/governance.cppsrc/test/evo_deterministicmns_tests.cppsrc/evo/cbtx.cppsrc/evo/providertx.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-07-20T18:42:49.794Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.794Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety
Applied to files:
src/qt/masternodelist.hsrc/node/interfaces.cppsrc/interfaces/node.hsrc/node/chainstate.cppsrc/evo/deterministicmns.hsrc/coinjoin/client.cppsrc/qt/clientmodel.cppsrc/test/evo_deterministicmns_tests.cppsrc/rpc/masternode.cppsrc/qt/clientmodel.hsrc/qt/governancelist.cppsrc/llmq/dkgsession.cppsrc/evo/deterministicmns.cppsrc/qt/masternodelist.cppsrc/qt/rpcconsole.cppsrc/llmq/utils.h
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/rpc/rawtransaction.cppsrc/test/evo_trivialvalidation.cppsrc/test/evo_utils_tests.cppsrc/test/block_reward_reallocation_tests.cppsrc/rpc/evo.cppsrc/rpc/blockchain.cppsrc/test/evo_deterministicmns_tests.cppsrc/rpc/masternode.cppsrc/test/util/setup_common.cpp
📚 Learning: 2025-02-06T14:34:30.466Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Applied to files:
src/rpc/rawtransaction.cppsrc/rpc/blockchain.cppsrc/rpc/mining.cpp
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/rpc/rawtransaction.cpp
📚 Learning: 2025-01-14T08:37:16.955Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6530
File: src/validation.cpp:360-362
Timestamp: 2025-01-14T08:37:16.955Z
Learning: The UpdateTransactionsFromBlock() method in txmempool.cpp takes parameters in the order: vHashUpdate, ancestor_size_limit, ancestor_count_limit. The size limit comes before the count limit.
Applied to files:
src/rpc/rawtransaction.cpp
📚 Learning: 2025-05-05T12:45:44.781Z
Learnt from: knst
Repo: dashpay/dash PR: 6658
File: src/evo/creditpool.cpp:177-185
Timestamp: 2025-05-05T12:45:44.781Z
Learning: The GetAncestor() function in CBlockIndex safely handles negative heights by returning nullptr rather than asserting, making it safe to call with potentially negative values.
Applied to files:
src/rpc/rawtransaction.cpp
📚 Learning: 2025-08-19T15:08:00.835Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/commitment.cpp:54-60
Timestamp: 2025-08-19T15:08:00.835Z
Learning: In Dash Core, llmq_params.size == 1 is used only for regtest environments, not on public networks, which significantly reduces the risk profile of code paths specific to single-member quorums.
Applied to files:
src/llmq/options.hsrc/instantsend/signing.cppsrc/test/evo_utils_tests.cppsrc/llmq/quorums.hsrc/llmq/quorums.cppsrc/llmq/blockprocessor.cppsrc/rpc/quorums.cppsrc/llmq/utils.cppsrc/node/miner.cppsrc/llmq/options.cpp
📚 Learning: 2025-01-02T21:50:00.967Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6504
File: src/llmq/context.cpp:42-43
Timestamp: 2025-01-02T21:50:00.967Z
Learning: LLMQContext manages concurrency for the `CInstantSendManager`. Previously, this was handled globally; now it's handled as a class member in `LLMQContext`, but the concurrency control remains consistent.
Applied to files:
src/instantsend/instantsend.cppsrc/llmq/context.cppsrc/instantsend/signing.cppsrc/instantsend/instantsend.hsrc/instantsend/signing.hsrc/evo/mnhftx.h
📚 Learning: 2025-07-15T14:53:04.819Z
Learnt from: knst
Repo: dashpay/dash PR: 6691
File: src/test/llmq_params_tests.cpp:148-151
Timestamp: 2025-07-15T14:53:04.819Z
Learning: In the Dash Core LLMQ implementation, signingActiveQuorumCount is never 0 in the actual parameters defined in params.h, making division by zero scenarios unrealistic in the max_cycles() function.
Applied to files:
src/instantsend/instantsend.cppsrc/llmq/ehf_signals.cppsrc/llmq/commitment.cppsrc/instantsend/signing.cppsrc/llmq/quorums.hsrc/llmq/signing_shares.cppsrc/llmq/quorums.cppsrc/llmq/dkgsessionmgr.cppsrc/llmq/blockprocessor.cppsrc/rpc/quorums.cppsrc/llmq/utils.cppsrc/llmq/dkgsessionhandler.cppsrc/evo/cbtx.cppsrc/validation.cppsrc/node/miner.cppsrc/llmq/options.cppsrc/llmq/dkgsession.cpp
📚 Learning: 2025-07-29T14:32:48.369Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
Applied to files:
src/instantsend/instantsend.cppsrc/chainlock/signing.hsrc/llmq/commitment.cppsrc/evo/smldiff.cppsrc/chainlock/chainlock.cppsrc/llmq/commitment.h
📚 Learning: 2024-12-29T17:43:41.755Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6504
File: src/llmq/quorums.cpp:224-224
Timestamp: 2024-12-29T17:43:41.755Z
Learning: The `CQuorumManager` is fully initialized by `LLMQContext`, addressing any concerns about the manager’s initialization sequence.
Applied to files:
src/llmq/context.cppsrc/instantsend/instantsend.hsrc/llmq/signing_shares.hsrc/llmq/quorums.hsrc/llmq/quorums.cppsrc/node/chainstate.cppsrc/llmq/dkgsession.hsrc/llmq/utils.cppsrc/evo/mnhftx.h
📚 Learning: 2025-07-20T18:42:49.794Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.794Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h
Applied to files:
src/interfaces/node.hsrc/rpc/evo.cppsrc/test/evo_deterministicmns_tests.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-10-28T18:36:40.263Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6923
File: src/test/util/setup_common.cpp:235-251
Timestamp: 2025-10-28T18:36:40.263Z
Learning: In `src/test/util/setup_common.cpp`, the `CEvoDB` instance in `BasicTestingSetup` is constructed with `.memory = true` flag (memory-only mode), so it does not create file handles on disk. This makes the destructor teardown order safe even if `fs::remove_all(m_path_root)` is called before `m_node.evodb.reset()`.
Applied to files:
src/node/chainstate.cppsrc/test/util/setup_common.cpp
📚 Learning: 2025-01-07T18:50:44.838Z
Learnt from: knst
Repo: dashpay/dash PR: 6511
File: src/evo/deterministicmns.cpp:1369-1373
Timestamp: 2025-01-07T18:50:44.838Z
Learning: The functions `MigrateDBIfNeeded` and `MigrateDBIfNeeded2` in `src/evo/deterministicmns.cpp` are temporary and will be removed in a future version. Refactoring suggestions for these functions should be avoided.
Applied to files:
src/evo/deterministicmns.hsrc/test/evo_deterministicmns_tests.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-06-16T17:59:55.669Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6665
File: src/evo/deterministicmns.cpp:1284-1287
Timestamp: 2025-06-16T17:59:55.669Z
Learning: In Dash masternode ProRegTx validation, platform ports (platformHTTPPort and platformP2PPort) are mandatory and must be non-zero, while netInfo (ipAndPort) is optional. This means that even if an empty netInfo returns 0 from GetPrimary().GetPort(), it won't cause false positives in port duplication checks since platform ports cannot be 0.
Applied to files:
src/rpc/evo.cppsrc/evo/providertx.cpp
🧬 Code graph analysis (75)
src/bench/duplicate_inputs.cpp (2)
src/node/interfaces.cpp (15)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)Assert(193-193)Assert(194-194)Assert(219-219)Assert(360-360)Assert(383-383)Assert(505-505)Assert(714-717)Assert(926-926)block(841-844)block(841-841)block(845-848)block(845-845)src/validation.cpp (2)
GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)
src/llmq/debug.cpp (1)
src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/index/coinstatsindex.cpp (1)
src/validation.cpp (8)
GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)
src/evo/providertx.h (2)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/evo/providertx.cpp (14)
nodiscard(20-27)GetMaxFromDeployment(20-21)GetMaxFromDeployment(28-30)GetMaxFromDeployment(31-33)GetMaxFromDeployment(34-36)GetMaxFromDeployment(37-39)IsTriviallyValid(66-119)IsTriviallyValid(66-67)IsTriviallyValid(164-190)IsTriviallyValid(164-165)IsTriviallyValid(209-229)IsTriviallyValid(209-210)IsTriviallyValid(243-256)IsTriviallyValid(243-244)
src/test/miner_tests.cpp (1)
src/node/interfaces.cpp (10)
Assert(193-193)Assert(194-194)Assert(219-219)Assert(360-360)Assert(383-383)Assert(505-505)Assert(714-717)Assert(926-926)m_node(1143-1147)m_node(1148-1152)
src/qt/masternodelist.h (2)
src/interfaces/node.h (2)
MnEntry(64-462)MnEntry(68-68)src/qt/masternodelist.cpp (2)
GetSelectedDIP3MN(337-362)GetSelectedDIP3MN(337-337)
src/evo/smldiff.h (1)
src/evo/smldiff.cpp (2)
BuildQuorumChainlockInfo(71-122)BuildQuorumChainlockInfo(71-72)
src/llmq/dkgsessionhandler.h (3)
src/llmq/dkgsessionhandler.cpp (2)
CDKGSessionHandler(27-56)CDKGSessionHandler(58-58)src/llmq/dkgsessionmgr.cpp (2)
CDKGSessionManager(32-62)CDKGSessionManager(64-64)src/llmq/dkgsessionmgr.h (1)
CDKGSessionManager(46-126)
src/governance/signing.cpp (1)
src/governance/classes.cpp (2)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)
src/rpc/rawtransaction.cpp (1)
src/evo/cbtx.cpp (2)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)
src/llmq/options.h (3)
src/validation.cpp (7)
ChainstateManager(6115-6125)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)src/validation.h (2)
Consensus(63-65)std(508-601)src/llmq/options.cpp (4)
GetEnabledQuorumTypes(102-113)GetEnabledQuorumTypes(102-103)GetEnabledQuorumParams(115-125)GetEnabledQuorumParams(115-116)
src/instantsend/instantsend.cpp (3)
src/rpc/quorums.cpp (2)
WITH_LOCK(138-138)WITH_LOCK(996-996)src/net_processing.cpp (5)
WITH_LOCK(331-334)WITH_LOCK(3166-3166)WITH_LOCK(3188-3188)pindex(607-607)pindex(849-849)src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
src/chainlock/chainlock.h (3)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/chainlock/chainlock.cpp (2)
CChainLocksHandler(46-57)CChainLocksHandler(59-63)src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/governance/governance.h (1)
src/governance/governance.cpp (2)
IsValidSuperblock(1745-1757)IsValidSuperblock(1745-1746)
src/llmq/ehf_signals.cpp (1)
src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
src/test/util/mining.cpp (3)
src/node/interfaces.cpp (15)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)block(841-844)block(841-841)block(845-848)block(845-845)Assert(193-193)Assert(194-194)Assert(219-219)Assert(360-360)Assert(383-383)Assert(505-505)Assert(714-717)Assert(926-926)src/validation.cpp (2)
GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)src/test/util/mining.h (1)
node(16-18)
src/llmq/context.cpp (1)
src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/llmq/commitment.cpp (1)
src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/evo/cbtx.h (1)
src/evo/cbtx.cpp (6)
CheckCbTx(23-46)CheckCbTx(23-23)CalcCbTxMerkleRootQuorums(122-213)CalcCbTxMerkleRootQuorums(122-124)GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)
src/evo/smldiff.cpp (1)
src/evo/cbtx.cpp (2)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)
src/instantsend/signing.cpp (1)
src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
src/test/util/mining.h (1)
src/test/util/mining.cpp (2)
CreateBlockChain(33-63)CreateBlockChain(33-33)
src/governance/classes.h (1)
src/governance/classes.cpp (4)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)IsValid(250-331)IsValid(250-250)
src/node/interfaces.cpp (1)
src/interfaces/node.h (4)
MnEntry(64-462)MnEntry(68-68)MnList(95-95)Node(225-451)
src/instantsend/instantsend.h (2)
src/instantsend/instantsend.cpp (2)
CInstantSendManager(59-72)CInstantSendManager(74-74)src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/test/validation_chainstate_tests.cpp (3)
src/rpc/mining.cpp (2)
chainparams(134-134)chainparams(359-359)src/validation.cpp (6)
chainparams(567-578)chainparams(567-569)chainparams(581-591)chainparams(581-582)chainparams(594-604)chainparams(594-595)src/test/miner_tests.cpp (3)
chainparams(39-39)chainparams(40-40)chainparams(41-41)
src/rpc/governance.cpp (2)
src/core_write.cpp (2)
ValueFromAmount(36-47)ValueFromAmount(36-36)src/governance/classes.cpp (2)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)
src/test/block_reward_reallocation_tests.cpp (2)
src/node/interfaces.cpp (10)
Assert(193-193)Assert(194-194)Assert(219-219)Assert(360-360)Assert(383-383)Assert(505-505)Assert(714-717)Assert(926-926)m_node(1143-1147)m_node(1148-1152)src/validation.cpp (6)
GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)GetMasternodePayment(1562-1629)GetMasternodePayment(1562-1562)GetSuperblockSubsidyInner(1543-1547)GetSuperblockSubsidyInner(1543-1543)
src/interfaces/node.h (3)
src/univalue/include/univalue.h (1)
UniValue(19-23)src/netbase.h (1)
Proxy(65-96)src/node/interfaces.cpp (36)
mn_list(176-180)mn_list(176-176)only_valid(145-150)only_valid(145-145)hash(151-155)hash(151-151)hash(161-165)hash(161-161)hash(954-971)hash(954-954)hash(993-997)hash(993-993)hash(1019-1024)hash(1019-1019)service(156-160)service(156-156)pindex(166-174)pindex(166-166)context(181-184)context(181-181)context(207-210)context(207-207)context(243-249)context(348-351)context(348-348)context(363-369)context(370-373)context(370-370)context(386-392)context(393-399)context(400-406)context(407-410)context(407-407)context(798-805)MakeMNList(1245-1245)MakeMNList(1245-1245)
src/deploymentstatus.h (1)
src/test/versionbits_tests.cpp (18)
pindexPrev(44-44)pindexPrev(44-44)pindexPrev(45-45)pindexPrev(45-45)params(37-37)params(37-37)params(38-38)params(38-38)params(40-40)params(40-40)params(41-41)params(41-41)params(51-51)params(51-51)params(57-57)params(57-57)params(63-63)params(63-63)
src/llmq/signing_shares.h (1)
src/llmq/signing_shares.cpp (2)
CSigSharesManager(183-195)CSigSharesManager(197-197)
src/llmq/quorums.h (1)
src/llmq/quorums.cpp (6)
CQuorumManager(210-230)CQuorumManager(232-235)SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)VerifyRecoveredSig(1269-1283)VerifyRecoveredSig(1269-1271)
src/llmq/signing_shares.cpp (1)
src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
src/llmq/quorums.cpp (1)
src/llmq/utils.cpp (4)
EnsureQuorumConnections(849-909)EnsureQuorumConnections(849-853)GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/masternode/payments.cpp (2)
src/validation.cpp (2)
GetMasternodePayment(1562-1629)GetMasternodePayment(1562-1562)src/governance/classes.cpp (2)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)
src/evo/mnhftx.cpp (2)
src/evo/creditpool.h (1)
pindexPrev(81-108)src/txmempool.cpp (4)
ConnectManagers(440-447)ConnectManagers(440-440)DisconnectManagers(449-453)DisconnectManagers(449-449)
src/evo/deterministicmns.h (2)
src/masternode/payments.cpp (4)
nodiscard(33-82)nodiscard(89-108)nodiscard(110-140)nodiscard(142-181)src/evo/deterministicmns.cpp (14)
GetMNPayee(183-220)GetMNPayee(183-184)GetProjectedMNPayees(222-274)GetProjectedMNPayees(222-223)CDeterministicMNManager(641-647)CDeterministicMNManager(649-649)CheckProRegTx(1098-1231)CheckProRegTx(1098-1100)CheckProUpServTx(1233-1308)CheckProUpServTx(1233-1234)CheckProUpRegTx(1310-1380)CheckProUpRegTx(1310-1312)CheckProUpRevTx(1382-1412)CheckProUpRevTx(1382-1383)
src/governance/classes.cpp (1)
src/validation.cpp (2)
GetSuperblockSubsidyInner(1543-1547)GetSuperblockSubsidyInner(1543-1543)
src/rpc/evo.cpp (1)
src/evo/providertx.cpp (5)
GetMaxFromDeployment(20-21)GetMaxFromDeployment(28-30)GetMaxFromDeployment(31-33)GetMaxFromDeployment(34-36)GetMaxFromDeployment(37-39)
src/llmq/dkgsession.h (1)
src/validation.cpp (1)
ChainstateManager(6115-6125)
src/llmq/dkgsessionmgr.h (2)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/llmq/dkgsessionmgr.cpp (2)
CDKGSessionManager(32-62)CDKGSessionManager(64-64)
src/validation.h (3)
src/validation.cpp (27)
GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)GetSuperblockSubsidyInner(1543-1547)GetSuperblockSubsidyInner(1543-1543)GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)ChainstateManager(6115-6125)chainparams(567-578)chainparams(567-569)chainparams(581-591)chainparams(581-582)chainparams(594-604)chainparams(594-595)ProcessNewBlock(4435-4472)ProcessNewBlock(4435-4435)ProcessNewBlockHeaders(4314-4341)ProcessNewBlockHeaders(4314-4314)IsQuorumRotationEnabled(6017-6032)IsQuorumRotationEnabled(6017-6018)IsQuorumTypeEnabled(6034-6082)IsQuorumTypeEnabled(6034-6037)src/versionbits.h (1)
VersionBitsCache(80-103)src/deploymentstatus.h (6)
DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)DeploymentActiveAt(27-31)DeploymentActiveAt(33-37)DeploymentEnabled(40-44)DeploymentEnabled(46-50)
src/instantsend/signing.h (6)
src/instantsend/signing.cpp (2)
InstantSendSigner(31-45)InstantSendSigner(47-47)src/chainlock/chainlock.cpp (2)
CChainLocksHandler(46-57)CChainLocksHandler(59-63)src/llmq/signing.h (1)
CSigningManager(165-251)src/llmq/signing.cpp (2)
CSigningManager(335-341)CSigningManager(343-343)src/llmq/signing_shares.cpp (2)
CSigSharesManager(183-195)CSigSharesManager(197-197)src/llmq/quorums.cpp (2)
CQuorumManager(210-230)CQuorumManager(232-235)
src/rpc/blockchain.cpp (2)
src/deploymentstatus.h (4)
DeploymentEnabled(40-44)DeploymentEnabled(46-50)DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)src/validation.cpp (8)
GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)
src/llmq/dkgsessionmgr.cpp (2)
src/llmq/dkgsessionmgr.h (1)
CDKGSessionManager(46-126)src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/governance/governance.cpp (1)
src/node/interfaces.cpp (6)
LOCK(642-646)LOCK(652-659)LOCK(660-667)LOCK(929-938)LOCK(972-976)LOCK(1156-1160)
src/qt/clientmodel.cpp (2)
src/node/interfaces.cpp (13)
MakeMNList(1245-1245)MakeMNList(1245-1245)tip(197-206)tip(647-651)tip(668-676)LOCK(642-646)LOCK(652-659)LOCK(660-667)LOCK(929-938)LOCK(972-976)LOCK(1156-1160)pindex(166-174)pindex(166-166)src/qt/clientmodel.h (1)
cs_mnlist(122-122)
src/test/fuzz/utxo_snapshot.cpp (2)
src/test/util/mining.cpp (2)
CreateBlockChain(33-63)CreateBlockChain(33-33)src/node/interfaces.cpp (15)
Assert(193-193)Assert(194-194)Assert(219-219)Assert(360-360)Assert(383-383)Assert(505-505)Assert(714-717)Assert(926-926)chainman(677-679)chainman(1162-1164)chainman(1232-1235)block(841-844)block(841-841)block(845-848)block(845-845)
src/llmq/blockprocessor.cpp (3)
src/llmq/options.cpp (2)
GetEnabledQuorumParams(115-125)GetEnabledQuorumParams(115-116)src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)src/llmq/blockprocessor.h (1)
CQuorumBlockProcessor(41-106)
src/test/subsidy_tests.cpp (2)
src/node/interfaces.cpp (13)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)Assert(193-193)Assert(194-194)Assert(219-219)Assert(360-360)Assert(383-383)Assert(505-505)Assert(714-717)Assert(926-926)m_node(1143-1147)m_node(1148-1152)src/validation.cpp (2)
GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)
src/test/evo_deterministicmns_tests.cpp (1)
src/evo/deterministicmns.cpp (4)
CheckProRegTx(1098-1231)CheckProRegTx(1098-1100)CheckProUpRegTx(1310-1380)CheckProUpRegTx(1310-1312)
src/rpc/quorums.cpp (5)
src/llmq/options.cpp (2)
GetEnabledQuorumTypes(102-113)GetEnabledQuorumTypes(102-103)src/llmq/utils.cpp (2)
GetQuorumConnections(744-768)GetQuorumConnections(744-747)src/llmq/quorums.cpp (4)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)VerifyRecoveredSig(1269-1283)VerifyRecoveredSig(1269-1271)src/validation.cpp (1)
GetTransaction(142-142)src/node/transaction.cpp (2)
GetTransaction(120-151)GetTransaction(120-120)
src/masternode/active/context.cpp (1)
src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/rpc/masternode.cpp (2)
src/node/interfaces.cpp (5)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)pindex(166-174)pindex(166-166)src/validation.cpp (8)
GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)
src/evo/creditpool.h (1)
src/evo/creditpool.cpp (13)
CCreditPoolDiff(248-259)CCreditPoolManager(240-244)CCreditPoolManager(246-246)GetCreditPool(223-238)GetCreditPool(223-223)GetFromCache(118-138)GetFromCache(118-118)AddToCache(140-149)AddToCache(140-140)ConstructCreditPool(151-221)ConstructCreditPool(151-151)GetCreditPoolDiffForBlock(324-349)GetCreditPoolDiffForBlock(324-327)
src/llmq/utils.cpp (1)
src/evo/cbtx.cpp (2)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)
src/llmq/dkgsessionhandler.cpp (1)
src/llmq/utils.cpp (4)
EnsureQuorumConnections(849-909)EnsureQuorumConnections(849-853)AddQuorumProbeConnections(911-955)AddQuorumProbeConnections(911-915)
src/chainlock/chainlock.cpp (2)
src/node/interfaces.cpp (9)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)LOCK(642-646)LOCK(652-659)LOCK(660-667)LOCK(929-938)LOCK(972-976)LOCK(1156-1160)src/llmq/quorums.cpp (2)
VerifyRecoveredSig(1269-1283)VerifyRecoveredSig(1269-1271)
src/llmq/blockprocessor.h (2)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/llmq/blockprocessor.cpp (11)
CQuorumBlockProcessor(48-71)CQuorumBlockProcessor(73-76)GetCommitmentsFromBlock(434-477)GetCommitmentsFromBlock(434-437)EXCLUSIVE_LOCKS_REQUIRED(265-277)ProcessCommitment(279-393)ProcessCommitment(279-280)GetNumCommitmentsRequired(479-500)GetNumCommitmentsRequired(479-479)GetQuorumBlockHash(503-516)GetQuorumBlockHash(503-503)
src/evo/cbtx.cpp (2)
src/evo/creditpool.h (1)
pindexPrev(81-108)src/validation.cpp (6)
pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)
src/qt/clientmodel.h (3)
src/qt/clientmodel.cpp (4)
setMasternodeList(102-112)setMasternodeList(102-102)getMasternodeList(114-118)getMasternodeList(114-114)src/node/interfaces.cpp (3)
tip(197-206)tip(647-651)tip(668-676)src/interfaces/node.h (1)
MnList(95-95)
src/qt/governancelist.cpp (2)
src/wallet/interfaces.cpp (4)
script(188-195)script(188-188)script(204-208)script(204-204)src/coinjoin/util.cpp (2)
GetScriptForDestination(48-51)GetScriptForDestination(48-48)
src/evo/providertx.cpp (1)
src/evo/providertx.h (2)
nodiscard(36-48)nodiscard(287-298)
src/validation.cpp (2)
src/chainparams.cpp (2)
Params(1356-1359)Params(1356-1356)src/deploymentstatus.h (4)
DeploymentActiveAt(27-31)DeploymentActiveAt(33-37)DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)
src/evo/mnhftx.h (3)
src/evo/mnhftx.cpp (4)
CMNHFManager(47-53)CMNHFManager(55-59)ConnectManagers(374-379)ConnectManagers(374-374)src/llmq/blockprocessor.h (1)
llmq(36-107)src/llmq/quorums.cpp (2)
CQuorumManager(210-230)CQuorumManager(232-235)
src/node/miner.cpp (6)
src/evo/creditpool.h (1)
pindexPrev(81-108)src/evo/cbtx.cpp (2)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)src/deploymentstatus.h (2)
DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)src/validation.cpp (10)
params(2203-2203)params(2203-2203)params(2204-2204)params(2204-2204)params(2206-2206)params(2206-2206)params(2207-2207)params(2207-2207)GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)src/llmq/options.cpp (2)
GetEnabledQuorumParams(115-125)GetEnabledQuorumParams(115-116)src/evo/creditpool.cpp (3)
creditPoolDiff(332-332)GetCreditPoolDiffForBlock(324-349)GetCreditPoolDiffForBlock(324-327)
src/evo/creditpool.cpp (1)
src/evo/creditpool.h (5)
cache_mutex(115-147)currentLimit(44-44)latelyUnlocked(45-45)pindexPrev(81-108)platformReward(79-79)
src/rpc/mining.cpp (4)
src/validation.cpp (2)
TestBlockValidity(4487-4540)TestBlockValidity(4487-4495)src/node/miner.h (2)
node(40-77)BlockAssembler(147-225)src/node/miner.cpp (2)
BlockAssembler(72-88)BlockAssembler(107-108)src/deploymentstatus.h (2)
DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)
src/evo/specialtxman.cpp (4)
src/validation.cpp (8)
pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)src/evo/cbtx.cpp (6)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)CheckCbTx(23-46)CheckCbTx(23-23)CalcCbTxMerkleRootQuorums(122-213)CalcCbTxMerkleRootQuorums(122-124)src/evo/deterministicmns.cpp (8)
CheckProRegTx(1098-1231)CheckProRegTx(1098-1100)CheckProUpServTx(1233-1308)CheckProUpServTx(1233-1234)CheckProUpRegTx(1310-1380)CheckProUpRegTx(1310-1312)CheckProUpRevTx(1382-1412)CheckProUpRevTx(1382-1383)src/evo/creditpool.cpp (3)
creditPoolDiff(332-332)GetCreditPoolDiffForBlock(324-349)GetCreditPoolDiffForBlock(324-327)
src/llmq/commitment.h (2)
src/llmq/utils.h (1)
utils(35-95)src/llmq/commitment.cpp (2)
Verify(99-188)Verify(99-101)
src/llmq/dkgsession.cpp (1)
src/llmq/utils.cpp (4)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)GetQuorumRelayMembers(770-825)GetQuorumRelayMembers(770-773)
src/evo/deterministicmns.cpp (2)
src/node/interfaces.cpp (5)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)pindex(166-174)pindex(166-166)src/evo/deterministicmns.h (2)
ForEachMNShared(308-560)ForEachMN(292-299)
src/qt/masternodelist.cpp (1)
src/node/interfaces.cpp (2)
pindex(166-174)pindex(166-166)
src/llmq/utils.h (3)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/instantsend/signing.h (2)
bool(33-114)Consensus(16-18)src/llmq/utils.cpp (12)
DeterministicOutboundConnection(722-742)DeterministicOutboundConnection(722-722)GetQuorumConnections(744-768)GetQuorumConnections(744-747)GetQuorumRelayMembers(770-825)GetQuorumRelayMembers(770-773)CalcDeterministicWatchConnections(827-847)CalcDeterministicWatchConnections(827-829)EnsureQuorumConnections(849-909)EnsureQuorumConnections(849-853)AddQuorumProbeConnections(911-955)AddQuorumProbeConnections(911-915)
src/test/util/setup_common.cpp (2)
src/chainparams.cpp (2)
Params(1356-1359)Params(1356-1356)src/evo/cbtx.cpp (2)
CalcCbTxMerkleRootQuorums(122-213)CalcCbTxMerkleRootQuorums(122-124)
🪛 GitHub Actions: Clang Diff Format Check
src/governance/governance.h
[error] 1-1: Clang-format-diff detected formatting differences in this file. Apply the formatting changes reported by clang-format.
src/evo/deterministicmns.cpp
[error] 1-1: Clang-format-diff detected formatting differences in this file. Run the formatter to fix spacing in templates and formatting.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: linux64_multiprocess-test / Test source
- GitHub Check: linux64_tsan-test / Test source
| CQuorumBlockProcessor& quorumBlockProcessor; | ||
| CQuorumSnapshotManager& m_qsnapman; | ||
| const CActiveMasternodeManager* const m_mn_activeman; | ||
| const ChainstateManager& m_chainman; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the ChainstateManager forward declaration
ChainstateManager is introduced here but the header doesn’t declare or include it. Any TU that sees this header before <validation.h> will fail to compile. Please add a forward declaration alongside the other class forwards (or include the defining header).
class CDeterministicMNManager;
class CDBWrapper;
class CEvoDB;
class CMasternodeSync;
class CNode;
class CSporkManager;
+class ChainstateManager;Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/llmq/quorums.h around line 244, the header uses "ChainstateManager" but
lacks a forward declaration or include; add a forward declaration "class
ChainstateManager;" alongside the other forward declarations near the top of the
file (or include the header that defines ChainstateManager) so translation units
that include quorums.h before validation.h compile successfully; ensure the
forward declaration is in the correct namespace/scope to match the type usage.
|
pls see 55cc73e |
|
|
||
| /** Determine if a deployment is active for the next block */ | ||
| inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep) | ||
| inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versionbitscache is not used by DepdloymentActiveAfter for burried forks - hm; strange that bitcoin did it like that.
it complicates code so much
|
This pull request has conflicts, please rebase. |
1 similar comment
|
This pull request has conflicts, please rebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (7)
src/llmq/ehf_signals.cpp (2)
58-59: Incomplete refactoring: use m_chainman instead of Params().These lines still use
Params()directly, inconsistent with the rest of this PR which systematically replaces allParams()-based consensus lookups withm_chainman-based access (see lines 41, 46).Apply this diff to complete the refactoring:
- const Consensus::LLMQType& llmqType = Params().GetConsensus().llmqTypeMnhf; - const auto& llmq_params_opt = Params().GetLLMQ(llmqType); + const Consensus::LLMQType& llmqType = m_chainman.GetConsensus().llmqTypeMnhf; + const auto& llmq_params_opt = m_chainman.GetParams().GetLLMQ(llmqType);
99-99: Incomplete refactoring: use m_chainman instead of Params().This line still uses
Params().GetConsensus()directly, inconsistent with line 41 which usesm_chainman.GetConsensus()for the same access pattern.Apply this diff to complete the refactoring:
- for (const auto& deployment : Params().GetConsensus().vDeployments) { + for (const auto& deployment : m_chainman.GetConsensus().vDeployments) {src/instantsend/instantsend.h (1)
24-100: Missing forward declaration forChainstateManager.
ChainstateManageris now used in the member and constructor signature, but the header neither includes the definition nor forward declares the type. This breaks compilation. Please add the forward declaration alongside the other class forwards (and you can drop the unusedCChainStateforward if desired).class CBlockIndex; -class CChainState; +class ChainstateManager; class CDataStream;src/llmq/dkgsession.h (1)
23-340: Forward declareChainstateManagerin this header.Similar to the InstantSend header,
CDKGSessionnow stores aChainstateManagerreference but the header lacks a forward declaration/include, leading to a compile failure. Please add the forward declaration near the other class forwards.class CActiveMasternodeManager; class CInv; class CConnman; class CDeterministicMN; class CMasternodeMetaMan; +class ChainstateManager; class CSporkManager; class PeerManager;src/evo/deterministicmns.h (1)
292-309: Missing<functional>include prevents build
CDeterministicMNList::ForEachMN(and friends) now take/returnstd::function, but this header still doesn’t include<functional>. Translation units such assrc/evo/deterministicmns.cppinclude this header first, so the new declaration fails to compile. Please add the missing standard header here.#include <immer/map.hpp> #include <atomic> +#include <functional> #include <limits> #include <numeric> #include <unordered_map>src/llmq/blockprocessor.cpp (1)
106-132: Guard against null ActiveTip in message path.
m_chainman.ActiveTip()->GetAncestor(...)can dereference a nullActiveTip()during early startup/sync. Consider guardingActiveTip()or short‑circuiting when it’s null to avoid a rare crash window.src/llmq/utils.cpp (1)
210-214: Guard nullpprevbefore asking ChainstateManager.Line [211]:
chainman.IsQuorumTypeEnabled(...)now requires agsl::not_null, so whenpQuorumBaseBlockIndex->pprevisnullptr(e.g. on a fresh node before the first quorum-height block arrives) we hit a fail-fast and abort instead of returning an empty member list as before. Please add an early return for the nullptr case to preserve the previous behaviour.+ if (pQuorumBaseBlockIndex->pprev == nullptr) { + return {}; + } if (!chainman.IsQuorumTypeEnabled(llmqType, pQuorumBaseBlockIndex->pprev)) { return {}; }
♻️ Duplicate comments (2)
src/llmq/quorums.h (1)
244-244: Add ChainstateManager forward declaration.Line 244 uses
const ChainstateManager& m_chainman;but the header lacks a forward declaration forChainstateManager. Any translation unit that includes this header before<validation.h>will fail to compile.Add the forward declaration near the other class forward declarations:
class CDeterministicMNManager; class CDBWrapper; class CEvoDB; +class ChainstateManager; class CMasternodeSync; class CNode; class CSporkManager;src/node/miner.cpp (1)
124-180: Avoid TOCTOU on best ChainLock snapshot (use cached value).You cache
best_clsigbut later readclhandler.GetBestChainLock()again when settingbestCLSignature(Line 176). This can race and mix height diff from one snapshot with signature from another.Apply:
- bestCLSignature = clhandler.GetBestChainLock().getSig(); + bestCLSignature = best_clsig.getSig();If this is already addressed in a follow‑up, feel free to ignore here.
🧹 Nitpick comments (4)
src/llmq/blockprocessor.cpp (1)
434-477: Prefer chainman.GetConsensus() for consistency.
GetCommitmentsFromBlockreceiveschainmanbut still usesParams().GetConsensus(). No behavior change, but switching tochainman.GetConsensus()keeps the deglobalization consistent.- const auto& consensus = Params().GetConsensus(); + const auto& consensus = chainman.GetConsensus();src/interfaces/node.h (1)
63-86: MN interfaces shape looks good; two nits for resilience and ergonomics
- Deleted default ctors + empty “marker” ctors on pure-virtual MnEntry/MnList force derived types to carry DMN args. Consider making base ctors
protectedand defaulted to avoid constraining implementors/mocks unnecessarily.- Returning scalars by
const&(e.g.,getLastPaidHeight(),getPoSePenalty(),getRegisteredHeight(),getOperatorReward()) risks dangling refs if implementations wrap ephemeral objects. Returning by value for PODs avoids lifetime coupling with negligible cost.If this mirrors existing downstream usage, treat as optional; otherwise consider a follow-up to relax constructors and return PODs by value.
Also applies to: 90-116
src/validation.cpp (2)
6034-6083: Nit: prefer ChainstateManager::GetParams() over direct m_chainparams accessIn
IsQuorumTypeEnabled(), usage mixesGetConsensus()with directm_chainparamsaccess. For consistency with the rest of this PR’s deglobalization, consider usingGetParams()in place ofm_chainparamswhen reading network ID and consensus fields. Functional behavior unchanged.
1555-1560: Use chainman.GetParams() in GetBlockSubsidy genesis path (deglobalization consistency)
GetBlockSubsidynow takesChainstateManager, but the genesis-branch still pullsParams()globally. Preferchainman.GetParams()to fully remove reliance on globals. ChainstateManager::GetParams() is available and returns const CChainParams&.Apply:
CAmount GetBlockSubsidy(const CBlockIndex* const pindex, const ChainstateManager& chainman) { - if (pindex->pprev == nullptr) return Params().GenesisBlock().vtx[0]->GetValueOut(); + if (pindex->pprev == nullptr) { + return chainman.GetParams().GenesisBlock().vtx[0]->GetValueOut(); + } const bool isV20Active{DeploymentActiveAt(*pindex, chainman, Consensus::DEPLOYMENT_V20)}; return GetBlockSubsidyInner(pindex->pprev->nBits, pindex->pprev->nHeight, chainman, isV20Active); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (65)
src/chainlock/chainlock.cpp(5 hunks)src/chainlock/chainlock.h(3 hunks)src/chainlock/signing.h(1 hunks)src/deploymentstatus.cpp(0 hunks)src/deploymentstatus.h(1 hunks)src/evo/cbtx.cpp(9 hunks)src/evo/cbtx.h(2 hunks)src/evo/deterministicmns.cpp(21 hunks)src/evo/deterministicmns.h(7 hunks)src/evo/mnhftx.cpp(8 hunks)src/evo/mnhftx.h(3 hunks)src/evo/smldiff.cpp(6 hunks)src/evo/smldiff.h(1 hunks)src/evo/specialtxman.cpp(18 hunks)src/governance/signing.cpp(2 hunks)src/instantsend/instantsend.cpp(7 hunks)src/instantsend/instantsend.h(2 hunks)src/instantsend/signing.cpp(3 hunks)src/instantsend/signing.h(2 hunks)src/interfaces/node.h(3 hunks)src/llmq/blockprocessor.cpp(19 hunks)src/llmq/blockprocessor.h(4 hunks)src/llmq/commitment.cpp(6 hunks)src/llmq/commitment.h(1 hunks)src/llmq/context.cpp(1 hunks)src/llmq/debug.cpp(1 hunks)src/llmq/dkgsession.cpp(8 hunks)src/llmq/dkgsession.h(2 hunks)src/llmq/dkgsessionhandler.cpp(5 hunks)src/llmq/dkgsessionhandler.h(3 hunks)src/llmq/dkgsessionmgr.cpp(6 hunks)src/llmq/dkgsessionmgr.h(3 hunks)src/llmq/ehf_signals.cpp(2 hunks)src/llmq/options.cpp(2 hunks)src/llmq/options.h(2 hunks)src/llmq/quorums.cpp(10 hunks)src/llmq/quorums.h(3 hunks)src/llmq/signing_shares.cpp(2 hunks)src/llmq/signing_shares.h(2 hunks)src/llmq/utils.cpp(26 hunks)src/llmq/utils.h(2 hunks)src/masternode/active/context.cpp(1 hunks)src/masternode/payments.cpp(5 hunks)src/node/chainstate.cpp(4 hunks)src/node/interfaces.cpp(3 hunks)src/node/miner.cpp(8 hunks)src/qt/clientmodel.cpp(3 hunks)src/qt/clientmodel.h(2 hunks)src/qt/governancelist.cpp(3 hunks)src/qt/masternodelist.cpp(10 hunks)src/qt/masternodelist.h(2 hunks)src/qt/rpcconsole.cpp(3 hunks)src/rpc/blockchain.cpp(5 hunks)src/rpc/masternode.cpp(10 hunks)src/rpc/mining.cpp(10 hunks)src/rpc/quorums.cpp(13 hunks)src/rpc/rawtransaction.cpp(2 hunks)src/test/dynamic_activation_thresholds_tests.cpp(5 hunks)src/test/evo_deterministicmns_tests.cpp(22 hunks)src/test/evo_utils_tests.cpp(1 hunks)src/test/util/setup_common.cpp(5 hunks)src/test/versionbits_tests.cpp(10 hunks)src/validation.cpp(32 hunks)src/validation.h(11 hunks)test/lint/lint-circular-dependencies.py(1 hunks)
💤 Files with no reviewable changes (1)
- src/deploymentstatus.cpp
🚧 Files skipped from review as they are similar to previous changes (14)
- src/test/versionbits_tests.cpp
- src/llmq/signing_shares.h
- src/llmq/dkgsessionmgr.h
- src/instantsend/signing.cpp
- src/evo/smldiff.cpp
- src/instantsend/signing.h
- test/lint/lint-circular-dependencies.py
- src/evo/cbtx.h
- src/rpc/rawtransaction.cpp
- src/node/chainstate.cpp
- src/llmq/commitment.h
- src/qt/masternodelist.h
- src/test/evo_deterministicmns_tests.cpp
- src/evo/smldiff.h
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/llmq/dkgsession.hsrc/chainlock/signing.hsrc/test/dynamic_activation_thresholds_tests.cppsrc/evo/mnhftx.hsrc/test/evo_utils_tests.cppsrc/qt/clientmodel.hsrc/llmq/quorums.cppsrc/llmq/dkgsessionhandler.cppsrc/llmq/dkgsessionhandler.hsrc/llmq/options.hsrc/qt/governancelist.cppsrc/instantsend/instantsend.cppsrc/chainlock/chainlock.hsrc/llmq/commitment.cppsrc/llmq/signing_shares.cppsrc/qt/clientmodel.cppsrc/llmq/blockprocessor.hsrc/llmq/quorums.hsrc/deploymentstatus.hsrc/rpc/masternode.cppsrc/masternode/active/context.cppsrc/masternode/payments.cppsrc/llmq/dkgsession.cppsrc/evo/mnhftx.cppsrc/governance/signing.cppsrc/node/interfaces.cppsrc/rpc/mining.cppsrc/chainlock/chainlock.cppsrc/evo/deterministicmns.hsrc/test/util/setup_common.cppsrc/evo/cbtx.cppsrc/llmq/context.cppsrc/interfaces/node.hsrc/llmq/dkgsessionmgr.cppsrc/validation.cppsrc/rpc/quorums.cppsrc/instantsend/instantsend.hsrc/llmq/utils.hsrc/llmq/options.cppsrc/evo/specialtxman.cppsrc/node/miner.cppsrc/evo/deterministicmns.cppsrc/llmq/debug.cppsrc/qt/masternodelist.cppsrc/rpc/blockchain.cppsrc/llmq/blockprocessor.cppsrc/llmq/utils.cppsrc/qt/rpcconsole.cppsrc/validation.hsrc/llmq/ehf_signals.cpp
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests for C++ code should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests
Files:
src/test/dynamic_activation_thresholds_tests.cppsrc/test/evo_utils_tests.cppsrc/test/util/setup_common.cpp
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Masternode lists must use immutable data structures (Immer library) for thread safety
Files:
src/evo/mnhftx.hsrc/masternode/active/context.cppsrc/masternode/payments.cppsrc/evo/mnhftx.cppsrc/evo/deterministicmns.hsrc/evo/cbtx.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
🧠 Learnings (25)
📓 Common learnings
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
📚 Learning: 2024-12-29T17:43:41.755Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6504
File: src/llmq/quorums.cpp:224-224
Timestamp: 2024-12-29T17:43:41.755Z
Learning: The `CQuorumManager` is fully initialized by `LLMQContext`, addressing any concerns about the manager’s initialization sequence.
Applied to files:
src/llmq/dkgsession.hsrc/evo/mnhftx.hsrc/llmq/quorums.cppsrc/llmq/quorums.hsrc/llmq/context.cppsrc/instantsend/instantsend.hsrc/llmq/utils.cpp
📚 Learning: 2025-10-02T18:29:54.756Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6840
File: src/net_processing.cpp:2882-2886
Timestamp: 2025-10-02T18:29:54.756Z
Learning: Across net_processing.cpp, once LLMQContext (m_llmq_ctx) is asserted non-null, its subcomponents (e.g., isman, qdkgsman, quorum_block_processor) are treated as initialized and used without extra null checks.
Applied to files:
src/llmq/dkgsession.hsrc/evo/mnhftx.hsrc/llmq/quorums.cppsrc/llmq/dkgsessionhandler.cppsrc/llmq/dkgsessionhandler.hsrc/llmq/options.hsrc/llmq/commitment.cppsrc/llmq/blockprocessor.hsrc/llmq/quorums.hsrc/masternode/active/context.cppsrc/llmq/dkgsession.cppsrc/evo/mnhftx.cppsrc/evo/cbtx.cppsrc/llmq/context.cppsrc/rpc/quorums.cppsrc/llmq/utils.hsrc/llmq/options.cppsrc/evo/specialtxman.cppsrc/node/miner.cppsrc/llmq/blockprocessor.cppsrc/llmq/utils.cpp
📚 Learning: 2025-07-29T14:32:48.369Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
Applied to files:
src/chainlock/signing.hsrc/instantsend/instantsend.cppsrc/llmq/commitment.cppsrc/llmq/quorums.hsrc/chainlock/chainlock.cppsrc/node/miner.cppsrc/llmq/utils.cppsrc/qt/rpcconsole.cpp
📚 Learning: 2025-01-02T21:50:00.967Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6504
File: src/llmq/context.cpp:42-43
Timestamp: 2025-01-02T21:50:00.967Z
Learning: LLMQContext manages concurrency for the `CInstantSendManager`. Previously, this was handled globally; now it's handled as a class member in `LLMQContext`, but the concurrency control remains consistent.
Applied to files:
src/evo/mnhftx.hsrc/instantsend/instantsend.cppsrc/llmq/context.cppsrc/instantsend/instantsend.h
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Applied to files:
src/test/evo_utils_tests.cppsrc/rpc/masternode.cppsrc/test/util/setup_common.cppsrc/qt/masternodelist.cppsrc/llmq/utils.cppsrc/qt/rpcconsole.cpp
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/test/evo_utils_tests.cppsrc/rpc/masternode.cppsrc/test/util/setup_common.cppsrc/qt/masternodelist.cpp
📚 Learning: 2025-08-19T15:08:00.835Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/commitment.cpp:54-60
Timestamp: 2025-08-19T15:08:00.835Z
Learning: In Dash Core, llmq_params.size == 1 is used only for regtest environments, not on public networks, which significantly reduces the risk profile of code paths specific to single-member quorums.
Applied to files:
src/test/evo_utils_tests.cppsrc/llmq/quorums.cppsrc/llmq/options.hsrc/llmq/quorums.hsrc/rpc/quorums.cppsrc/llmq/options.cppsrc/node/miner.cppsrc/llmq/blockprocessor.cppsrc/llmq/utils.cpp
📚 Learning: 2025-07-20T18:42:49.794Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.794Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety
Applied to files:
src/qt/clientmodel.hsrc/qt/governancelist.cppsrc/qt/clientmodel.cppsrc/rpc/masternode.cppsrc/llmq/dkgsession.cppsrc/node/interfaces.cppsrc/evo/deterministicmns.hsrc/interfaces/node.hsrc/llmq/utils.hsrc/evo/deterministicmns.cppsrc/qt/masternodelist.cppsrc/qt/rpcconsole.cpp
📚 Learning: 2025-07-15T14:53:04.819Z
Learnt from: knst
Repo: dashpay/dash PR: 6691
File: src/test/llmq_params_tests.cpp:148-151
Timestamp: 2025-07-15T14:53:04.819Z
Learning: In the Dash Core LLMQ implementation, signingActiveQuorumCount is never 0 in the actual parameters defined in params.h, making division by zero scenarios unrealistic in the max_cycles() function.
Applied to files:
src/llmq/quorums.cppsrc/llmq/dkgsessionhandler.cppsrc/instantsend/instantsend.cppsrc/llmq/commitment.cppsrc/llmq/signing_shares.cppsrc/llmq/quorums.hsrc/llmq/dkgsession.cppsrc/evo/cbtx.cppsrc/llmq/dkgsessionmgr.cppsrc/validation.cppsrc/rpc/quorums.cppsrc/llmq/options.cppsrc/node/miner.cppsrc/llmq/blockprocessor.cppsrc/llmq/utils.cppsrc/llmq/ehf_signals.cpp
📚 Learning: 2025-08-19T14:57:31.801Z
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Applied to files:
src/llmq/blockprocessor.hsrc/evo/mnhftx.cppsrc/rpc/mining.cppsrc/node/miner.cppsrc/llmq/blockprocessor.cppsrc/qt/rpcconsole.cpp
📚 Learning: 2025-06-06T11:53:09.094Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6665
File: src/evo/providertx.h:82-82
Timestamp: 2025-06-06T11:53:09.094Z
Learning: In ProTx serialization code (SERIALIZE_METHODS), version checks should use hardcoded maximum flags (/*is_basic_scheme_active=*/true, /*is_extended_addr=*/true) rather than deployment-based flags. This is because serialization code should be able to deserialize any structurally valid ProTx up to the maximum version the code knows how to handle, regardless of current consensus validity. Validation code, not serialization code, is responsible for checking whether a ProTx version is consensus-valid based on deployment status.
Applied to files:
src/deploymentstatus.hsrc/evo/mnhftx.cppsrc/rpc/mining.cppsrc/evo/cbtx.cppsrc/validation.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-10-03T11:20:37.475Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6838
File: src/active/context.cpp:29-33
Timestamp: 2025-10-03T11:20:37.475Z
Learning: In Dash codebase, NodeContext (src/node/context.h) serves only as a container with trivial c/d-tors; member lifetime is explicitly managed via reset() calls in the shutdown sequence (src/init.cpp), not by declaration order. For example, active_ctx.reset() is called before DashChainstateSetupClose handles llmq_ctx teardown, ensuring proper destruction order regardless of declaration order in the struct.
Applied to files:
src/node/interfaces.cppsrc/llmq/context.cpp
📚 Learning: 2025-01-07T18:50:44.838Z
Learnt from: knst
Repo: dashpay/dash PR: 6511
File: src/evo/deterministicmns.cpp:1369-1373
Timestamp: 2025-01-07T18:50:44.838Z
Learning: The functions `MigrateDBIfNeeded` and `MigrateDBIfNeeded2` in `src/evo/deterministicmns.cpp` are temporary and will be removed in a future version. Refactoring suggestions for these functions should be avoided.
Applied to files:
src/evo/deterministicmns.hsrc/evo/deterministicmns.cpp
📚 Learning: 2025-07-09T15:02:26.899Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6729
File: src/evo/deterministicmns.cpp:1313-1316
Timestamp: 2025-07-09T15:02:26.899Z
Learning: In Dash's masternode transaction validation, `IsVersionChangeValid()` is only called by transaction types that update existing masternode entries (like `ProUpServTx`, `ProUpRegTx`, `ProUpRevTx`), not by `ProRegTx` which creates new entries. This means validation logic in `IsVersionChangeValid()` only applies to the subset of transaction types that actually call it, not all masternode transaction types.
Applied to files:
src/evo/deterministicmns.hsrc/evo/cbtx.cppsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-10-28T18:36:40.263Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6923
File: src/test/util/setup_common.cpp:235-251
Timestamp: 2025-10-28T18:36:40.263Z
Learning: In `src/test/util/setup_common.cpp`, the `CEvoDB` instance in `BasicTestingSetup` is constructed with `.memory = true` flag (memory-only mode), so it does not create file handles on disk. This makes the destructor teardown order safe even if `fs::remove_all(m_path_root)` is called before `m_node.evodb.reset()`.
Applied to files:
src/test/util/setup_common.cpp
📚 Learning: 2025-07-20T18:42:49.794Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.794Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h
Applied to files:
src/interfaces/node.hsrc/evo/specialtxman.cppsrc/evo/deterministicmns.cpp
📚 Learning: 2025-02-06T14:34:30.466Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Applied to files:
src/node/miner.cpp
📚 Learning: 2025-08-01T07:46:37.840Z
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Applied to files:
src/node/miner.cpp
📚 Learning: 2025-07-23T09:28:32.783Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:15-250
Timestamp: 2025-07-23T09:28:32.783Z
Learning: In refactoring PRs like #6761, kwvg prefers to defer code formatting fixes to separate follow-up PRs when formatting is not the primary objective, to maintain focus on the structural changes and avoid scope creep.
Applied to files:
src/node/miner.cpp
📚 Learning: 2025-10-05T20:38:28.457Z
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Applied to files:
src/node/miner.cpp
📚 Learning: 2025-08-08T04:30:37.971Z
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:0-0
Timestamp: 2025-08-08T04:30:37.971Z
Learning: In the Dash codebase, direct RPC calling has been removed in recent commits, making suggestions about RPC command validation and error handling for direct RPC calls obsolete. The ProposalWizard and related components no longer use direct RPC calling patterns.
Applied to files:
src/node/miner.cpp
📚 Learning: 2025-07-29T14:33:01.040Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/wallet/wallet.cpp:0-0
Timestamp: 2025-07-29T14:33:01.040Z
Learning: In refactoring PRs like #6761, kwvg acknowledges code safety improvements (like null pointer checks and unused parameter warnings) but prefers to defer them to follow-up PRs to maintain focus on the primary refactoring objectives, avoiding scope creep.
Applied to files:
src/node/miner.cppsrc/qt/rpcconsole.cpp
📚 Learning: 2025-02-14T15:19:17.218Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6529
File: src/wallet/rpcwallet.cpp:3002-3003
Timestamp: 2025-02-14T15:19:17.218Z
Learning: The `GetWallet()` function calls in `src/wallet/rpcwallet.cpp` are properly validated with null checks that throw appropriate RPC errors, making additional validation unnecessary.
Applied to files:
src/qt/rpcconsole.cpp
📚 Learning: 2025-07-17T15:48:29.418Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6752
File: src/wallet/load.cpp:164-164
Timestamp: 2025-07-17T15:48:29.418Z
Learning: In Dash Core, kwvg prefers using assert() statements to document expected behavior in code paths, especially when the called function also has internal asserts. This is used as a defensive programming pattern rather than requiring conditional error handling.
Applied to files:
src/qt/rpcconsole.cpp
🧬 Code graph analysis (46)
src/llmq/dkgsession.h (1)
src/validation.cpp (1)
ChainstateManager(6115-6125)
src/evo/mnhftx.h (2)
src/evo/mnhftx.cpp (4)
CMNHFManager(47-53)CMNHFManager(55-59)ConnectManagers(374-379)ConnectManagers(374-374)src/llmq/quorums.cpp (2)
CQuorumManager(210-230)CQuorumManager(232-235)
src/test/evo_utils_tests.cpp (2)
src/interfaces/node.h (2)
node(47-49)node(449-449)src/node/interfaces.cpp (3)
tip(197-206)tip(647-651)tip(668-676)
src/qt/clientmodel.h (2)
src/qt/clientmodel.cpp (4)
setMasternodeList(102-112)setMasternodeList(102-102)getMasternodeList(114-118)getMasternodeList(114-114)src/node/interfaces.cpp (3)
tip(197-206)tip(647-651)tip(668-676)
src/llmq/quorums.cpp (1)
src/llmq/utils.cpp (4)
EnsureQuorumConnections(849-909)EnsureQuorumConnections(849-853)GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/llmq/dkgsessionhandler.cpp (1)
src/llmq/utils.cpp (4)
EnsureQuorumConnections(849-909)EnsureQuorumConnections(849-853)AddQuorumProbeConnections(911-955)AddQuorumProbeConnections(911-915)
src/llmq/dkgsessionhandler.h (3)
src/llmq/dkgsessionhandler.cpp (2)
CDKGSessionHandler(27-56)CDKGSessionHandler(58-58)src/llmq/dkgsessionmgr.cpp (2)
CDKGSessionManager(32-62)CDKGSessionManager(64-64)src/llmq/dkgsessionmgr.h (1)
CDKGSessionManager(46-126)
src/llmq/options.h (3)
src/validation.cpp (7)
ChainstateManager(6115-6125)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)src/validation.h (2)
Consensus(63-65)std(508-601)src/llmq/options.cpp (4)
GetEnabledQuorumTypes(102-113)GetEnabledQuorumTypes(102-103)GetEnabledQuorumParams(115-125)GetEnabledQuorumParams(115-116)
src/qt/governancelist.cpp (2)
src/node/interfaces.cpp (2)
mn_list(176-180)mn_list(176-176)src/wallet/interfaces.cpp (4)
script(188-195)script(188-188)script(204-208)script(204-204)
src/instantsend/instantsend.cpp (4)
src/node/interfaces.cpp (7)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)id(612-618)id(612-612)pindex(166-174)pindex(166-166)src/rpc/quorums.cpp (2)
WITH_LOCK(138-138)WITH_LOCK(996-996)src/net_processing.cpp (7)
WITH_LOCK(331-334)WITH_LOCK(3166-3166)WITH_LOCK(3188-3188)id(679-679)id(683-683)pindex(607-607)pindex(849-849)src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
src/chainlock/chainlock.h (1)
src/chainlock/chainlock.cpp (2)
CChainLocksHandler(46-57)CChainLocksHandler(59-63)
src/llmq/commitment.cpp (1)
src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/llmq/signing_shares.cpp (1)
src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
src/qt/clientmodel.cpp (1)
src/node/interfaces.cpp (11)
MakeMNList(1245-1245)MakeMNList(1245-1245)tip(197-206)tip(647-651)tip(668-676)LOCK(642-646)LOCK(652-659)LOCK(660-667)LOCK(929-938)LOCK(972-976)LOCK(1156-1160)
src/llmq/blockprocessor.h (2)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/llmq/blockprocessor.cpp (10)
CQuorumBlockProcessor(48-71)CQuorumBlockProcessor(73-76)GetCommitmentsFromBlock(434-477)GetCommitmentsFromBlock(434-437)ProcessCommitment(279-393)ProcessCommitment(279-280)GetNumCommitmentsRequired(479-500)GetNumCommitmentsRequired(479-479)GetQuorumBlockHash(503-516)GetQuorumBlockHash(503-503)
src/llmq/quorums.h (2)
src/llmq/quorums.cpp (6)
CQuorumManager(210-230)CQuorumManager(232-235)SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)VerifyRecoveredSig(1269-1283)VerifyRecoveredSig(1269-1271)src/llmq/params.h (1)
LLMQType(14-125)
src/deploymentstatus.h (1)
src/test/versionbits_tests.cpp (18)
pindexPrev(44-44)pindexPrev(44-44)pindexPrev(45-45)pindexPrev(45-45)params(37-37)params(37-37)params(38-38)params(38-38)params(40-40)params(40-40)params(41-41)params(41-41)params(51-51)params(51-51)params(57-57)params(57-57)params(63-63)params(63-63)
src/rpc/masternode.cpp (2)
src/node/interfaces.cpp (5)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)pindex(166-174)pindex(166-166)src/validation.cpp (8)
GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)
src/masternode/active/context.cpp (1)
src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/masternode/payments.cpp (2)
src/validation.cpp (2)
GetMasternodePayment(1562-1629)GetMasternodePayment(1562-1562)src/governance/classes.cpp (2)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)
src/llmq/dkgsession.cpp (2)
src/llmq/utils.cpp (4)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)GetQuorumRelayMembers(770-825)GetQuorumRelayMembers(770-773)src/logging.h (1)
LogAcceptDebug(235-238)
src/evo/mnhftx.cpp (1)
src/txmempool.cpp (4)
ConnectManagers(440-447)ConnectManagers(440-440)DisconnectManagers(449-453)DisconnectManagers(449-449)
src/governance/signing.cpp (1)
src/governance/classes.cpp (2)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)
src/node/interfaces.cpp (2)
src/interfaces/node.h (4)
MnEntry(64-462)MnEntry(68-68)MnList(95-95)Node(225-451)src/governance/classes.cpp (2)
GetPaymentsLimit(141-158)GetPaymentsLimit(141-141)
src/rpc/mining.cpp (4)
src/validation.cpp (2)
TestBlockValidity(4487-4540)TestBlockValidity(4487-4495)src/node/miner.h (2)
node(40-77)BlockAssembler(147-225)src/node/miner.cpp (2)
BlockAssembler(72-88)BlockAssembler(107-108)src/deploymentstatus.h (2)
DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)
src/chainlock/chainlock.cpp (3)
src/node/interfaces.cpp (9)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)LOCK(642-646)LOCK(652-659)LOCK(660-667)LOCK(929-938)LOCK(972-976)LOCK(1156-1160)src/rpc/rawtransaction.cpp (1)
WITH_LOCK(651-651)src/llmq/quorums.cpp (2)
VerifyRecoveredSig(1269-1283)VerifyRecoveredSig(1269-1271)
src/evo/deterministicmns.h (2)
src/masternode/payments.cpp (4)
nodiscard(33-82)nodiscard(89-108)nodiscard(110-140)nodiscard(142-181)src/evo/deterministicmns.cpp (8)
GetMNPayee(183-220)GetMNPayee(183-184)GetProjectedMNPayees(222-274)GetProjectedMNPayees(222-223)CDeterministicMNManager(641-647)CDeterministicMNManager(649-649)CheckProRegTx(1098-1231)CheckProRegTx(1098-1100)
src/test/util/setup_common.cpp (2)
src/chainparams.cpp (2)
Params(1356-1359)Params(1356-1356)src/evo/cbtx.cpp (2)
CalcCbTxMerkleRootQuorums(122-213)CalcCbTxMerkleRootQuorums(122-124)
src/evo/cbtx.cpp (1)
src/evo/creditpool.h (1)
pindexPrev(81-108)
src/llmq/context.cpp (1)
src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/interfaces/node.h (3)
src/univalue/include/univalue.h (1)
UniValue(19-23)src/netbase.h (1)
Proxy(65-96)src/node/interfaces.cpp (36)
mn_list(176-180)mn_list(176-176)only_valid(145-150)only_valid(145-145)hash(151-155)hash(151-151)hash(161-165)hash(161-161)hash(954-971)hash(954-954)hash(993-997)hash(993-993)hash(1019-1024)hash(1019-1019)service(156-160)service(156-156)pindex(166-174)pindex(166-166)context(181-184)context(181-181)context(207-210)context(207-207)context(243-249)context(348-351)context(348-348)context(363-369)context(370-373)context(370-370)context(386-392)context(393-399)context(400-406)context(407-410)context(407-407)context(798-805)MakeMNList(1245-1245)MakeMNList(1245-1245)
src/llmq/dkgsessionmgr.cpp (2)
src/llmq/dkgsessionmgr.h (1)
CDKGSessionManager(46-126)src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/validation.cpp (3)
src/versionbits.cpp (16)
pindex(248-251)pindex(248-248)params(217-217)params(217-217)params(233-233)params(233-233)params(234-234)params(234-234)params(235-235)params(235-235)params(236-246)params(236-236)params(255-255)params(255-255)pindexPrev(218-232)pindexPrev(218-218)src/chainparams.cpp (2)
Params(1356-1359)Params(1356-1356)src/deploymentstatus.h (4)
DeploymentActiveAt(27-31)DeploymentActiveAt(33-37)DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)
src/rpc/quorums.cpp (4)
src/llmq/options.cpp (2)
GetEnabledQuorumTypes(102-113)GetEnabledQuorumTypes(102-103)src/llmq/utils.cpp (2)
GetQuorumConnections(744-768)GetQuorumConnections(744-747)src/llmq/quorums.cpp (4)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)VerifyRecoveredSig(1269-1283)VerifyRecoveredSig(1269-1271)src/node/transaction.cpp (2)
GetTransaction(120-151)GetTransaction(120-120)
src/instantsend/instantsend.h (2)
src/instantsend/instantsend.cpp (2)
CInstantSendManager(59-72)CInstantSendManager(74-74)src/node/interfaces.cpp (3)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)
src/llmq/utils.h (2)
src/validation.cpp (1)
ChainstateManager(6115-6125)src/llmq/utils.cpp (12)
DeterministicOutboundConnection(722-742)DeterministicOutboundConnection(722-722)GetQuorumConnections(744-768)GetQuorumConnections(744-747)GetQuorumRelayMembers(770-825)GetQuorumRelayMembers(770-773)CalcDeterministicWatchConnections(827-847)CalcDeterministicWatchConnections(827-829)EnsureQuorumConnections(849-909)EnsureQuorumConnections(849-853)AddQuorumProbeConnections(911-955)AddQuorumProbeConnections(911-915)
src/evo/specialtxman.cpp (4)
src/validation.cpp (8)
pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)src/evo/cbtx.cpp (6)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)CheckCbTx(23-46)CheckCbTx(23-23)CalcCbTxMerkleRootQuorums(122-213)CalcCbTxMerkleRootQuorums(122-124)src/evo/deterministicmns.cpp (8)
CheckProRegTx(1098-1231)CheckProRegTx(1098-1100)CheckProUpServTx(1233-1308)CheckProUpServTx(1233-1234)CheckProUpRegTx(1310-1380)CheckProUpRegTx(1310-1312)CheckProUpRevTx(1382-1412)CheckProUpRevTx(1382-1383)src/evo/creditpool.cpp (3)
creditPoolDiff(332-332)GetCreditPoolDiffForBlock(324-349)GetCreditPoolDiffForBlock(324-327)
src/node/miner.cpp (6)
src/evo/creditpool.h (1)
pindexPrev(81-108)src/evo/cbtx.cpp (2)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)src/deploymentstatus.h (2)
DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)src/validation.cpp (10)
params(2203-2203)params(2203-2203)params(2204-2204)params(2204-2204)params(2206-2206)params(2206-2206)params(2207-2207)params(2207-2207)GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)src/llmq/options.cpp (2)
GetEnabledQuorumParams(115-125)GetEnabledQuorumParams(115-116)src/evo/creditpool.cpp (3)
creditPoolDiff(332-332)GetCreditPoolDiffForBlock(324-349)GetCreditPoolDiffForBlock(324-327)
src/evo/deterministicmns.cpp (2)
src/node/interfaces.cpp (5)
chainman(677-679)chainman(1162-1164)chainman(1232-1235)pindex(166-174)pindex(166-166)src/evo/deterministicmns.h (2)
ForEachMNShared(308-560)ForEachMN(292-299)
src/llmq/debug.cpp (1)
src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)
src/qt/masternodelist.cpp (1)
src/node/interfaces.cpp (2)
pindex(166-174)pindex(166-166)
src/rpc/blockchain.cpp (2)
src/deploymentstatus.h (4)
DeploymentEnabled(40-44)DeploymentEnabled(46-50)DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)src/validation.cpp (8)
GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)
src/llmq/blockprocessor.cpp (3)
src/llmq/options.cpp (2)
GetEnabledQuorumParams(115-125)GetEnabledQuorumParams(115-116)src/llmq/utils.cpp (2)
GetAllQuorumMembers(200-282)GetAllQuorumMembers(200-203)src/llmq/blockprocessor.h (1)
CQuorumBlockProcessor(41-106)
src/llmq/utils.cpp (2)
src/evo/cbtx.cpp (2)
GetNonNullCoinbaseChainlock(222-251)GetNonNullCoinbaseChainlock(222-223)src/llmq/options.cpp (2)
IsAllMembersConnectedEnabled(34-37)IsAllMembersConnectedEnabled(34-34)
src/validation.h (3)
src/validation.cpp (27)
GetBlockSubsidyInner(1549-1553)GetBlockSubsidyInner(1549-1549)GetSuperblockSubsidyInner(1543-1547)GetSuperblockSubsidyInner(1543-1543)GetBlockSubsidy(1555-1560)GetBlockSubsidy(1555-1555)pindex(2205-2205)pindex(2205-2205)pindex(2209-2215)pindex(2209-2209)pindex(3131-3138)pindex(3131-3131)ChainstateManager(6115-6125)chainparams(567-578)chainparams(567-569)chainparams(581-591)chainparams(581-582)chainparams(594-604)chainparams(594-595)ProcessNewBlock(4435-4472)ProcessNewBlock(4435-4435)ProcessNewBlockHeaders(4314-4341)ProcessNewBlockHeaders(4314-4314)IsQuorumRotationEnabled(6017-6032)IsQuorumRotationEnabled(6017-6018)IsQuorumTypeEnabled(6034-6082)IsQuorumTypeEnabled(6034-6037)src/versionbits.h (1)
VersionBitsCache(80-103)src/deploymentstatus.h (6)
DeploymentActiveAfter(14-18)DeploymentActiveAfter(20-24)DeploymentActiveAt(27-31)DeploymentActiveAt(33-37)DeploymentEnabled(40-44)DeploymentEnabled(46-50)
src/llmq/ehf_signals.cpp (1)
src/llmq/quorums.cpp (2)
SelectQuorumForSigning(1207-1267)SelectQuorumForSigning(1207-1208)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build container / Build container
- GitHub Check: Build slim container / Build container
- GitHub Check: ClangFormat
| if (blockIndex->nHeight + dkgInterval < m_chainman.ActiveHeight()) { | ||
| nSignHeight = blockIndex->nHeight + dkgInterval - 1; | ||
| } | ||
| // For RegTest non-rotating quorum cycleHash has directly quorum hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hold cs_main before calling ActiveHeight()
ChainstateManager::ActiveHeight() asserts cs_main is held. This worker-thread path hits it without the lock, so debug builds will hit the assertion and release builds risk a race while reading chain height. Please grab cs_main (e.g., via WITH_LOCK) before calling ActiveHeight().
- if (blockIndex->nHeight + dkgInterval < m_chainman.ActiveHeight()) {
+ const int tip_height = WITH_LOCK(::cs_main, return m_chainman.ActiveHeight());
+ if (blockIndex->nHeight + dkgInterval < tip_height) {
nSignHeight = blockIndex->nHeight + dkgInterval - 1;
}🤖 Prompt for AI Agents
In src/instantsend/instantsend.cpp around lines 280 to 283, ActiveHeight() is
called without holding cs_main (it asserts cs_main is held); wrap the call in a
cs_main lock (for example use WITH_LOCK(cs_main) or LOCK(cs_main)) before
calling m_chainman.ActiveHeight(), compute nSignHeight inside that locked scope,
and keep the lock scope minimal (release immediately after reading the active
height) to avoid assertion failures and race conditions.
c0faae0 fix: reuse best clsig to avoid potential race condition (Kittywhiskers Van Gogh) 98dc874 trivial: use `GetBestChainLockHeight()` (Kittywhiskers Van Gogh) Pull request description: ## Additional Information Fix for potential race condition identified by CodeRabbit in [dash#6933](#6933) ([comment](#6933 (comment))) ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK c0faae0 Tree-SHA512: 74762c5d715405a32af4a58553c05dc2fd98cdb7f038a519cf244a7c84a6a536ff341d8e8f534dbb6a0df952730314f85c52738c4d5b2e72fa74a4f02a6b2237
Co-authored-by: UdjinM6 <[email protected]>
The `ConnectManager` approach is no longer needed and directly conflicts with `ChainstateManager` also holding the versionbits cache as without it, we start experiencing validation failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
src/evo/deterministicmns.h (1)
24-33: Include<functional>forstd::function.This header now relies on
std::function(see the updatedForEachMN*signatures), but<functional>is never included, so the build breaks. Please add the missing include.Apply this diff:
#include <atomic> #include <limits> #include <numeric> +#include <functional> #include <unordered_map> #include <utility>src/evo/creditpool.cpp (1)
170-181: Use chainman params and guard negative ancestor heightKeep param sourcing consistent and avoid passing a negative height to GetAncestor.
Apply:
- // We use here sliding window with Params().CreditPoolPeriodBlocks to determine + // We use here a sliding window with chain params to determine - const CBlockIndex* distant_block_index{ - block_index->GetAncestor(block_index->nHeight - Params().CreditPoolPeriodBlocks())}; + const int distant_height = block_index->nHeight - m_chainman.GetParams().CreditPoolPeriodBlocks(); + const CBlockIndex* distant_block_index = + distant_height >= 0 ? block_index->GetAncestor(distant_height) : nullptr;And replace any remaining occurrences of
Params().CreditPoolPeriodBlocks()in this function withm_chainman.GetParams().CreditPoolPeriodBlocks().Also applies to: 179-187
src/evo/specialtxman.cpp (1)
70-83: Defensive bounds check for bestCLHeightDiff to avoid invalid GetAncestorA malformed cbTx can make
curBlockCoinbaseCLHeightnegative;GetAncestor()would then be invalid/deref null.Apply:
- if (cbTx.bestCLSignature.IsValid()) { - int curBlockCoinbaseCLHeight = pindex->nHeight - static_cast<int>(cbTx.bestCLHeightDiff) - 1; + if (cbTx.bestCLSignature.IsValid()) { + // Ensure diff is sane: it must reference a valid ancestor of pindex + if (cbTx.bestCLHeightDiff > static_cast<uint32_t>(pindex->nHeight)) { + return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cbtx-cldiff"); + } + int curBlockCoinbaseCLHeight = pindex->nHeight - static_cast<int>(cbTx.bestCLHeightDiff) - 1; + const CBlockIndex* pCL = curBlockCoinbaseCLHeight >= 0 ? pindex->GetAncestor(curBlockCoinbaseCLHeight) : nullptr; + if (pCL == nullptr) { + return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cbtx-cldiff"); + } - uint256 curBlockCoinbaseCLBlockHash = pindex->GetAncestor(curBlockCoinbaseCLHeight)->GetBlockHash(); + uint256 curBlockCoinbaseCLBlockHash = pCL->GetBlockHash();src/interfaces/node.h (1)
28-46: Add missing forward declaration for COutPoint
MnEntry::getCollateralOutpoint()returnsconst COutPoint&, butCOutPointisn’t declared here.Apply:
class CNodeStats; class Coin; +class COutPoint; class CScript; class CService;Also applies to: 64-87
src/node/miner.cpp (1)
175-177: Add guard to prevent unsigned underflow when bestCLHeightDiff is negativeThe subtraction
pindexPrev->nHeight - best_clsig.getHeight()can underflow ifbest_clsig.getHeight() > pindexPrev->nHeight. While ChainLock semantics suggest heights should be ≤ current block height, theChainLockSigconstructor andProcessNewChainLock()contain no validation to enforce this. A malicious or malformed CL could trigger the underflow.Fix lines 159 and 175 by adding a guard:
if (best_clsig.getHeight() <= pindexPrev->nHeight) { bestCLHeightDiff = pindexPrev->nHeight - best_clsig.getHeight(); bestCLSignature = best_clsig.getSig(); } else { // Reject invalid CL with future height best_clsig = chainlock::ChainLockSig{}; // fallback logic... }Or return false/skip this branch if CL height is invalid.
♻️ Duplicate comments (3)
src/evo/mnhftx.cpp (1)
63-66: Verify DeploymentActiveAfter signature compatibility.A previous review comment flagged that
DeploymentActiveAfterexpects(const Consensus::Params&, …, VersionBitsCache&)but this code passes(pindexPrev, m_chainman, Consensus::DEPLOYMENT_V20). Similar patterns appear at lines 333, 343, and 362 withDeploymentActiveAt.Please confirm that:
- The
DeploymentActiveAfter/DeploymentActiveAtsignatures have been updated to acceptChainstateManagerin this PR- The code compiles successfully with these call sites
Run the following to verify the updated function signatures:
#!/bin/bash # Search for DeploymentActiveAfter and DeploymentActiveAt function definitions ast-grep --pattern $'DeploymentActiveAfter($$$) { $$$ }' ast-grep --pattern $'DeploymentActiveAt($$$) { $$$ }' # Also check the header declarations rg -n "DeploymentActiveAfter|DeploymentActiveAt" --type=cpp --type=h -C2 -g '!*.cpp' -g 'deploymentstatus.h'src/instantsend/instantsend.cpp (1)
280-282: Holdcs_mainbefore callingActiveHeight()
ChainstateManager::ActiveHeight()assertscs_mainis held. This worker thread still calls it without taking the lock, so debug builds will hit the assertion and release builds risk reading an inconsistent tip height. Please grabcs_main(e.g., viaWITH_LOCK) before the call.- if (blockIndex->nHeight + dkgInterval < m_chainman.ActiveHeight()) { + const int tip_height = WITH_LOCK(::cs_main, return m_chainman.ActiveHeight()); + if (blockIndex->nHeight + dkgInterval < tip_height) { nSignHeight = blockIndex->nHeight + dkgInterval - 1; }src/llmq/quorums.h (1)
244-273: Add the missingChainstateManagerforward declaration
ChainstateManageris referenced here but the header never declares or includes the type, so any translation unit that pulls inllmq/quorums.hbefore<validation.h>will fail to compile. Please add a forward declaration alongside the other class forwards (or include the defining header).class CSporkManager; +class ChainstateManager; namespace util {
🧹 Nitpick comments (8)
src/rpc/evo.cpp (3)
703-705: Tip pointer passed to gsl::not_null: ensure non-null preconditionGetMaxFromDeployment takes gsl::not_null<const CBlockIndex*>. ActiveChain().Tip() should be non-null; consider asserting or early error if it’s unexpectedly null to avoid runtime assertion in not_null.
Example:
- ptx.nVersion = ProTxVersion::GetMaxFromDeployment<CProRegTx>(WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()), + const CBlockIndex* tip = WITH_LOCK(::cs_main, return chainman.ActiveChain().Tip()); + CHECK_NONFATAL(tip != nullptr); + ptx.nVersion = ProTxVersion::GetMaxFromDeployment<CProRegTx>(tip, chainman, /*is_basic_override=*/!use_legacy);
755-786: Parameter indexing is correct but brittle; add named indices for clarityThe offsets (paramIdx + 6/7) adapt correctly for Regular vs Evo and Fund vs External/Prepare, but this is easy to break. Define local named indices (e.g., idx_platformNodeID, idx_feeSourceOrFund, idx_submit) to document intent and reduce off‑by‑one risk. Keep behavior unchanged.
1141-1142: Same gsl::not_null consideration as aboveApply the same non-null guard around ActiveChain().Tip() before passing into GetMaxFromDeployment for ProUpRegTx.
src/rpc/mining.cpp (1)
728-736: Leftover Params() usages nearby (non-blocking consistency nit)Elsewhere in this file we still construct CChainParams chainparams(Params()) and use Params() in GetNetworkHashPS. For consistency with this backport, consider replacing those with chainman.GetParams() in a follow-up (no behavior change).
src/validation.h (1)
1019-1024: m_versionbitscache is now per-instancePer-instance VersionBitsCache is required by the backport. Consider keeping it non-public in future cleanup, but fine for this refactor.
src/evo/creditpool.cpp (1)
59-73: Function-static cache capacity tied to first caller’s params
block_data_cachecapacity is derived fromchainmanat first call and then fixed. If multiple tests/nodes with differing params share the process, this can surprise.
- Optional: make capacity a constexpr from compile-time params, or scope the cache into
CCreditPoolManagerso it’s per-chainman.- Verify that this codepath is never hit with different
ChainstateManagerinstances in one process (e.g., unit/functional tests).src/node/miner.cpp (1)
128-131: Prefer consensus from chainman for consistencyMinor style alignment with the backport (no behavior change).
- if (best_clsig.getHeight() < Params().GetConsensus().DeploymentHeight(Consensus::DEPLOYMENT_V19)) { + if (best_clsig.getHeight() < chainman.GetConsensus().DeploymentHeight(Consensus::DEPLOYMENT_V19)) {src/validation.cpp (1)
1482-1495: Subsidy helpers refactor: consistent, with a tiny consistency nit.Passing ChainstateManager into GetBlockSubsidy{,Inner,Helper}/GetSuperblockSubsidyInner is coherent. One nit: the genesis fallback still uses global Params() instead of chainman.GetParams(); consider switching for consistency.
Apply:
CAmount GetBlockSubsidy(const CBlockIndex* const pindex, const ChainstateManager& chainman) { - if (pindex->pprev == nullptr) return Params().GenesisBlock().vtx[0]->GetValueOut(); + if (pindex->pprev == nullptr) return chainman.GetParams().GenesisBlock().vtx[0]->GetValueOut(); const bool isV20Active{DeploymentActiveAt(*pindex, chainman, Consensus::DEPLOYMENT_V20)}; return GetBlockSubsidyInner(pindex->pprev->nBits, pindex->pprev->nHeight, chainman, isV20Active); }Note: fine to defer if strict backport fidelity is required. Based on learnings.
Also applies to: 1545-1555, 1557-1562, 2632-2634
| const auto& consensusParams = chainman.GetConsensus(); | ||
| const bool fV20Active{nBlockHeight >= consensusParams.V20Height}; | ||
|
|
||
| // min subsidy for high diff networks and vice versa | ||
| int nBits = consensusParams.fPowAllowMinDifficultyBlocks ? UintToArith256(consensusParams.powLimit).GetCompact() : 1; | ||
| // some part of all blocks issued during the cycle goes to superblock, see GetBlockSubsidy | ||
| CAmount nSuperblockPartOfSubsidy = GetSuperblockSubsidyInner(nBits, nBlockHeight - 1, consensusParams, fV20Active); | ||
| CAmount nSuperblockPartOfSubsidy = GetSuperblockSubsidyInner(nBits, nBlockHeight - 1, chainman, fV20Active); | ||
| CAmount nPaymentsLimit = nSuperblockPartOfSubsidy * consensusParams.nSuperblockCycle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore previous-block context for subsidy math
We used to derive both nBits and the V20 activation flag from the real previous block via the active_chain argument. Replacing that with synthetic constants (1 or powLimit) plus a plain height >= V20Height check means we now treat every testnet/regtest block as min-difficulty and we ignore the deployment state embedded in the block index. That skews nPaymentsLimit, so we can accept or reject superblocks with the wrong budget near activation boundaries or after reorgs. Please grab the previous CBlockIndex from chainman, keep its nBits, and ask DeploymentActiveAt as before.
- const auto& consensusParams = chainman.GetConsensus();
- const bool fV20Active{nBlockHeight >= consensusParams.V20Height};
-
- // min subsidy for high diff networks and vice versa
- int nBits = consensusParams.fPowAllowMinDifficultyBlocks ? UintToArith256(consensusParams.powLimit).GetCompact() : 1;
- // some part of all blocks issued during the cycle goes to superblock, see GetBlockSubsidy
- CAmount nSuperblockPartOfSubsidy = GetSuperblockSubsidyInner(nBits, nBlockHeight - 1, chainman, fV20Active);
+ const auto& consensusParams = chainman.GetConsensus();
+ if (nBlockHeight <= 0) {
+ return 0;
+ }
+
+ const CBlockIndex* const pPrevBlockIndex =
+ WITH_LOCK(cs_main, return chainman.ActiveChain()[nBlockHeight - 1]);
+ if (pPrevBlockIndex == nullptr) {
+ return 0;
+ }
+
+ const int nBits = pPrevBlockIndex->nBits;
+ const bool fV20Active = DeploymentActiveAt(*pPrevBlockIndex, chainman, Consensus::DEPLOYMENT_V20);
+ CAmount nSuperblockPartOfSubsidy =
+ GetSuperblockSubsidyInner(nBits, pPrevBlockIndex->nHeight, chainman, fV20Active);Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/governance/classes.cpp around lines 147 to 154, restore use of the
previous block index for subsidy math: fetch the previous CBlockIndex from
chainman (e.g. active chain tip at nBlockHeight-1 or
chainman.ActiveChain().Tip()->GetAncestor(nBlockHeight-1)), null-check it, use
its nBits value instead of the synthetic 1/powLimit compact, and call
DeploymentActiveAt (or the existing DeploymentActiveAt-like helper) against that
previous CBlockIndex to compute the V20 activation flag; pass the previous block
height/index into GetSuperblockSubsidyInner so nBits and V20 state reflect the
actual chain state at the prior block (handling the null case defensively as
before).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using actual chain nBits for superblocks and using "synthetic" constants instead is intentional because superblocks themselves are "synthetic".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UdjinM6, thank you for the clarification! That makes sense – since superblocks are synthetic governance constructs rather than traditionally mined blocks, using synthetic difficulty constants for budget calculations is the correct approach. I appreciate you explaining the design rationale.
✏️ Learnings added
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6933
File: src/governance/classes.cpp:147-154
Timestamp: 2025-11-04T18:23:28.148Z
Learning: In src/governance/classes.cpp, CSuperblock::GetPaymentsLimit intentionally uses synthetic difficulty constants (nBits = 1 for mainnet, powLimit for networks with min difficulty) and simple height-based V20 activation checks instead of actual chain block data. This is by design because superblocks themselves are "synthetic" governance payment blocks, not regular mined blocks.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: kwvg
Repo: dashpay/dash PR: 6665
File: src/evo/providertx.h:82-82
Timestamp: 2025-06-06T11:53:09.094Z
Learning: In ProTx serialization code (SERIALIZE_METHODS), version checks should use hardcoded maximum flags (/*is_basic_scheme_active=*/true, /*is_extended_addr=*/true) rather than deployment-based flags. This is because serialization code should be able to deserialize any structurally valid ProTx up to the maximum version the code knows how to handle, regardless of current consensus validity. Validation code, not serialization code, is responsible for checking whether a ProTx version is consensus-valid based on deployment status.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: kwvg
Repo: dashpay/dash PR: 6530
File: src/validation.cpp:360-362
Timestamp: 2025-01-14T08:37:16.955Z
Learning: The UpdateTransactionsFromBlock() method in txmempool.cpp takes parameters in the order: vHashUpdate, ancestor_size_limit, ancestor_count_limit. The size limit comes before the count limit.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
| std::vector<CDeterministicMNCPtr> ComputeQuorumMembers(Consensus::LLMQType llmqType, const ChainstateManager& chainman, | ||
| const CDeterministicMNList& mn_list, | ||
| const CBlockIndex* pQuorumBaseBlockIndex) | ||
| { | ||
| bool EvoOnly = (Params().GetConsensus().llmqTypePlatform == llmqType) && IsV19Active(pQuorumBaseBlockIndex); | ||
| bool EvoOnly = (Params().GetConsensus().llmqTypePlatform == llmqType) && IsV19Active(chainman, pQuorumBaseBlockIndex); | ||
| const auto& llmq_params_opt = Params().GetLLMQ(llmqType); | ||
| assert(llmq_params_opt.has_value()); | ||
| if (llmq_params_opt->useRotation || pQuorumBaseBlockIndex->nHeight % llmq_params_opt->dkgInterval != 0) { | ||
| ASSERT_IF_DEBUG(false); | ||
| return {}; | ||
| } | ||
|
|
||
| const auto modifier = GetHashModifier(llmq_params_opt.value(), pQuorumBaseBlockIndex); | ||
| const auto modifier = GetHashModifier(llmq_params_opt.value(), chainman, pQuorumBaseBlockIndex); | ||
| return CalculateQuorum(mn_list, modifier, llmq_params_opt->size, EvoOnly); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix activation checks to use the previous block
DeploymentActiveAfter is defined on the previous block; feeding it the quorum base block flips the v19/v20 gates one block early. That treats the block immediately before activation as if the deployment were already active, changing quorum membership/hash modifier in a consensus-critical way.
Please call IsV19Active/IsV20Active with pQuorumBaseBlockIndex->pprev (guard for genesis) and reuse the resulting boolean for the condition. Apply the same adjustment at the other call sites in this file that currently pass the base block (GetAllQuorumMembers, GetHashModifier, BuildNewQuorumQuarterMembers).
Apply this diff to ComputeQuorumMembers as a template for the fix:
- bool EvoOnly = (Params().GetConsensus().llmqTypePlatform == llmqType) && IsV19Active(chainman, pQuorumBaseBlockIndex);
+ const CBlockIndex* pindexPrev = pQuorumBaseBlockIndex->pprev;
+ const bool v19_active = pindexPrev != nullptr && IsV19Active(chainman, pindexPrev);
+ bool EvoOnly = (Params().GetConsensus().llmqTypePlatform == llmqType) && v19_active;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't change consensus rules like that even if you think it's implemented incorrectly, current behavior should be preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UdjinM6, you're absolutely right. Consensus rules must be preserved exactly as implemented, even if the logic appears theoretically incorrect. Any change to when deployments activate would be a consensus-breaking change that could fork the network.
Since this is a backport PR focused on refactoring (moving g_versionbitscache to ChainstateManager), the goal is to maintain exact behavioral equivalence with the existing implementation. The IsV19Active/IsV20Active calls should continue to use pQuorumBaseBlockIndex as they currently do, preserving the existing consensus behavior.
The CodeRabbit suggestion to use pprev would alter when quorums activate relative to deployments, which is not acceptable for consensus-critical code. The refactoring should only change how we access the chain state (via ChainstateManager), not the logic itself.
✏️ Learnings added
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6933
File: src/llmq/utils.cpp:284-298
Timestamp: 2025-11-04T18:24:27.205Z
Learning: In consensus-critical code (such as quorum formation, block validation, or deployment activation logic), do not suggest changes to the logic itself even if the implementation appears theoretically incorrect or off-by-one. Consensus rules, once deployed on the Dash network, must be preserved exactly to avoid network forks. Refactoring PRs should maintain perfect behavioral equivalence. Only suggest logic changes if explicitly accompanied by a DIP (Dash Improvement Proposal) or if the maintainer indicates the consensus rule needs to be changed with appropriate activation logic.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: kwvg
Repo: dashpay/dash PR: 6840
File: src/net_processing.cpp:2882-2886
Timestamp: 2025-10-02T18:29:54.756Z
Learning: Across net_processing.cpp, once LLMQContext (m_llmq_ctx) is asserted non-null, its subcomponents (e.g., isman, qdkgsman, quorum_block_processor) are treated as initialized and used without extra null checks.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/commitment.cpp:54-60
Timestamp: 2025-08-19T15:08:00.835Z
Learning: In Dash Core, llmq_params.size == 1 is used only for regtest environments, not on public networks, which significantly reduces the risk profile of code paths specific to single-member quorums.
Learnt from: knst
Repo: dashpay/dash PR: 6691
File: src/test/llmq_params_tests.cpp:148-151
Timestamp: 2025-07-15T14:53:04.819Z
Learning: In the Dash Core LLMQ implementation, signingActiveQuorumCount is never 0 in the actual parameters defined in params.h, making division by zero scenarios unrealistic in the max_cycles() function.
Learnt from: kwvg
Repo: dashpay/dash PR: 6665
File: src/evo/providertx.h:82-82
Timestamp: 2025-06-06T11:53:09.094Z
Learning: In ProTx serialization code (SERIALIZE_METHODS), version checks should use hardcoded maximum flags (/*is_basic_scheme_active=*/true, /*is_extended_addr=*/true) rather than deployment-based flags. This is because serialization code should be able to deserialize any structurally valid ProTx up to the maximum version the code knows how to handle, regardless of current consensus validity. Validation code, not serialization code, is responsible for checking whether a ProTx version is consensus-valid based on deployment status.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: knst
Repo: dashpay/dash PR: 6692
File: src/llmq/blockprocessor.cpp:217-224
Timestamp: 2025-08-19T14:57:31.801Z
Learning: In PR #6692, knst acknowledged a null pointer dereference issue in ProcessBlock() method where LookupBlockIndex may return nullptr but is passed to gsl::not_null, and created follow-up PR #6789 to address it, consistent with avoiding scope creep in performance-focused PRs.
| const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN); | ||
| const auto& chainman = *Assert(m_node.chainman); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused variable to avoid -Wunused-variable (possible -Werror)
chainParams is no longer used after migrating to chainman. Safe to drop it.
Apply this diff:
- const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN);
- const auto& chainman = *Assert(m_node.chainman);
+ const auto& chainman = *Assert(m_node.chainman);🤖 Prompt for AI Agents
In src/test/subsidy_tests.cpp around lines 16 to 18, the variable 'chainParams'
is created but never used, causing a -Wunused-variable warning; remove the
unused declaration and keep only the needed chainman assertion line (i.e.,
delete the CreateChainParams(...) assignment) so the file compiles without the
unused-variable error.
| std::vector<std::shared_ptr<CBlock>> ret{total_height}; | ||
| auto time{params.GenesisBlock().nTime}; | ||
| auto time{genesis_block.nTime}; | ||
| for (size_t height{0}; height < total_height; ++height) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore size-based constructor for block vector
std::vector<std::shared_ptr<CBlock>> ret{total_height}; selects the initializer_list constructor, which tries to create a single std::shared_ptr<CBlock> from the integer total_height. This fails to compile for any non-zero height. We need the size constructor ret(total_height) so the vector is sized correctly.
Apply this diff:
- std::vector<std::shared_ptr<CBlock>> ret{total_height};
+ std::vector<std::shared_ptr<CBlock>> ret(total_height);📝 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.
| std::vector<std::shared_ptr<CBlock>> ret{total_height}; | |
| auto time{params.GenesisBlock().nTime}; | |
| auto time{genesis_block.nTime}; | |
| for (size_t height{0}; height < total_height; ++height) { | |
| std::vector<std::shared_ptr<CBlock>> ret(total_height); | |
| auto time{genesis_block.nTime}; | |
| for (size_t height{0}; height < total_height; ++height) { |
🤖 Prompt for AI Agents
In src/test/util/mining.cpp around lines 36 to 38, the vector initialization
std::vector<std::shared_ptr<CBlock>> ret{total_height}; wrongly selects the
initializer_list constructor and tries to construct a single shared_ptr from an
integer; change it to use the size constructor by replacing the brace form with
parentheses (i.e., ret(total_height)) so the vector is created with total_height
null/shared_ptr elements rather than attempting to interpret total_height as an
element.
Additional Information
Depends on refactor: delete extra ctors from managers, restore memory-only db for
EvoDbandLLMQContext#6923As the versionbits cache is now a member of
ChainstateManager, allDeploymentActive{After,At}()calls needed to be adapted to pass a reference toChainstateManager, which has necessitated substantial refactoring. For this reason, the backport has been isolated into a separate PR.Currently, Qt code is knowledgeable of objects like
CDeterministicMNListandCDeterministicMN. This was fine because none of the functions called demanded knowledge of classes explicitly isolated from Qt code likeCChainState, access to which is instead mediated through interfaces.As the deglobalization now requires knowledge of
ChainstateManager, bothCDeterministicMNListandCDeterministicMNhave been implemented as interfacesinterfaces::MnListandinterfaces::MnEntryrespectively.The problem of ensuring access to the context as
CDeterministicMNListis updated from sources that cannot set the context themselves has been managed with a workaround, namelyinterfaces::MnList::copyContextTo(). The lifecycle ofMnListwill be as follows:A blank
MnListis initialised without a contextdash/src/qt/clientmodel.cpp
Line 53 in c887cff
The latest
MnListis fetched withinterfaces::EVO::getListAtChainTip()dash/src/qt/clientmodel.cpp
Lines 120 to 126 in c887cff
interfaces::EVOlends its node context to theMnListdash/src/node/interfaces.cpp
Lines 197 to 206 in c887cff
Calls like
interfaces::MnList::getProjectedMNPayees()now workdash/src/node/interfaces.cpp
Lines 166 to 174 in c887cff
Event handler gives us the newest masternode list but doesn't have access to node context
dash/src/qt/clientmodel.cpp
Lines 322 to 325 in c887cff
Context from older masternode list is copied into newer list
dash/src/qt/clientmodel.cpp
Line 108 in c887cff
Breaking Changes
None expected.
Checklist