Skip to content

refactor: move ChainLocks impl. to src/chainlocks/ and split masternode logic out of manager source #6761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Jul 17, 2025

Additional Information

A continuation of dash#6742, this pull request extends the same refactoring to ChainLocks, separating its masternode mode functionality to a dedicated signer object and migrating some definitions to the newly created chainlocks namespace.

Changes are mostly move-only except for decoupling, which should be behavior-identical.

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 (note: N/A)
  • 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 milestone Jul 17, 2025
Copy link

This pull request has conflicts, please rebase.

Copy link

github-actions bot commented Jul 18, 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.

@kwvg kwvg marked this pull request as ready for review July 21, 2025 11:56
@kwvg kwvg requested review from knst, UdjinM6 and PastaPastaPasta July 21, 2025 11:56
Copy link

coderabbitai bot commented Jul 21, 2025

Walkthrough

This change set refactors the ChainLocks implementation by moving related source and header files from the llmq directory to a new chainlocks directory, updating all references throughout the codebase accordingly. The core ChainLocks logic is modularized: the signing logic is moved into a new ChainLockSigner class, with corresponding new files (signing.cpp, signing.h, clsig.cpp, clsig.h). The CChainLockSig type is replaced by chainlocks::ChainLockSig in all interfaces, method signatures, and notification handlers. Legacy files llmq/clsig.h and llmq/clsig.cpp are removed. All affected files, including RPC, wallet, ZMQ, validation, mining, and notification components, are updated to use the new namespace and types. The build system is updated to reflect the new file organization. Test and lint scripts are updated to accommodate the new file structure and dependencies.

Estimated code review effort

4 (60–120 minutes)
This refactor is broad in scope, affecting many files and interfaces, with high-complexity changes in the core ChainLocks logic and its modularization. The review will require careful attention to interface changes, thread safety, and correctness of the new modular structure, as well as verification that all references and notifications are updated consistently throughout the codebase.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2039a8d and 68d3c6b.

📒 Files selected for processing (5)
  • src/chainlocks/chainlocks.cpp (12 hunks)
  • src/chainlocks/chainlocks.h (3 hunks)
  • src/chainlocks/signing.cpp (1 hunks)
  • src/chainlocks/signing.h (1 hunks)
  • test/lint/lint-circular-dependencies.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/lint/lint-circular-dependencies.py
🧰 Additional context used
📓 Path-based instructions (1)
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/chainlocks/signing.cpp
  • src/chainlocks/signing.h
  • src/chainlocks/chainlocks.h
  • src/chainlocks/chainlocks.cpp
🧠 Learnings (3)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#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: kwvg
PR: dashpay/dash#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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : 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
Learnt from: kwvg
PR: dashpay/dash#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.
src/chainlocks/chainlocks.h (4)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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: kwvg
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.

Learnt from: kwvg
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.

src/chainlocks/chainlocks.cpp (11)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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
PR: #6529
File: src/rpc/governance.cpp:1074-1089
Timestamp: 2025-02-14T15:15:58.165Z
Learning: Code blocks marked with // clang-format off and // clang-format on directives should be excluded from clang-format suggestions as they are intentionally formatted manually for better readability.

Learnt from: kwvg
PR: #6729
File: src/rpc/evo.cpp:1273-1273
Timestamp: 2025-07-09T15:05:36.250Z
Learning: When clang-format suggestions significantly harm readability (like splitting logical parameter groups across multiple lines), it's acceptable to use // clang-format off and // clang-format on directives to exclude the problematic section from automatic formatting, prioritizing code readability over strict line length compliance.

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: kwvg
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.

Learnt from: knst
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
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.

Learnt from: knst
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.

Learnt from: kwvg
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.

🪛 GitHub Actions: Clang Diff Format Check
src/chainlocks/chainlocks.cpp

[error] 39-50: Clang format differences found. Code formatting does not match clang-format style. Please run clang-format to fix.

⏰ 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). (7)
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
🔇 Additional comments (19)
src/chainlocks/signing.cpp (8)

18-31: LGTM! Constructor properly initializes all member references.

The member initialization list follows best practices and the defaulted destructor is appropriate for this class.


32-41: Clean lifecycle management implementation.

The Start/Stop methods correctly manage the recovered signatures listener registration.


42-142: Well-structured chain tip signing logic with proper safety checks.

The method correctly validates preconditions, implements transaction safety checks for InstantSend, and maintains thread safety with appropriate locking.


144-150: Thread-safe map cleanup method.

Proper lock assertions and acquisition ensure thread safety.


151-168: Correctly implements block transaction tracking.

The method properly handles empty blocks and filters non-lockable transactions. The comment clearly explains why empty entries are created.


169-216: Robust block transaction retrieval with proper fallback.

The method correctly handles cache misses by reading from disk and maintains consistency across multiple data structures.


217-240: Correct recovered signature handling.

The method properly validates that the recovered signature matches what was signed and creates a ChainLockSig when appropriate.


241-259: Efficient cleanup implementation.

The cleanup method correctly removes transactions for chainlocked blocks and handles conflicting chainlocks appropriately.

src/chainlocks/signing.h (2)

23-36: Well-designed abstract interface for chain lock signing parent.

The interface provides a clean separation of concerns with appropriate pure virtual methods and a virtual destructor.


37-87: Excellent thread-safe class design with proper annotations.

The class correctly uses thread safety annotations, [[nodiscard]] attributes, and provides a clear public interface. The BlockHasher implementation efficiently handles uint256 hashing.

src/chainlocks/chainlocks.h (3)

5-6: Include guards and type definitions properly updated.

The header guards correctly reflect the new file location, and moving NodeId outside the llmq namespace is appropriate for its usage in the chainlocks namespace.

Also applies to: 31-32


40-84: Clean refactoring with proper delegation pattern.

The class correctly inherits from ChainLockSignerParent and delegates signing responsibilities to m_signer. The type changes from llmq::CChainLockSig to chainlocks::ChainLockSig are consistent throughout.


97-108: Override methods properly implement parent interface.

The override methods are correctly marked and maintain thread safety annotations. The separation of signing logic into ChainLockSigner improves modularity.

src/chainlocks/chainlocks.cpp (6)

47-62: Constructor correctly implements conditional signer creation.

The use of std::make_unique and conditional creation based on is_masternode properly implements the delegation pattern.


70-92: Lifecycle methods properly delegate to signer.

The Start/Stop methods correctly check for m_signer existence before delegating, maintaining backward compatibility for non-masternode instances.


119-127: New interface method correctly implemented.

The UpdateTxFirstSeenMap override properly maintains thread safety and updates the transaction timing map.


262-290: Block event handlers correctly delegate to signer.

The methods properly maintain existing transaction timing while delegating block transaction tracking to the signer.


451-460: Cleanup delegation properly integrated.

The method correctly delegates block transaction cleanup to the signer and removes the corresponding entries from txFirstSeenTime.


370-376: Type and namespace changes properly implemented.

The transition from llmq::CChainLockSig to chainlocks::ChainLockSig is consistent, and the namespace organization improves code modularity.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 2

🔭 Outside diff range comments (1)
src/rpc/blockchain.cpp (1)

254-261: Doc/implementation mismatch: returns “blockhash”, spec says “hash”

The RPC result declaration advertises a hash field, but the implementation serialises under blockhash (lines 278-281). This breaks API-contract guarantees and existing clients that rely on the help-text.

@@
-                {RPCResult::Type::STR_HEX, "hash", "The block hash hex-encoded"},
+                {RPCResult::Type::STR_HEX, "blockhash", "The block hash hex-encoded"},

(or rename the pushKV key to "hash").

Please align the two before merging.

Also applies to: 278-281

🧹 Nitpick comments (4)
src/test/miner_tests.cpp (1)

21-27: Possible superfluous include <instantsend/instantsend.h>
The test file does not appear to reference any InstantSend symbols. Consider dropping the include to keep compile times lean and avoid unnecessary dependencies.

-#include <instantsend/instantsend.h>
src/rpc/blockchain.cpp (2)

51-52: Consider a lighter-weight include

chainlocks/chainlocks.h pulls in the full handler implementation even though this TU only needs the ChainLockSig declaration. A forward declaration (or including chainlocks/clsig.h) would be enough and keeps rebuilds faster.

-#include <chainlocks/chainlocks.h>
+// Only need the signature type here – use the smaller header
+#include <chainlocks/clsig.h>

270-272: Namespace churn – hide with auto

The local variable’s type just flipped from llmq::CChainLockSig to chainlocks::ChainLockSig. Using auto here would insulate call-sites from further namespace relocations and reduce diff noise next time:

-    const chainlocks::ChainLockSig clsig = llmq_ctx.clhandler->GetBestChainLock();
+    const auto clsig = llmq_ctx.clhandler->GetBestChainLock();
src/chainlocks/signing.h (1)

24-46: Consider consolidating the multiple private sections.

The class has three separate private: sections (lines 24, 32, 39). This could be simplified by grouping all private members together for better readability.

 private:
     CChainState& m_chainstate;
     llmq::CChainLocksHandler& m_clhandler;
     llmq::CSigningManager& m_sigman;
     llmq::CSigSharesManager& m_shareman;
     CSporkManager& m_sporkman;
     const CMasternodeSync& m_mn_sync;

-private:
     // We keep track of txids from recently received blocks so that we can check if all TXs got islocked
     struct BlockHasher {
         size_t operator()(const uint256& hash) const { return ReadLE64(hash.begin()); }
     };
     using BlockTxs = std::unordered_map<uint256, std::shared_ptr<std::unordered_set<uint256, StaticSaltedHasher>>, BlockHasher>;

-private:
     mutable Mutex cs_signer;

     BlockTxs blockTxs GUARDED_BY(cs_signer);
     int32_t lastSignedHeight GUARDED_BY(cs_signer){-1};
     uint256 lastSignedRequestId GUARDED_BY(cs_signer);
     uint256 lastSignedMsgHash GUARDED_BY(cs_signer);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54c5f63 and 2039a8d.

📒 Files selected for processing (43)
  • src/Makefile.am (2 hunks)
  • src/bench/rpc_blockchain.cpp (1 hunks)
  • src/chainlocks/chainlocks.cpp (11 hunks)
  • src/chainlocks/chainlocks.h (4 hunks)
  • src/chainlocks/clsig.cpp (1 hunks)
  • src/chainlocks/clsig.h (1 hunks)
  • src/chainlocks/signing.cpp (1 hunks)
  • src/chainlocks/signing.h (1 hunks)
  • src/coinjoin/coinjoin.cpp (1 hunks)
  • src/dsnotificationinterface.cpp (2 hunks)
  • src/dsnotificationinterface.h (1 hunks)
  • src/evo/chainhelper.cpp (1 hunks)
  • src/evo/specialtxman.cpp (2 hunks)
  • src/instantsend/instantsend.cpp (1 hunks)
  • src/instantsend/signing.cpp (1 hunks)
  • src/interfaces/chain.h (2 hunks)
  • src/llmq/clsig.cpp (0 hunks)
  • src/llmq/clsig.h (0 hunks)
  • src/llmq/context.cpp (1 hunks)
  • src/net_processing.cpp (3 hunks)
  • src/node/interfaces.cpp (2 hunks)
  • src/node/miner.cpp (2 hunks)
  • src/rest.cpp (1 hunks)
  • src/rpc/blockchain.cpp (2 hunks)
  • src/rpc/mining.cpp (1 hunks)
  • src/rpc/quorums.cpp (4 hunks)
  • src/rpc/rawtransaction.cpp (1 hunks)
  • src/test/fuzz/process_message.cpp (0 hunks)
  • src/test/miner_tests.cpp (1 hunks)
  • src/validation.cpp (1 hunks)
  • src/validationinterface.cpp (1 hunks)
  • src/validationinterface.h (3 hunks)
  • src/wallet/rpc/wallet.cpp (0 hunks)
  • src/wallet/wallet.cpp (1 hunks)
  • src/wallet/wallet.h (1 hunks)
  • src/zmq/zmqabstractnotifier.cpp (1 hunks)
  • src/zmq/zmqabstractnotifier.h (2 hunks)
  • src/zmq/zmqnotificationinterface.cpp (1 hunks)
  • src/zmq/zmqnotificationinterface.h (1 hunks)
  • src/zmq/zmqpublishnotifier.cpp (4 hunks)
  • src/zmq/zmqpublishnotifier.h (2 hunks)
  • test/lint/lint-circular-dependencies.py (1 hunks)
  • test/util/data/non-backported.txt (1 hunks)
💤 Files with no reviewable changes (4)
  • src/test/fuzz/process_message.cpp
  • src/wallet/rpc/wallet.cpp
  • src/llmq/clsig.h
  • src/llmq/clsig.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/llmq/context.cpp
  • src/rest.cpp
  • src/instantsend/signing.cpp
  • src/bench/rpc_blockchain.cpp
  • src/instantsend/instantsend.cpp
  • src/rpc/mining.cpp
  • src/test/miner_tests.cpp
  • src/evo/chainhelper.cpp
  • src/rpc/rawtransaction.cpp
  • src/coinjoin/coinjoin.cpp
  • src/validationinterface.cpp
  • src/node/miner.cpp
  • src/evo/specialtxman.cpp
  • src/zmq/zmqabstractnotifier.cpp
  • src/wallet/wallet.h
  • src/zmq/zmqnotificationinterface.cpp
  • src/zmq/zmqnotificationinterface.h
  • src/rpc/quorums.cpp
  • src/chainlocks/clsig.cpp
  • src/dsnotificationinterface.cpp
  • src/zmq/zmqabstractnotifier.h
  • src/dsnotificationinterface.h
  • src/interfaces/chain.h
  • src/rpc/blockchain.cpp
  • src/node/interfaces.cpp
  • src/validationinterface.h
  • src/zmq/zmqpublishnotifier.h
  • src/chainlocks/clsig.h
  • src/wallet/wallet.cpp
  • src/net_processing.cpp
  • src/validation.cpp
  • src/chainlocks/signing.cpp
  • src/zmq/zmqpublishnotifier.cpp
  • src/chainlocks/signing.h
  • src/chainlocks/chainlocks.h
  • src/chainlocks/chainlocks.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/rpc_blockchain.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/{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/chainhelper.cpp
  • src/evo/specialtxman.cpp
🧠 Learnings (30)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#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: kwvg
PR: dashpay/dash#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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : 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
Learnt from: kwvg
PR: dashpay/dash#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.
src/llmq/context.cpp (1)

Learnt from: kwvg
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.

src/rest.cpp (1)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/instantsend/signing.cpp (3)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

src/bench/rpc_blockchain.cpp (4)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/bench/**/*.{cpp,h,cc,cxx,hpp} : Performance benchmarks should be placed in src/bench/ and use nanobench

src/instantsend/instantsend.cpp (3)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: kwvg
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.

src/rpc/mining.cpp (2)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

src/test/miner_tests.cpp (6)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : 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

Learnt from: kwvg
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
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

test/util/data/non-backported.txt (8)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : 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

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/crypto/{ctaes,x11}/** : Do not make changes under any circumstances to vendored dependencies in src/crypto/ctaes and src/crypto/x11

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to 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

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/**/*.{cpp,h,cc,cxx,hpp} : Dash uses unordered_lru_cache for efficient caching with LRU eviction

src/evo/chainhelper.cpp (1)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/rpc/rawtransaction.cpp (4)

Learnt from: kwvg
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: kwvg
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.

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/coinjoin/coinjoin.cpp (4)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : 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

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/node/miner.cpp (6)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

Learnt from: kwvg
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.

Learnt from: kwvg
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.

src/evo/specialtxman.cpp (5)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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
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.

test/lint/lint-circular-dependencies.py (1)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

src/rpc/quorums.cpp (4)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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
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
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.

src/dsnotificationinterface.cpp (2)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/zmq/zmqabstractnotifier.h (1)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/Makefile.am (5)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : 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

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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.

src/interfaces/chain.h (2)

Learnt from: kwvg
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.

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/rpc/blockchain.cpp (5)

Learnt from: kwvg
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: kwvg
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.

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

Learnt from: kwvg
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.

src/node/interfaces.cpp (2)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: kwvg
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.

src/validationinterface.h (1)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/wallet/wallet.cpp (1)

Learnt from: kwvg
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.

src/net_processing.cpp (2)

Learnt from: kwvg
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/validation.cpp (4)

Learnt from: kwvg
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.

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.777Z
Learning: Applies to src/{crc32c,dashbls,gsl,immer,leveldb,minisketch,secp256k1,univalue}/** : Do not make changes under any circumstances to vendored dependencies in src/crc32c, src/dashbls, src/gsl, src/immer, src/leveldb, src/minisketch, src/secp256k1, src/univalue

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/evo/specialtx.h : Special transactions use payload extensions defined in src/evo/specialtx.h

src/zmq/zmqpublishnotifier.cpp (1)

Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-20T18:42:49.778Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety

src/chainlocks/signing.h (1)

Learnt from: knst
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.

src/chainlocks/chainlocks.h (3)

Learnt from: kwvg
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: kwvg
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.

Learnt from: kwvg
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.

src/chainlocks/chainlocks.cpp (6)

Learnt from: kwvg
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: kwvg
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.

Learnt from: kwvg
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.

Learnt from: knst
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: knst
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.

Learnt from: kwvg
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.

🧬 Code Graph Analysis (11)
src/validationinterface.cpp (5)
src/dsnotificationinterface.cpp (2)
  • NotifyChainLock (148-155)
  • NotifyChainLock (148-149)
src/zmq/zmqabstractnotifier.cpp (2)
  • NotifyChainLock (21-24)
  • NotifyChainLock (21-21)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyChainLock (160-165)
  • NotifyChainLock (160-160)
src/zmq/zmqpublishnotifier.cpp (6)
  • NotifyChainLock (235-243)
  • NotifyChainLock (235-235)
  • NotifyChainLock (325-344)
  • NotifyChainLock (325-325)
  • NotifyChainLock (346-366)
  • NotifyChainLock (346-346)
src/instantsend/instantsend.cpp (2)
  • NotifyChainLock (627-630)
  • NotifyChainLock (627-627)
src/evo/specialtxman.cpp (1)
src/chainlocks/clsig.cpp (3)
  • ChainLockSig (12-12)
  • ChainLockSig (13-13)
  • ChainLockSig (15-20)
src/zmq/zmqabstractnotifier.cpp (3)
src/dsnotificationinterface.cpp (2)
  • NotifyChainLock (148-155)
  • NotifyChainLock (148-149)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyChainLock (160-165)
  • NotifyChainLock (160-160)
src/zmq/zmqpublishnotifier.cpp (6)
  • NotifyChainLock (235-243)
  • NotifyChainLock (235-235)
  • NotifyChainLock (325-344)
  • NotifyChainLock (325-325)
  • NotifyChainLock (346-366)
  • NotifyChainLock (346-346)
src/wallet/wallet.h (5)
src/wallet/wallet.cpp (2)
  • notifyChainLock (3458-3461)
  • notifyChainLock (3458-3458)
src/chainlocks/clsig.h (1)
  • chainlocks (15-40)
src/interfaces/chain.h (1)
  • chainlocks (34-36)
src/validationinterface.h (1)
  • chainlocks (28-30)
src/zmq/zmqabstractnotifier.h (1)
  • chainlocks (17-19)
src/zmq/zmqnotificationinterface.cpp (4)
src/dsnotificationinterface.cpp (2)
  • NotifyChainLock (148-155)
  • NotifyChainLock (148-149)
src/validationinterface.cpp (2)
  • NotifyChainLock (280-287)
  • NotifyChainLock (280-280)
src/zmq/zmqabstractnotifier.cpp (2)
  • NotifyChainLock (21-24)
  • NotifyChainLock (21-21)
src/zmq/zmqpublishnotifier.cpp (6)
  • NotifyChainLock (235-243)
  • NotifyChainLock (235-235)
  • NotifyChainLock (325-344)
  • NotifyChainLock (325-325)
  • NotifyChainLock (346-366)
  • NotifyChainLock (346-346)
src/rpc/quorums.cpp (1)
src/chainlocks/clsig.cpp (3)
  • ChainLockSig (12-12)
  • ChainLockSig (13-13)
  • ChainLockSig (15-20)
src/chainlocks/clsig.cpp (1)
src/evo/mnhftx.h (1)
  • sig (36-36)
src/validationinterface.h (7)
src/chainlocks/clsig.h (1)
  • chainlocks (15-40)
src/zmq/zmqabstractnotifier.h (1)
  • chainlocks (17-19)
src/dsnotificationinterface.cpp (2)
  • NotifyChainLock (148-155)
  • NotifyChainLock (148-149)
src/validationinterface.cpp (2)
  • NotifyChainLock (280-287)
  • NotifyChainLock (280-280)
src/zmq/zmqabstractnotifier.cpp (2)
  • NotifyChainLock (21-24)
  • NotifyChainLock (21-21)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyChainLock (160-165)
  • NotifyChainLock (160-160)
src/zmq/zmqpublishnotifier.cpp (6)
  • NotifyChainLock (235-243)
  • NotifyChainLock (235-235)
  • NotifyChainLock (325-344)
  • NotifyChainLock (325-325)
  • NotifyChainLock (346-366)
  • NotifyChainLock (346-346)
src/wallet/wallet.cpp (1)
src/node/interfaces.cpp (2)
  • pindexChainLock (656-659)
  • pindexChainLock (656-656)
src/zmq/zmqpublishnotifier.cpp (4)
src/dsnotificationinterface.cpp (2)
  • NotifyChainLock (148-155)
  • NotifyChainLock (148-149)
src/validationinterface.cpp (2)
  • NotifyChainLock (280-287)
  • NotifyChainLock (280-280)
src/zmq/zmqabstractnotifier.cpp (2)
  • NotifyChainLock (21-24)
  • NotifyChainLock (21-21)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyChainLock (160-165)
  • NotifyChainLock (160-160)
src/chainlocks/chainlocks.h (5)
src/chainlocks/clsig.h (2)
  • chainlocks (15-40)
  • nodiscard (31-33)
src/interfaces/chain.h (1)
  • chainlocks (34-36)
src/validationinterface.h (2)
  • chainlocks (28-30)
  • llmq (37-39)
src/chainlocks/signing.h (2)
  • ChainLockSigner (22-72)
  • llmq (13-19)
src/chainlocks/chainlocks.cpp (20)
  • CChainLocksHandler (48-63)
  • CChainLocksHandler (65-69)
  • GetChainLockByHash (101-112)
  • GetChainLockByHash (101-101)
  • GetBestChainLock (114-118)
  • GetBestChainLock (114-114)
  • UpdateTxFirstSeenMap (120-127)
  • UpdateTxFirstSeenMap (120-120)
  • ProcessNewChainLock (129-194)
  • ProcessNewChainLock (129-130)
  • VerifyChainLock (371-377)
  • VerifyChainLock (371-371)
  • GetBestChainLockHeight (293-298)
  • GetBestChainLockHeight (293-293)
  • IsTxSafeForMining (300-312)
  • IsTxSafeForMining (300-300)
  • Cleanup (430-481)
  • Cleanup (430-430)
  • AreChainLocksEnabled (43-46)
  • AreChainLocksEnabled (43-43)
🪛 GitHub Actions: Clang Diff Format Check
src/chainlocks/chainlocks.cpp

[error] 40-40: Clang format differences found. Code style does not match clang-format rules. Please run clang-format to fix formatting issues.

⏰ 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). (1)
  • GitHub Check: linux64_ubsan-test / Test source
🔇 Additional comments (72)
src/llmq/context.cpp (1)

10-10: Include path correctly updated to new chainlocks location

The switch to <chainlocks/chainlocks.h> aligns with the new directory structure introduced in this PR and maintains consistency with the namespace move. No further action needed.

src/bench/rpc_blockchain.cpp (1)

8-8: Include path update aligns with refactor effort – no issues spotted

The header reference has been correctly migrated to the new chainlocks directory. Build should continue to succeed as no other code changes are required here. Good job keeping the benchmark in sync with the namespace move.

src/validation.cpp (1)

53-53: No namespace inconsistency—no changes required

The new header at src/chainlocks/chainlocks.h still declares CChainLocksHandler inside namespace llmq (lines 34–110), so all existing uses of llmq::CChainLocksHandler remain valid. You can safely ignore the suggestion to rename or add aliases.

Likely an incorrect or invalid review comment.

src/rest.cpp (1)

9-9: LGTM! Include path updated correctly.

The include path change from <llmq/chainlocks.h> to <chainlocks/chainlocks.h> correctly reflects the ChainLocks refactoring that moves the implementation to a dedicated chainlocks directory.

src/evo/chainhelper.cpp (1)

9-9: LGTM! Include path updated correctly.

The include path change from <llmq/chainlocks.h> to <chainlocks/chainlocks.h> correctly reflects the ChainLocks refactoring and maintains existing functionality.

src/instantsend/signing.cpp (1)

14-14: LGTM! Include path updated correctly.

The include path change from <llmq/chainlocks.h> to <chainlocks/chainlocks.h> correctly aligns with the ChainLocks refactoring that moves the implementation to the chainlocks directory.

test/util/data/non-backported.txt (1)

7-8: LGTM! Non-backported files correctly updated.

The addition of src/chainlocks/*.cpp and src/chainlocks/*.h to the non-backported list is appropriate, as ChainLocks is Dash-specific functionality that wouldn't be backported to Bitcoin Core. The entries are correctly placed alphabetically in the list.

src/rpc/rawtransaction.cpp (1)

51-51: Include path update verified – no stale <llmq/chainlocks.h> includes found

Ran rg -n '<llmq/chainlocks\.h>' against the codebase and confirmed zero matches. No further action required.

src/instantsend/instantsend.cpp (2)

16-17: Include path correctly updated to new ChainLocks location
Header moved from llmq/ to chainlocks/, matches the namespace refactor. No further action required.


21-23: Re-ordering of stats/client include is benign
Pure include-order change, does not affect semantics.

src/rpc/mining.cpp (1)

8-9: Header path switched to chainlocks/chainlocks.h — looks good
Aligns RPC mining code with the new module layout.

src/coinjoin/coinjoin.cpp (1)

18-24: LGTM: Clean include reorganization for ChainLocks refactoring.

The reorganization of includes aligns well with the PR's objective of moving ChainLocks from the llmq namespace to a dedicated chainlocks namespace and directory. The grouping is logical and maintains consistent organization.

test/lint/lint-circular-dependencies.py (1)

28-33: LGTM: Proper maintenance of circular dependency expectations.

The addition of these circular dependencies for the new chainlocks module is expected and necessary given the refactoring from llmq/chainlocks to the dedicated chainlocks namespace and directory. The dependencies accurately reflect the interactions between the new chainlocks modules and existing components.

src/node/miner.cpp (2)

27-27: LGTM: Include path updated for ChainLocks refactoring.

The include path change from llmq/chainlocks.h to chainlocks/chainlocks.h properly reflects the module migration to the dedicated chainlocks directory.


130-130: LGTM: Namespace updated for ChainLockSig type.

The type change from llmq::CChainLockSig{} to chainlocks::ChainLockSig{} correctly implements the namespace migration while preserving identical functionality for creating an empty chainlock signature.

src/evo/specialtxman.cpp (2)

11-17: LGTM: Include reorganization for ChainLocks refactoring.

The include updates properly reflect the migration of ChainLocks code from the llmq namespace to the dedicated chainlocks namespace and directory. The addition of chainlocks/chainlocks.h and chainlocks/clsig.h replaces the previous llmq includes.


82-82: LGTM: Namespace updated for ChainLockSig constructor.

The type change from llmq::CChainLockSig to chainlocks::ChainLockSig correctly implements the namespace migration. The constructor parameters (height, block hash, signature) match the expected signature for the new chainlocks::ChainLockSig class.

src/zmq/zmqabstractnotifier.cpp (1)

21-21: LGTM: Parameter type updated for ChainLocks refactoring.

The parameter type change from std::shared_ptr<const llmq::CChainLockSig> to std::shared_ptr<const chainlocks::ChainLockSig> correctly implements the namespace migration and maintains consistency with all concrete ZMQ notifier implementations that use the new chainlocks::ChainLockSig type.

src/dsnotificationinterface.cpp (2)

17-17: LGTM - Include path updated correctly for refactoring.

The include path change from llmq/chainlocks.h to chainlocks/chainlocks.h correctly reflects the relocation of ChainLocks code to the dedicated chainlocks directory.


148-149: LGTM - Parameter type correctly updated for namespace change.

The parameter type change from std::shared_ptr<const llmq::CChainLockSig> to std::shared_ptr<const chainlocks::ChainLockSig> correctly reflects the movement of the ChainLockSig class to the new chainlocks namespace while preserving the method's functionality.

src/rpc/quorums.cpp (2)

17-17: LGTM - Include updates support the refactoring correctly.

The include changes appropriately update dependencies:

  • Adding chainlocks/chainlocks.h provides access to the new chainlocks::ChainLockSig type
  • The masternode/node.h include reordering maintains necessary dependencies while accommodating the new structure

Also applies to: 30-30


1024-1025: LGTM - Type usage correctly updated for new namespace.

The type changes from llmq::CChainLockSig to chainlocks::ChainLockSig correctly use the new namespace while maintaining identical functionality in the RPC commands. The constructor calls match the signature defined in the new chainlocks/clsig.cpp.

Also applies to: 1136-1136

src/dsnotificationinterface.h (1)

49-49: LGTM - Method declaration correctly updated for namespace change.

The parameter type change from std::shared_ptr<const llmq::CChainLockSig> to std::shared_ptr<const chainlocks::ChainLockSig> correctly updates the interface declaration to match the implementation and use the new chainlocks namespace.

src/zmq/zmqnotificationinterface.h (1)

34-34: LGTM! Correct namespace migration.

The method signature correctly updates to use the new chainlocks::ChainLockSig type, consistent with the broader refactoring effort to move ChainLocks functionality from llmq to its dedicated namespace.

src/validationinterface.cpp (1)

280-280: LGTM! Consistent type update for the refactoring.

The method signature correctly updates the parameter type from llmq::CChainLockSig to chainlocks::ChainLockSig, maintaining identical functionality while aligning with the namespace refactoring.

src/wallet/wallet.h (1)

926-926: LGTM! Method signature correctly updated for the refactoring.

The notifyChainLock method signature properly updates to use chainlocks::ChainLockSig, consistent with the broader ChainLocks namespace migration and the implementation in src/wallet/wallet.cpp.

src/Makefile.am (2)

153-155: LGTM! Build configuration correctly updated for the new directory structure.

The header files are properly added for the new chainlocks/ directory, including the new signing.h file for the modularized ChainLock signing functionality.


458-460: LGTM! Source files correctly added for the ChainLocks refactoring.

The build system properly includes the relocated and new ChainLocks source files, including the new signing.cpp that contains the extracted ChainLockSigner class functionality.

src/zmq/zmqnotificationinterface.cpp (1)

160-160: LGTM: Consistent namespace migration

The method signature update from llmq::CChainLockSig to chainlocks::ChainLockSig is consistent with the refactoring objectives and aligns with similar changes across the ZMQ notification system.

src/node/interfaces.cpp (2)

10-10: LGTM: Include path updated for refactored directory structure

The include path change from <llmq/chainlocks.h> to <chainlocks/chainlocks.h> correctly reflects the migration of ChainLocks code to the new directory structure.


656-656: LGTM: Method signature updated for namespace consistency

The parameter type change from llmq::CChainLockSig to chainlocks::ChainLockSig maintains the same interface while using the new namespace, consistent with the refactoring objectives.

src/zmq/zmqabstractnotifier.h (2)

17-19: LGTM: Forward declaration updated for new namespace

The forward declaration of chainlocks::ChainLockSig correctly establishes the new type within the appropriate namespace, supporting the refactored code organization.


73-73: LGTM: Virtual method signature consistently updated

The parameter type change from llmq::CChainLockSig to chainlocks::ChainLockSig in the virtual method correctly updates the base class interface to support the namespace refactoring.

src/net_processing.cpp (3)

62-62: LGTM! Include path correctly updated for refactoring.

The include directive has been properly updated from llmq/chainlocks.h to chainlocks/chainlocks.h, which aligns with the ChainLocks refactoring objective to move the implementation to a dedicated namespace and directory.


5285-5285: Type correctly updated for ChainLocks refactoring.

The variable type has been properly changed from llmq::CChainLockSig to chainlocks::ChainLockSig in the CLSIG message handling code, maintaining consistency with the namespace refactoring while preserving the existing deserialization and processing logic.


2861-2861: GetChainLockByHash Signature Uses New Type
Confirmed that CChainLocksHandler::GetChainLockByHash(const uint256&, chainlocks::ChainLockSig&) is declared in src/chainlocks/chainlocks.h (line 81) and defined in src/chainlocks/chainlocks.cpp (line 101), matching its invocation in src/net_processing.cpp (lines 2861–2862). No references to llmq::CChainLockSig remain.

src/interfaces/chain.h (2)

34-36: Forward declaration correctly moved to chainlocks

Moving the ChainLockSig forward declaration into its own namespace keeps the header lightweight and avoids pulling in heavy includes. Looks good to me.


270-271: No remaining llmq::CChainLockSig overrides – all updated to chainlocks::ChainLockSig

I’ve verified every override of notifyChainLock:

  • src/interfaces/chain.h (virtual signature)
  • src/wallet/wallet.h / wallet.cpp (CWallet implementation)
  • src/node/interfaces.cpp (invocation via m_notifications)

There are no references to the old llmq::CChainLockSig in the codebase. All implementations correctly use std::shared_ptr<const chainlocks::ChainLockSig>.

src/chainlocks/clsig.cpp (5)

1-8: LGTM!

The copyright headers and includes are correct and follow standard conventions.


9-11: LGTM!

The namespace declaration and constant definition follow proper conventions and align with the refactoring objectives.


12-21: LGTM!

The constructors and destructor follow modern C++ best practices with explicit defaulting and efficient member initialization using uniform initialization syntax.


22-26: LGTM!

The ToString() method implementation is clean and follows established patterns in the codebase. Including only the height and block hash (not the signature) is appropriate for readability.


27-27: LGTM!

The namespace closing follows best practices with proper commenting.

src/validationinterface.h (2)

28-30: LGTM!

The forward declaration for chainlocks::ChainLockSig is correctly added and follows the same pattern as other namespace forward declarations in the file.


169-169: LGTM!

The method signature changes consistently update both the virtual interface method and the concrete method declaration to use chainlocks::ChainLockSig, maintaining proper const-correctness with shared_ptr.

Also applies to: 237-237

src/zmq/zmqpublishnotifier.h (3)

48-48: LGTM!

The method signature correctly updates to use chainlocks::ChainLockSig while maintaining the proper shared_ptr pattern.


96-96: LGTM!

The method signature change is consistent with other notifier classes and correctly uses the new chainlocks namespace.


102-102: LGTM!

The method signature change completes the consistent update across all chainlock notifier classes to use the new namespace.

src/zmq/zmqpublishnotifier.cpp (4)

13-13: LGTM!

The include directive correctly updates to use the new chainlocks/clsig.h header, aligning with the file reorganization.


235-235: LGTM!

The method signature correctly updates to use the new namespace while maintaining the existing implementation logic.


325-325: LGTM!

The method signature update is correct and the implementation appropriately publishes raw block data as intended.


346-346: LGTM!

The method signature update is correct and this implementation appropriately uses the clsig parameter to serialize both block and signature data.

src/chainlocks/clsig.h (6)

1-14: LGTM!

The header guards follow proper conventions and includes are minimal and necessary for the class definition.


15-17: LGTM!

The namespace declaration and extern constant declaration follow proper conventions.


18-23: LGTM!

The struct definition with private members is well-designed, using appropriate types and default initialization for the height sentinel value.


24-28: LGTM!

The constructor and destructor declarations are properly designed with efficient parameter passing using const references for complex types.


30-35: LGTM!

The getter methods and utility functions are well-designed with proper const-qualification and [[nodiscard]] attributes. The IsNull() method provides convenient state checking.


36-44: LGTM!

The serialization implementation correctly includes all member variables and the file is properly closed with appropriate comments.

src/chainlocks/signing.h (1)

22-72: Well-structured class with proper thread safety annotations.

The ChainLockSigner class is well-designed with:

  • Clear separation of concerns from the main handler
  • Proper thread safety annotations on all methods
  • Consistent use of EXCLUSIVE_LOCKS_REQUIRED for synchronization
  • Appropriate encapsulation of signing logic
src/chainlocks/signing.cpp (6)

19-32: Constructor and destructor implementation look correct.

The constructor properly initializes all member references using the member initializer list, and the destructor is appropriately defaulted.


43-143: TrySignChainTip implementation correctly handles signing attempts.

The method properly:

  • Validates all preconditions before attempting to sign
  • Maintains thread safety with appropriate locking
  • Implements the transaction safety checks for InstantSend
  • Correctly tracks the last signed height to avoid duplicates

152-168: Block transaction tracking is properly implemented.

The method correctly:

  • Ensures thread safety with proper locking
  • Creates entries even for blocks without lockable transactions (as documented)
  • Filters out coinbase and input-less transactions

170-216: GetBlockTxs correctly implements lazy loading with proper synchronization.

The method properly:

  • Prevents potential deadlocks with lock assertions
  • Implements a cache-first approach with disk fallback
  • Updates the transaction first seen map for newly loaded blocks
  • Handles disk read failures gracefully

218-240: HandleNewRecoveredSig correctly processes signing results.

The method properly validates that the recovered signature matches the last signing attempt and creates a ChainLockSig to be processed by the handler.


242-259: Cleanup method efficiently manages memory by removing obsolete entries.

The implementation correctly:

  • Removes transaction sets for blocks that have chainlocks
  • Removes entries for blocks with conflicting chainlocks
  • Returns the removed transaction sets for caller cleanup
  • Maintains proper lock ordering (cs_main before cs_signer)
src/chainlocks/chainlocks.h (2)

5-8: Header guard and include path updates are correct.

The changes properly reflect the new file location and namespace organization.


41-107: CChainLocksHandler refactoring properly delegates signing logic.

The changes correctly:

  • Add a unique_ptr to ChainLockSigner for masternode-specific functionality
  • Update all method signatures to use chainlocks::ChainLockSig
  • Maintain thread safety annotations throughout
  • Preserve the public interface for compatibility
src/chainlocks/chainlocks.cpp (5)

48-63: Constructor properly implements conditional ChainLockSigner creation.

The implementation correctly creates the ChainLockSigner only for masternodes, which aligns with the PR objective of splitting masternode logic.


71-93: Lifecycle methods correctly handle optional signer.

The Start and Stop methods properly check for the existence of m_signer before delegating calls, ensuring non-masternode instances work correctly.


120-127: UpdateTxFirstSeenMap provides thread-safe transaction timestamp updates.

The method correctly implements the interface for ChainLockSigner to update transaction timestamps with proper locking.


263-291: Block event handlers correctly delegate to signer.

The implementation properly:

  • Maintains transaction timestamp tracking in the handler
  • Delegates block transaction mapping to the signer when present
  • Maintains thread safety with appropriate locking

452-460: Cleanup method properly coordinates with signer.

The implementation correctly delegates block transaction cleanup to the signer and uses the returned transaction sets to clean up the handler's transaction timestamp map.

Comment on lines +35 to +41
namespace llmq {
namespace {
static constexpr int64_t CLEANUP_INTERVAL{1000 * 30};
static constexpr int64_t CLEANUP_SEEN_TIMEOUT{24 * 60 * 60 * 1000};
//! How long to wait for islocks until we consider a block with non-islocked TXs to be safe to sign
static constexpr int64_t WAIT_FOR_ISLOCK_TIMEOUT{10 * 60};
} // anonymous namespace
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix clang-format issue in anonymous namespace.

The pipeline indicates a formatting issue at line 40. Please run clang-format to fix the formatting.

#!/bin/bash
# Description: Check the exact formatting issue by running clang-format on the file

cd src/chainlocks
clang-format --style=file -i chainlocks.cpp
git diff chainlocks.cpp
🧰 Tools
🪛 GitHub Actions: Clang Diff Format Check

[error] 40-40: Clang format differences found. Code style does not match clang-format rules. Please run clang-format to fix formatting issues.

🤖 Prompt for AI Agents
In src/chainlocks/chainlocks.cpp around lines 35 to 41, there is a clang-format
style issue in the anonymous namespace. Run clang-format with the project style
configuration on this file to automatically fix the formatting inconsistencies.
Use the command 'clang-format --style=file -i chainlocks.cpp' inside the
src/chainlocks directory, then verify the changes with 'git diff' to ensure the
formatting is corrected.

Comment on lines +3458 to 3461
void CWallet::notifyChainLock(const CBlockIndex* pindexChainLock, const std::shared_ptr<const chainlocks::ChainLockSig>& clsig)
{
NotifyChainLockReceived(pindexChainLock->nHeight);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Avoid null dereference and silence unused-parameter warning

pindexChainLock is dereferenced with no prior check; if the caller ever passes nullptr the node will crash.
Additionally, clsig is unused, emitting -Wunused-parameter under -Wall.

-void CWallet::notifyChainLock(const CBlockIndex* pindexChainLock, const std::shared_ptr<const chainlocks::ChainLockSig>& clsig)
-{
-    NotifyChainLockReceived(pindexChainLock->nHeight);
-}
+void CWallet::notifyChainLock(const CBlockIndex* pindexChainLock,
+                              const std::shared_ptr<const chainlocks::ChainLockSig>& /*clsig*/)
+{
+    // Prevent undefined behaviour if a bad pointer slips through.
+    CHECK_NONFATAL(pindexChainLock != nullptr);
+
+    NotifyChainLockReceived(pindexChainLock->nHeight);
+}

This keeps behaviour unchanged while hardening the call-site and removes the compiler warning.

📝 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
void CWallet::notifyChainLock(const CBlockIndex* pindexChainLock, const std::shared_ptr<const chainlocks::ChainLockSig>& clsig)
{
NotifyChainLockReceived(pindexChainLock->nHeight);
}
void CWallet::notifyChainLock(const CBlockIndex* pindexChainLock,
const std::shared_ptr<const chainlocks::ChainLockSig>& /*clsig*/)
{
// Prevent undefined behaviour if a bad pointer slips through.
CHECK_NONFATAL(pindexChainLock != nullptr);
NotifyChainLockReceived(pindexChainLock->nHeight);
}
🤖 Prompt for AI Agents
In src/wallet/wallet.cpp around lines 3458 to 3461, add a null check for
pindexChainLock before dereferencing it to prevent potential crashes if nullptr
is passed. Also, to avoid the unused-parameter warning for clsig, explicitly
mark it as unused or omit its name in the function signature. This will maintain
current behavior while improving safety and eliminating compiler warnings.

Comment on lines +19 to +24
#include <bls/bls.h>
#include <chainlocks/chainlocks.h>
#include <governance/common.h>
#include <instantsend/instantsend.h>
#include <masternode/node.h>
#include <masternode/sync.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should not split it to own group IMO, it's not something special here about them

#include <uint256.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <util/time.h>
#include <validation.h>
#include <versionbits.h>

#include <evo/evodb.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

same, why split it?

@@ -6,23 +6,21 @@

#include <tinyformat.h>

namespace llmq {
const std::string CLSIG_REQUESTID_PREFIX = "clsig";
namespace chainlocks {
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider name chainlock.

It's instantsend not instantsends, it's wallet not wallets, etc.

Comment on lines 632 to 640
LOCK(cs);
for (const auto& tx : CleanupSigner()) {
for (const auto& txid : *tx) {
txFirstSeenTime.erase(txid);
}
}

// need mempool.cs due to GetTransaction calls
LOCK2(::cs_main, mempool.cs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it expecting changes to reverse order cs_main & cs vs cs & cs_main ?

@@ -19,11 +20,25 @@ class CSigSharesManager;
} // namespace llmq

namespace chainlocks {
class ChainLockSigner : public llmq::CRecoveredSigsListener
class ChainLockSignerParent
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider ChainlockManager or similar name

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.

2 participants