Skip to content

Conversation

@kwvg
Copy link
Collaborator

@kwvg kwvg commented Nov 2, 2025

Additional Information

  • Depends on refactor: delete extra ctors from managers, restore memory-only db for EvoDb and LLMQContext #6923

  • As the versionbits cache is now a member of ChainstateManager, all DeploymentActive{After,At}() calls needed to be adapted to pass a reference to ChainstateManager, 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 CDeterministicMNList and CDeterministicMN. This was fine because none of the functions called demanded knowledge of classes explicitly isolated from Qt code like CChainState, access to which is instead mediated through interfaces.

    • As the deglobalization now requires knowledge of ChainstateManager, both CDeterministicMNList and CDeterministicMN have been implemented as interfaces interfaces::MnList and interfaces::MnEntry respectively.

      • The problem of ensuring access to the context as CDeterministicMNList is updated from sources that cannot set the context themselves has been managed with a workaround, namely interfaces::MnList::copyContextTo(). The lifecycle of MnList will be as follows:

        A blank MnList is initialised without a context

        mnListCached = interfaces::MakeMNList(CDeterministicMNList{});

        The latest MnList is fetched with interfaces::EVO::getListAtChainTip()

        dash/src/qt/clientmodel.cpp

        Lines 120 to 126 in c887cff

        void ClientModel::refreshMasternodeList()
        {
        auto [mnList, tip] = m_node.evo().getListAtChainTip();
        LOCK(cs_mnlist);
        setMasternodeList(std::move(mnList), tip);
        }

        interfaces::EVO lends its node context to the MnList

        std::pair<MnListPtr, const CBlockIndex*> getListAtChainTip() override
        {
        const CBlockIndex *tip = WITH_LOCK(::cs_main, return chainman().ActiveChain().Tip());
        MnListImpl mnList{CDeterministicMNList{}};
        if (tip != nullptr && context().dmnman != nullptr) {
        mnList = context().dmnman->GetListForBlock(tip);
        }
        mnList.setContext(m_context);
        return {std::make_unique<MnListImpl>(mnList), tip};
        }

        Calls like interfaces::MnList::getProjectedMNPayees() now work

        std::vector<MnEntryCPtr> getProjectedMNPayees(const CBlockIndex* pindex) const override
        {
        std::vector<MnEntryCPtr> ret;
        if (!m_context || !m_context->chainman) return ret;
        for (const auto& payee : m_list.GetProjectedMNPayees(pindex, *m_context->chainman)) {
        ret.emplace_back(std::make_unique<const MnEntryImpl>(payee));
        }
        return ret;
        }

        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

        m_event_handlers.emplace_back(m_node.handleNotifyMasternodeListChanged(
        [this](const CDeterministicMNList& newList, const CBlockIndex* pindex) {
        setMasternodeList(interfaces::MakeMNList(newList), pindex);
        }));

        Context from older masternode list is copied into newer list

        mnListCached->copyContextTo(*mnList);

Breaking Changes

None expected.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation (note: N/A)
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@kwvg kwvg added this to the 23.1 milestone Nov 2, 2025
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

⚠️ Potential Merge Conflicts Detected

This PR has potential conflicts with the following open PRs:

Please coordinate with the authors of these PRs to avoid merge conflicts.

PastaPastaPasta added a commit that referenced this pull request Nov 4, 2025
…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
@kwvg kwvg marked this pull request as ready for review November 4, 2025 10:09
@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

This pull request refactors the codebase to centralize blockchain state access through ChainstateManager instead of passing individual components like CChainState, CChain, Consensus::Params, or global caches. The changes propagate through validation, consensus, LLMQ quorum logic, EVO (deterministic masternodes), governance, and RPC layers. Major signature updates include removing chainparams parameters from ProcessNewBlock and ProcessNewBlockHeaders, refactoring subsidy calculation functions to accept ChainstateManager rather than Consensus::Params, and replacing direct member access with ChainstateManager accessors (e.g., chainman.GetConsensus(), chainman.m_versionbitscache). A new abstract interface layer is introduced in Qt (MnEntry and MnList) to decouple the UI from internal deterministic masternode structures. Test files are updated to align with the new signatures.


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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Key areas requiring extra attention:

  • src/validation.h and src/validation.cpp — Core refactoring of ChainstateManager with new accessors (GetParams(), GetConsensus(), IsQuorumRotationEnabled(), IsQuorumTypeEnabled()), removal of chainparams parameters from ProcessNewBlock/ProcessNewBlockHeaders, and updates to subsidy calculation signatures throughout the chain state lifecycle.

  • src/llmq/* (quorum modules) — Widespread propagation of ChainstateManager through CQuorumBlockProcessor, CDKGSessionManager, CQuorumManager, CSigSharesManager, and quorum utility functions; each constructor and public method updated to accept and thread chainman through validation, member selection, and rotation checks.

  • src/evo/* (deterministic masternode modules) — Refactoring of CDeterministicMNManager, CCreditPoolManager, provider-tx validation, and cbtx merkle computation to accept ChainstateManager; signature changes in CheckCbTx, CalcCbTxMerkleRootQuorums, and related helpers ripple through block assembly and validation.

  • src/chainlock/chainlock.h and src/chainlock/chainlock.cpp — Replacement of CChainState member with ChainstateManager reference; constructor signature updated and all internal chain state access routed through the new member.

  • src/interfaces/node.h, src/node/interfaces.cpp — Introduction of new MnEntry and MnList abstract interfaces with corresponding MnEntryImpl and MnListImpl implementations; this abstraction layer affects multiple call sites across Qt and RPC layers.

  • src/qt/* — Changes to ClientModel, MasternodeList, GovernanceList involving pointer-based access patterns (MnListPtr/MnEntryCPtr), new getter-based accessors (e.g., getKeyIdOwner(), getPoSePenalty()), and refactored GetSelectedDIP3MN() return type.

  • Test files (20+ files) — Updates across subsidy tests, block validation tests, LLMQ tests, deterministic masternode tests, and mining tests to accommodate signature changes in ProcessNewBlock, subsidy functions, and deployment checks.


Possibly related PRs


Suggested reviewers

  • UdjinM6
  • PastaPastaPasta

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: moving the global g_versionbitscache into ChainstateManager, which is the backport of bitcoin#24595.
Description check ✅ Passed The description is comprehensive and directly related to the changeset. It explains the backport intent, dependencies, substantial refactoring of DeploymentActive calls, conversion of Qt code to use interfaces, and context management via copyContextTo().
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 missing ChainstateManager declaration

This 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 declare ChainstateManager here as well

ChainstateManager is 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.py on 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 panel

Same 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b1b2c6 and c887cff.

📒 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.cpp
  • src/llmq/debug.cpp
  • src/index/coinstatsindex.cpp
  • src/evo/providertx.h
  • src/test/miner_tests.cpp
  • src/test/versionbits_tests.cpp
  • src/qt/masternodelist.h
  • src/net_processing.cpp
  • src/evo/smldiff.h
  • src/llmq/dkgsessionhandler.h
  • src/init.cpp
  • src/governance/signing.cpp
  • src/test/blockfilter_index_tests.cpp
  • src/rpc/rawtransaction.cpp
  • src/llmq/options.h
  • src/instantsend/instantsend.cpp
  • src/chainlock/chainlock.h
  • src/governance/governance.h
  • src/chainlock/signing.h
  • src/test/evo_trivialvalidation.cpp
  • src/llmq/ehf_signals.cpp
  • src/test/util/mining.cpp
  • src/llmq/context.cpp
  • src/llmq/commitment.cpp
  • src/evo/cbtx.h
  • src/evo/smldiff.cpp
  • src/instantsend/signing.cpp
  • src/test/evo_utils_tests.cpp
  • src/test/util/mining.h
  • src/governance/classes.h
  • src/node/interfaces.cpp
  • src/instantsend/instantsend.h
  • src/test/validation_chainstate_tests.cpp
  • src/rpc/governance.cpp
  • src/test/block_reward_reallocation_tests.cpp
  • src/interfaces/node.h
  • src/deploymentstatus.h
  • src/llmq/signing_shares.h
  • src/llmq/quorums.h
  • src/llmq/signing_shares.cpp
  • src/llmq/quorums.cpp
  • src/node/chainstate.cpp
  • src/masternode/payments.cpp
  • src/evo/mnhftx.cpp
  • src/test/validation_block_tests.cpp
  • src/evo/deterministicmns.h
  • src/governance/classes.cpp
  • src/rpc/evo.cpp
  • src/llmq/dkgsession.h
  • src/llmq/dkgsessionmgr.h
  • src/validation.h
  • src/instantsend/signing.h
  • src/rpc/blockchain.cpp
  • src/llmq/dkgsessionmgr.cpp
  • src/governance/governance.cpp
  • src/coinjoin/client.cpp
  • src/qt/clientmodel.cpp
  • src/test/fuzz/utxo_snapshot.cpp
  • src/llmq/blockprocessor.cpp
  • src/test/subsidy_tests.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/rpc/quorums.cpp
  • src/masternode/active/context.cpp
  • src/rpc/masternode.cpp
  • src/evo/creditpool.h
  • src/llmq/utils.cpp
  • src/llmq/dkgsessionhandler.cpp
  • src/chainlock/chainlock.cpp
  • src/llmq/blockprocessor.h
  • src/evo/cbtx.cpp
  • src/qt/clientmodel.h
  • src/qt/governancelist.cpp
  • src/evo/providertx.cpp
  • src/validation.cpp
  • src/evo/mnhftx.h
  • src/node/miner.cpp
  • src/evo/creditpool.cpp
  • src/test/dynamic_activation_thresholds_tests.cpp
  • src/rpc/mining.cpp
  • src/llmq/options.cpp
  • src/evo/specialtxman.cpp
  • src/llmq/commitment.h
  • src/llmq/dkgsession.cpp
  • src/evo/deterministicmns.cpp
  • src/qt/masternodelist.cpp
  • src/qt/rpcconsole.cpp
  • src/llmq/utils.h
  • src/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.h
  • src/evo/smldiff.h
  • src/evo/cbtx.h
  • src/evo/smldiff.cpp
  • src/masternode/payments.cpp
  • src/evo/mnhftx.cpp
  • src/evo/deterministicmns.h
  • src/masternode/active/context.cpp
  • src/evo/creditpool.h
  • src/evo/cbtx.cpp
  • src/evo/providertx.cpp
  • src/evo/mnhftx.h
  • src/evo/creditpool.cpp
  • src/evo/specialtxman.cpp
  • src/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.cpp
  • src/test/versionbits_tests.cpp
  • src/test/blockfilter_index_tests.cpp
  • src/test/evo_trivialvalidation.cpp
  • src/test/util/mining.cpp
  • src/test/evo_utils_tests.cpp
  • src/test/util/mining.h
  • src/test/validation_chainstate_tests.cpp
  • src/test/block_reward_reallocation_tests.cpp
  • src/test/validation_block_tests.cpp
  • src/test/fuzz/utxo_snapshot.cpp
  • src/test/subsidy_tests.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/test/dynamic_activation_thresholds_tests.cpp
  • src/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.cpp
  • src/test/miner_tests.cpp
  • src/test/versionbits_tests.cpp
  • src/test/evo_trivialvalidation.cpp
  • src/test/evo_utils_tests.cpp
  • src/rpc/governance.cpp
  • src/test/block_reward_reallocation_tests.cpp
  • src/masternode/payments.cpp
  • src/coinjoin/client.cpp
  • src/test/fuzz/utxo_snapshot.cpp
  • src/test/subsidy_tests.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/rpc/masternode.cpp
  • src/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.cpp
  • src/test/miner_tests.cpp
  • src/net_processing.cpp
  • src/test/blockfilter_index_tests.cpp
  • src/evo/mnhftx.cpp
  • src/test/validation_block_tests.cpp
  • src/test/fuzz/utxo_snapshot.cpp
  • src/llmq/blockprocessor.cpp
  • src/llmq/blockprocessor.h
  • src/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.cpp
  • src/llmq/dkgsessionhandler.h
  • src/llmq/options.h
  • src/llmq/context.cpp
  • src/llmq/commitment.cpp
  • src/instantsend/signing.cpp
  • src/llmq/signing_shares.h
  • src/llmq/quorums.h
  • src/llmq/quorums.cpp
  • src/node/chainstate.cpp
  • src/evo/mnhftx.cpp
  • src/llmq/dkgsession.h
  • src/llmq/blockprocessor.cpp
  • src/rpc/quorums.cpp
  • src/masternode/active/context.cpp
  • src/llmq/utils.cpp
  • src/llmq/dkgsessionhandler.cpp
  • src/llmq/blockprocessor.h
  • src/evo/cbtx.cpp
  • src/evo/mnhftx.h
  • src/node/miner.cpp
  • src/llmq/options.cpp
  • src/evo/specialtxman.cpp
  • src/llmq/dkgsession.cpp
  • src/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.h
  • src/test/versionbits_tests.cpp
  • src/test/evo_trivialvalidation.cpp
  • src/deploymentstatus.h
  • src/rpc/evo.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/evo/cbtx.cpp
  • src/evo/providertx.cpp
  • src/validation.cpp
  • src/rpc/mining.cpp
  • src/evo/specialtxman.cpp
  • src/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.h
  • src/evo/deterministicmns.h
  • src/rpc/evo.cpp
  • src/governance/governance.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/evo/cbtx.cpp
  • src/evo/providertx.cpp
  • src/evo/specialtxman.cpp
  • src/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.h
  • src/node/interfaces.cpp
  • src/interfaces/node.h
  • src/node/chainstate.cpp
  • src/evo/deterministicmns.h
  • src/coinjoin/client.cpp
  • src/qt/clientmodel.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/rpc/masternode.cpp
  • src/qt/clientmodel.h
  • src/qt/governancelist.cpp
  • src/llmq/dkgsession.cpp
  • src/evo/deterministicmns.cpp
  • src/qt/masternodelist.cpp
  • src/qt/rpcconsole.cpp
  • src/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.cpp
  • src/test/evo_trivialvalidation.cpp
  • src/test/evo_utils_tests.cpp
  • src/test/block_reward_reallocation_tests.cpp
  • src/rpc/evo.cpp
  • src/rpc/blockchain.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/rpc/masternode.cpp
  • src/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.cpp
  • src/rpc/blockchain.cpp
  • src/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.h
  • src/instantsend/signing.cpp
  • src/test/evo_utils_tests.cpp
  • src/llmq/quorums.h
  • src/llmq/quorums.cpp
  • src/llmq/blockprocessor.cpp
  • src/rpc/quorums.cpp
  • src/llmq/utils.cpp
  • src/node/miner.cpp
  • src/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.cpp
  • src/llmq/context.cpp
  • src/instantsend/signing.cpp
  • src/instantsend/instantsend.h
  • src/instantsend/signing.h
  • src/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.cpp
  • src/llmq/ehf_signals.cpp
  • src/llmq/commitment.cpp
  • src/instantsend/signing.cpp
  • src/llmq/quorums.h
  • src/llmq/signing_shares.cpp
  • src/llmq/quorums.cpp
  • src/llmq/dkgsessionmgr.cpp
  • src/llmq/blockprocessor.cpp
  • src/rpc/quorums.cpp
  • src/llmq/utils.cpp
  • src/llmq/dkgsessionhandler.cpp
  • src/evo/cbtx.cpp
  • src/validation.cpp
  • src/node/miner.cpp
  • src/llmq/options.cpp
  • src/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.cpp
  • src/chainlock/signing.h
  • src/llmq/commitment.cpp
  • src/evo/smldiff.cpp
  • src/chainlock/chainlock.cpp
  • src/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.cpp
  • src/instantsend/instantsend.h
  • src/llmq/signing_shares.h
  • src/llmq/quorums.h
  • src/llmq/quorums.cpp
  • src/node/chainstate.cpp
  • src/llmq/dkgsession.h
  • src/llmq/utils.cpp
  • src/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.h
  • src/rpc/evo.cpp
  • src/test/evo_deterministicmns_tests.cpp
  • src/evo/specialtxman.cpp
  • src/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.cpp
  • src/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.h
  • src/test/evo_deterministicmns_tests.cpp
  • src/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.cpp
  • src/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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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.

@UdjinM6
Copy link

UdjinM6 commented Nov 4, 2025

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)
Copy link
Collaborator

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

@kwvg kwvg requested review from UdjinM6 and removed request for UdjinM6 November 4, 2025 14:20
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

This pull request has conflicts, please rebase.

1 similar comment
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

This pull request has conflicts, please rebase.

Copy link

@coderabbitai coderabbitai bot left a 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 all Params()-based consensus lookups with m_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 uses m_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 for ChainstateManager.

ChainstateManager is 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 unused CChainState forward if desired).

 class CBlockIndex;
-class CChainState;
+class ChainstateManager;
 class CDataStream;
src/llmq/dkgsession.h (1)

23-340: Forward declare ChainstateManager in this header.

Similar to the InstantSend header, CDKGSession now stores a ChainstateManager reference 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/return std::function, but this header still doesn’t include <functional>. Translation units such as src/evo/deterministicmns.cpp include 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 null ActiveTip() during early startup/sync. Consider guarding ActiveTip() or short‑circuiting when it’s null to avoid a rare crash window.

src/llmq/utils.cpp (1)

210-214: Guard null pprev before asking ChainstateManager.

Line [211]: chainman.IsQuorumTypeEnabled(...) now requires a gsl::not_null, so when pQuorumBaseBlockIndex->pprev is nullptr (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 for ChainstateManager. 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_clsig but later read clhandler.GetBestChainLock() again when setting bestCLSignature (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.

GetCommitmentsFromBlock receives chainman but still uses Params().GetConsensus(). No behavior change, but switching to chainman.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 protected and 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 access

In IsQuorumTypeEnabled(), usage mixes GetConsensus() with direct m_chainparams access. For consistency with the rest of this PR’s deglobalization, consider using GetParams() in place of m_chainparams when reading network ID and consensus fields. Functional behavior unchanged.


1555-1560: Use chainman.GetParams() in GetBlockSubsidy genesis path (deglobalization consistency)

GetBlockSubsidy now takes ChainstateManager, but the genesis-branch still pulls Params() globally. Prefer chainman.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

📥 Commits

Reviewing files that changed from the base of the PR and between c887cff and 4fdbf21.

📒 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.h
  • src/chainlock/signing.h
  • src/test/dynamic_activation_thresholds_tests.cpp
  • src/evo/mnhftx.h
  • src/test/evo_utils_tests.cpp
  • src/qt/clientmodel.h
  • src/llmq/quorums.cpp
  • src/llmq/dkgsessionhandler.cpp
  • src/llmq/dkgsessionhandler.h
  • src/llmq/options.h
  • src/qt/governancelist.cpp
  • src/instantsend/instantsend.cpp
  • src/chainlock/chainlock.h
  • src/llmq/commitment.cpp
  • src/llmq/signing_shares.cpp
  • src/qt/clientmodel.cpp
  • src/llmq/blockprocessor.h
  • src/llmq/quorums.h
  • src/deploymentstatus.h
  • src/rpc/masternode.cpp
  • src/masternode/active/context.cpp
  • src/masternode/payments.cpp
  • src/llmq/dkgsession.cpp
  • src/evo/mnhftx.cpp
  • src/governance/signing.cpp
  • src/node/interfaces.cpp
  • src/rpc/mining.cpp
  • src/chainlock/chainlock.cpp
  • src/evo/deterministicmns.h
  • src/test/util/setup_common.cpp
  • src/evo/cbtx.cpp
  • src/llmq/context.cpp
  • src/interfaces/node.h
  • src/llmq/dkgsessionmgr.cpp
  • src/validation.cpp
  • src/rpc/quorums.cpp
  • src/instantsend/instantsend.h
  • src/llmq/utils.h
  • src/llmq/options.cpp
  • src/evo/specialtxman.cpp
  • src/node/miner.cpp
  • src/evo/deterministicmns.cpp
  • src/llmq/debug.cpp
  • src/qt/masternodelist.cpp
  • src/rpc/blockchain.cpp
  • src/llmq/blockprocessor.cpp
  • src/llmq/utils.cpp
  • src/qt/rpcconsole.cpp
  • src/validation.h
  • src/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.cpp
  • src/test/evo_utils_tests.cpp
  • src/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.h
  • src/masternode/active/context.cpp
  • src/masternode/payments.cpp
  • src/evo/mnhftx.cpp
  • src/evo/deterministicmns.h
  • src/evo/cbtx.cpp
  • src/evo/specialtxman.cpp
  • src/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.h
  • src/evo/mnhftx.h
  • src/llmq/quorums.cpp
  • src/llmq/quorums.h
  • src/llmq/context.cpp
  • src/instantsend/instantsend.h
  • src/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.h
  • src/evo/mnhftx.h
  • src/llmq/quorums.cpp
  • src/llmq/dkgsessionhandler.cpp
  • src/llmq/dkgsessionhandler.h
  • src/llmq/options.h
  • src/llmq/commitment.cpp
  • src/llmq/blockprocessor.h
  • src/llmq/quorums.h
  • src/masternode/active/context.cpp
  • src/llmq/dkgsession.cpp
  • src/evo/mnhftx.cpp
  • src/evo/cbtx.cpp
  • src/llmq/context.cpp
  • src/rpc/quorums.cpp
  • src/llmq/utils.h
  • src/llmq/options.cpp
  • src/evo/specialtxman.cpp
  • src/node/miner.cpp
  • src/llmq/blockprocessor.cpp
  • src/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.h
  • src/instantsend/instantsend.cpp
  • src/llmq/commitment.cpp
  • src/llmq/quorums.h
  • src/chainlock/chainlock.cpp
  • src/node/miner.cpp
  • src/llmq/utils.cpp
  • src/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.h
  • src/instantsend/instantsend.cpp
  • src/llmq/context.cpp
  • src/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.cpp
  • src/rpc/masternode.cpp
  • src/test/util/setup_common.cpp
  • src/qt/masternodelist.cpp
  • src/llmq/utils.cpp
  • src/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.cpp
  • src/rpc/masternode.cpp
  • src/test/util/setup_common.cpp
  • src/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.cpp
  • src/llmq/quorums.cpp
  • src/llmq/options.h
  • src/llmq/quorums.h
  • src/rpc/quorums.cpp
  • src/llmq/options.cpp
  • src/node/miner.cpp
  • src/llmq/blockprocessor.cpp
  • src/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.h
  • src/qt/governancelist.cpp
  • src/qt/clientmodel.cpp
  • src/rpc/masternode.cpp
  • src/llmq/dkgsession.cpp
  • src/node/interfaces.cpp
  • src/evo/deterministicmns.h
  • src/interfaces/node.h
  • src/llmq/utils.h
  • src/evo/deterministicmns.cpp
  • src/qt/masternodelist.cpp
  • src/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.cpp
  • src/llmq/dkgsessionhandler.cpp
  • src/instantsend/instantsend.cpp
  • src/llmq/commitment.cpp
  • src/llmq/signing_shares.cpp
  • src/llmq/quorums.h
  • src/llmq/dkgsession.cpp
  • src/evo/cbtx.cpp
  • src/llmq/dkgsessionmgr.cpp
  • src/validation.cpp
  • src/rpc/quorums.cpp
  • src/llmq/options.cpp
  • src/node/miner.cpp
  • src/llmq/blockprocessor.cpp
  • src/llmq/utils.cpp
  • src/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.h
  • src/evo/mnhftx.cpp
  • src/rpc/mining.cpp
  • src/node/miner.cpp
  • src/llmq/blockprocessor.cpp
  • src/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.h
  • src/evo/mnhftx.cpp
  • src/rpc/mining.cpp
  • src/evo/cbtx.cpp
  • src/validation.cpp
  • src/evo/specialtxman.cpp
  • src/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.cpp
  • src/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.h
  • src/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.h
  • src/evo/cbtx.cpp
  • src/evo/specialtxman.cpp
  • src/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.h
  • src/evo/specialtxman.cpp
  • src/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.cpp
  • src/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

Comment on lines +280 to 283
if (blockIndex->nHeight + dkgInterval < m_chainman.ActiveHeight()) {
nSignHeight = blockIndex->nHeight + dkgInterval - 1;
}
// For RegTest non-rotating quorum cycleHash has directly quorum hash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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.

PastaPastaPasta added a commit that referenced this pull request Nov 4, 2025
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
Copy link

@coderabbitai coderabbitai bot left a 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> for std::function.

This header now relies on std::function (see the updated ForEachMN* 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 height

Keep 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 with m_chainman.GetParams().CreditPoolPeriodBlocks().

Also applies to: 179-187

src/evo/specialtxman.cpp (1)

70-83: Defensive bounds check for bestCLHeightDiff to avoid invalid GetAncestor

A malformed cbTx can make curBlockCoinbaseCLHeight negative; 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() returns const COutPoint&, but COutPoint isn’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 negative

The subtraction pindexPrev->nHeight - best_clsig.getHeight() can underflow if best_clsig.getHeight() > pindexPrev->nHeight. While ChainLock semantics suggest heights should be ≤ current block height, the ChainLockSig constructor and ProcessNewChainLock() 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 DeploymentActiveAfter expects (const Consensus::Params&, …, VersionBitsCache&) but this code passes (pindexPrev, m_chainman, Consensus::DEPLOYMENT_V20). Similar patterns appear at lines 333, 343, and 362 with DeploymentActiveAt.

Please confirm that:

  1. The DeploymentActiveAfter/DeploymentActiveAt signatures have been updated to accept ChainstateManager in this PR
  2. 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: Hold cs_main before calling ActiveHeight()

ChainstateManager::ActiveHeight() asserts cs_main is 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 grab cs_main (e.g., via WITH_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 missing ChainstateManager forward declaration

ChainstateManager is referenced here but the header never declares or includes the type, so any translation unit that pulls in llmq/quorums.h before <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 precondition

GetMaxFromDeployment 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 clarity

The 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 above

Apply 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-instance

Per-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_cache capacity is derived from chainman at 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 CCreditPoolManager so it’s per-chainman.
  • Verify that this codepath is never hit with different ChainstateManager instances in one process (e.g., unit/functional tests).
src/node/miner.cpp (1)

128-131: Prefer consensus from chainman for consistency

Minor 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

Comment on lines +147 to 154
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;
Copy link

@coderabbitai coderabbitai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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).

Copy link

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".

Copy link

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.

Comment on lines +284 to 298
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);
}
Copy link

@coderabbitai coderabbitai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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;

Copy link

@UdjinM6 UdjinM6 Nov 4, 2025

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.

Copy link

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.

Comment on lines 16 to 18
const auto chainParams = CreateChainParams(*m_node.args, CBaseChainParams::MAIN);
const auto& chainman = *Assert(m_node.chainman);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Comment on lines 36 to 38
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) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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.

@kwvg kwvg marked this pull request as draft November 4, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants