Skip to content

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Jul 7, 2025

Motivation

Currently, the llmq namespace includes the LLMQ subsystem itself and capabilities built on them, primarily InstantSend and ChainLocks. Both capabilities play a key part in block and validation logic (see CChainHelper passthrough functions, source). Currently, we have to setup all LLMQ infrastructure (i.e. LLMQContext) in order to validate on-disk information.

This ceases to be feasible when extracting validation code that interacts with on-disk state into libbitcoinkernel through bitcoin-chainstate (see bitcoin#24304) as this thinned down library is devoid of networking capabilities.

As LLMQ is inherently an interactive system that is tied to networking capabilities, to extract on-disk state validation logic, we need to separate out networking from non-networking concerns. This pull request is the first step in extracting networking logic by first splitting out the monolithic InstantSend implementation into smaller concerns and then spinning off masternode-mode logic into a dedicated manager.

Future work should aim to spit out non-masternode networking code into a separate concern and eventually thin down llmq::CInstantSendManager to be capable of running with a networking-disabled mode, which would be adequate for libbitcoinkernel.

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 7, 2025
Comment on lines 7 to 22
#include <chainparams.h>
#include <consensus/validation.h>
#include <dbwrapper.h>
#include <index/txindex.h>
#include <masternode/sync.h>
#include <net_processing.h>
#include <node/blockstorage.h>
#include <spork.h>
#include <stats/client.h>
#include <txmempool.h>
#include <util/irange.h>
#include <util/ranges.h>
#include <util/thread.h>
#include <validation.h>

#include <bls/bls_batchverifier.h>
#include <instantsend/lock.h>
#include <llmq/chainlocks.h>
#include <llmq/commitment.h>
#include <llmq/quorums.h>
#include <llmq/signing_shares.h>
#include <masternode/sync.h>
#include <spork.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: let's group all of them together. Before it was like "llmq" and all others; but now instantsend.cpp doesn't belong to this group anymore; they can be all together now

Copy link

This pull request has conflicts, please rebase.

@kwvg kwvg changed the title refactor: move InstantSend implementation to src/instantsend, split islock, database and (master)node logic, spin off signing to instantsend::CSigningManager refactor: move InstantSend impl.to src/instantsend/ and split sources for islock, database and masternode logic out of manager source Jul 15, 2025
@kwvg kwvg marked this pull request as ready for review July 15, 2025 16:12
@kwvg kwvg requested review from knst, UdjinM6 and PastaPastaPasta July 15, 2025 16:12
Copy link

coderabbitai bot commented Jul 15, 2025

Walkthrough

The changes comprehensively refactor the InstantSend module in the codebase. All InstantSend-related source and header files are moved from the llmq/ directory to a new dedicated instantsend/ directory. The previous llmq::CInstantSendLock, CInstantSendDb, and CInstantSendManager classes and related logic are replaced with new implementations under the instantsend namespace, introducing new files: db.h/cpp, lock.h/cpp, signing.h/cpp, and instantsend.h/cpp. All references throughout the codebase, including notifications, RPC, wallet, ZMQ, and tests, are updated to use the new types and namespaces. The build system and circular dependency lists are also updated to reflect the new structure. No functional changes beyond this reorganization and renaming are present.

✨ 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: 6

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

54-56: RPC field name mismatch: “instantsend” vs “instantlock”

MempoolEntryDescription() documents a boolean field named instantsend, but entryToJSON() actually fills instantlock.
Clients relying on the help text will look for the wrong key.

@@
-    RPCResult{RPCResult::Type::BOOL, "instantsend", "True if this transaction was locked via InstantSend"},
+    RPCResult{RPCResult::Type::BOOL, "instantlock", "True if this transaction was locked via InstantSend"},
@@
-    info.pushKV("instantlock", isman ? (isman->IsLocked(tx.GetHash()) ? "true" : "false") : "unknown");
+    info.pushKV("instantlock", isman ? (isman->IsLocked(tx.GetHash()) ? "true" : "false") : "unknown");

Keeping the internal key instantlock (aligned with other RPCs) and updating the help string is the minimal, non-breaking fix.
Please adjust to avoid API confusion before the next release.

Also applies to: 112-114

♻️ Duplicate comments (3)
test/lint/lint-circular-dependencies.py (1)

47-51: The circular dependencies reflect the InstantSend refactoring but could be improved.

The added circular dependencies are consistent with moving InstantSend from the llmq directory to the instantsend directory. However, as noted in the past review comment, introducing circular dependencies is not ideal design.

Consider the suggestion from the past review comment about moving InstantSendStorage to instantsend.h and CInstantSendManager to a separate header like instantsend/is_impl.h to reduce circular dependencies.

#!/bin/bash
# Description: Verify the actual circular dependencies exist in the new structure

# Check for circular dependencies in the instantsend directory
ast-grep --pattern 'instantsend/instantsend'
ast-grep --pattern 'instantsend/signing'
src/instantsend/signing.cpp (1)

63-63: Fix the typo in mutex name (continuation from header file).

The mutex name cs_inputReqests (with typo) is used here. This will be fixed when you correct the typo in the header file.

Also applies to: 87-87, 333-333

src/instantsend/instantsend.cpp (1)

7-23: Group all includes together.

As suggested in the previous review, since instantsend.cpp no longer belongs to the "llmq" group, all includes can be grouped together now.

 #include <chainparams.h>
 #include <consensus/validation.h>
 #include <net_processing.h>
 #include <node/blockstorage.h>
 #include <stats/client.h>
 #include <txmempool.h>
 #include <util/thread.h>
 #include <validation.h>
-
 #include <bls/bls_batchverifier.h>
 #include <instantsend/signing.h>
 #include <llmq/chainlocks.h>
 #include <llmq/commitment.h>
 #include <llmq/quorums.h>
 #include <masternode/sync.h>
 #include <spork.h>
🧹 Nitpick comments (13)
src/test/ratecheck_tests.cpp (1)

2-3: License header year range is stale

The header was just modified, yet the copyright range stops at 2022.
Consider updating to the current year for consistency with other freshly-touched files.

-// Copyright (c) 2014-2022 The Dash Core developers
+// Copyright (c) 2014-2025 The Dash Core developers
src/test/governance_validators_tests.cpp (1)

2-3: Align copyright years

Same nit as in the other test files: adjust the end year to 2025 so newly-edited sources share a uniform header.

-// Copyright (c) 2014-2023 The Dash Core developers
+// Copyright (c) 2014-2025 The Dash Core developers
src/test/cachemap_tests.cpp (1)

2-3: Refresh year in license banner

Update the upper bound of the year range to reflect the 2025 edit.

-// Copyright (c) 2014-2023 The Dash Core developers
+// Copyright (c) 2014-2025 The Dash Core developers
src/evo/chainhelper.cpp (1)

9-10: Remove unused header to avoid unnecessary coupling

lock.h is not referenced anywhere in this translation unit. Dropping the include trims build times and prevents accidental reliance on unrelated InstantSend internals.

-#include <instantsend/instantsend.h>
-#include <instantsend/lock.h>
+#include <instantsend/instantsend.h>
src/txmempool.cpp (1)

28-28: Consider forward-declaring CInstantSendManager instead of including the full header

txmempool.cpp only needs the pointer to llmq::CInstantSendManager (see ConnectManagers).
A forward declaration in txmempool.h plus removing the heavy header here would reduce compile time and dependency churn.

-#include <instantsend/instantsend.h>
+// forward declaration placed in txmempool.h:
+// namespace llmq { class CInstantSendManager; }
src/test/cachemultimap_tests.cpp (1)

1-3: Minor nit — extend copyright year to 2025 for consistency.

Most updated source files now show 2014-2025; consider aligning this header to avoid year drift.

-// Copyright (c) 2014-2023 The Dash Core developers
+// Copyright (c) 2014-2025 The Dash Core developers
src/init.cpp (1)

88-92: Include ordering ‑ consider deferring heavy headers

instantsend/instantsend.h pulls in the full InstantSend manager implementation, although init.cpp only needs the opaque pointer that llmq/context.h already forward-declares. You could avoid an extra compilation dependency (and speed up rebuilds) by dropping this include and relying on the one transitively brought in by llmq/context.h.

If a direct include is preferred for clarity, keep it; otherwise, removing it is safe and trims compile time ever so slightly.

src/wallet/wallet.cpp (1)

3384-3385: Parameter islock is now unused – add [[maybe_unused]] or remove it to silence compiler warnings

The parameter is kept only for interface symmetry but isn’t referenced in the body. With -Wunused-parameter enabled this will trigger a warning. Easiest fix is to mark it [[maybe_unused]]:

-void CWallet::notifyTransactionLock(const CTransactionRef &tx, const std::shared_ptr<const instantsend::InstantSendLock>& islock)
+void CWallet::notifyTransactionLock(const CTransactionRef &tx, [[maybe_unused]] const std::shared_ptr<const instantsend::InstantSendLock>& islock)

(or remove the parameter entirely if no caller needs it).

src/instantsend/instantsend.h (1)

59-59: Consider renaming m_activeman for clarity.

The member variable m_activeman is of type InstantSendSigner, but the name suggests it's an "active manager". Consider renaming it to m_signer or m_is_signer to better reflect its actual type and purpose.

-    std::unique_ptr<instantsend::InstantSendSigner> m_activeman{nullptr};
+    std::unique_ptr<instantsend::InstantSendSigner> m_signer{nullptr};
src/instantsend/db.cpp (2)

12-19: Fix code formatting issues.

The pipeline indicates clang-format differences. Please run clang-format to ensure consistent code style.


124-131: Good defensive programming with the safety check.

The check against going backwards in confirmation height prevents potential issues. However, please fix the formatting issues indicated by the pipeline.

src/instantsend/instantsend.cpp (2)

27-956: Fix extensive code formatting issues.

The pipeline indicates that almost the entire file has formatting differences. Please run clang-format on the entire file to ensure consistent code style.


927-951: Simplify the control flow by removing unnecessary do-while(0) pattern.

The do-while(0) pattern here adds unnecessary complexity. The breaks could be replaced with early returns or proper if-else chains.

-        bool fMoreWork{false};
-        do {
-            if (!IsInstantSendEnabled()) break;
-            fMoreWork = ProcessPendingInstantSendLocks(peerman);
-            if (!m_activeman) break;
-            // Construct set of non-locked transactions that are pending to retry
-            std::vector<CTransactionRef> txns{};
-            {
-                LOCK2(cs_nonLocked, cs_pendingRetry);
-                if (pendingRetryTxs.empty()) break;
-                txns.reserve(pendingRetryTxs.size());
-                for (const auto& txid : pendingRetryTxs) {
-                    if (auto it = nonLockedTxs.find(txid); it != nonLockedTxs.end()) {
-                        const auto& [_, tx_info] = *it;
-                        if (tx_info.tx) {
-                            txns.push_back(tx_info.tx);
-                        }
-                    }
-                }
-                txns.shrink_to_fit();
-            }
-            // Retry processing them
-            m_activeman->ProcessPendingRetryLockTxs(txns);
-        } while (0);
+        bool fMoreWork{false};
+        if (IsInstantSendEnabled()) {
+            fMoreWork = ProcessPendingInstantSendLocks(peerman);
+            if (m_activeman) {
+                // Construct set of non-locked transactions that are pending to retry
+                std::vector<CTransactionRef> txns{};
+                {
+                    LOCK2(cs_nonLocked, cs_pendingRetry);
+                    if (!pendingRetryTxs.empty()) {
+                        txns.reserve(pendingRetryTxs.size());
+                        for (const auto& txid : pendingRetryTxs) {
+                            if (auto it = nonLockedTxs.find(txid); it != nonLockedTxs.end()) {
+                                const auto& [_, tx_info] = *it;
+                                if (tx_info.tx) {
+                                    txns.push_back(tx_info.tx);
+                                }
+                            }
+                        }
+                        txns.shrink_to_fit();
+                    }
+                }
+                // Retry processing them
+                if (!txns.empty()) {
+                    m_activeman->ProcessPendingRetryLockTxs(txns);
+                }
+            }
+        }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9310ebc and 40c7416.

📒 Files selected for processing (48)
  • src/Makefile.am (2 hunks)
  • src/bench/rpc_blockchain.cpp (1 hunks)
  • src/coinjoin/coinjoin.cpp (1 hunks)
  • src/dsnotificationinterface.cpp (1 hunks)
  • src/evo/chainhelper.cpp (1 hunks)
  • src/init.cpp (1 hunks)
  • src/instantsend/db.cpp (1 hunks)
  • src/instantsend/db.h (1 hunks)
  • src/instantsend/instantsend.cpp (20 hunks)
  • src/instantsend/instantsend.h (1 hunks)
  • src/instantsend/lock.cpp (1 hunks)
  • src/instantsend/lock.h (1 hunks)
  • src/instantsend/signing.cpp (1 hunks)
  • src/instantsend/signing.h (1 hunks)
  • src/interfaces/chain.h (2 hunks)
  • src/llmq/chainlocks.cpp (1 hunks)
  • src/llmq/context.cpp (1 hunks)
  • src/llmq/context.h (1 hunks)
  • src/llmq/instantsend.h (0 hunks)
  • src/net_processing.cpp (2 hunks)
  • src/node/interfaces.cpp (2 hunks)
  • src/node/miner.cpp (1 hunks)
  • src/rest.cpp (1 hunks)
  • src/rpc/blockchain.cpp (1 hunks)
  • src/rpc/mempool.cpp (1 hunks)
  • src/rpc/mining.cpp (0 hunks)
  • src/rpc/rawtransaction.cpp (2 hunks)
  • src/test/cachemap_tests.cpp (1 hunks)
  • src/test/cachemultimap_tests.cpp (1 hunks)
  • src/test/evo_deterministicmns_tests.cpp (1 hunks)
  • src/test/evo_islock_tests.cpp (3 hunks)
  • src/test/fuzz/process_message.cpp (0 hunks)
  • src/test/governance_validators_tests.cpp (1 hunks)
  • src/test/miner_tests.cpp (0 hunks)
  • src/test/ratecheck_tests.cpp (1 hunks)
  • src/txmempool.cpp (1 hunks)
  • src/validationinterface.cpp (1 hunks)
  • src/validationinterface.h (3 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/miner_tests.cpp
  • src/rpc/mining.cpp
  • src/test/fuzz/process_message.cpp
  • src/llmq/instantsend.h
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.{cpp,h,cc,cxx,hpp}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
src/bench/**/*.{cpp,h,cc,cxx,hpp}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
🧠 Learnings (42)
📓 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: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
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-10T16:26:00.371Z
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/governance_validators_tests.cpp (4)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
Learnt from: kwvg
PR: dashpay/dash#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.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: dashpay/dash#6530
File: src/validation.cpp:4514-4516
Timestamp: 2025-01-14T08:40:00.994Z
Learning: In Dash Core, error() is used (instead of state.Invalid()) to report critical failures that require immediate user intervention, particularly for database/disk errors and data corruption scenarios. This is an established pattern seen in validation.cpp.
src/dsnotificationinterface.cpp (5)
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#6532
File: src/net.cpp:4329-4329
Timestamp: 2025-01-14T09:07:12.446Z
Learning: Keep suggestions focused on the scope of the current commit/PR. Avoid suggesting unrelated improvements that should be handled in separate PRs, even if technically valid.
Learnt from: knst
PR: dashpay/dash#6533
File: test/functional/feature_llmq_singlenode.py:98-106
Timestamp: 2025-01-22T08:33:31.405Z
Learning: When reviewing PRs, ensure that suggestions are directly related to the PR's primary objectives rather than general code improvements that could be addressed separately.
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: kwvg
PR: dashpay/dash#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/test/cachemultimap_tests.cpp (2)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/**/*.{cpp,h,cc,cxx,hpp} : Dash uses unordered_lru_cache for efficient caching with LRU eviction
src/test/ratecheck_tests.cpp (1)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
src/evo/chainhelper.cpp (4)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: 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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: kwvg
PR: dashpay/dash#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/test/evo_deterministicmns_tests.cpp (5)
Learnt from: knst
PR: dashpay/dash#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.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
src/bench/rpc_blockchain.cpp (2)
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/bench/**/*.{cpp,h,cc,cxx,hpp} : Performance benchmarks should be implemented in src/bench/ using nanobench
src/rpc/mempool.cpp (3)
Learnt from: kwvg
PR: dashpay/dash#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: 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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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 (2)
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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 (4)
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: kwvg
PR: dashpay/dash#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/rpc/blockchain.cpp (4)

<retrieved_learning>
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.
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
</retrieved_learning>

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

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

src/llmq/chainlocks.cpp (7)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: knst
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: kwvg
PR: dashpay/dash#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
PR: dashpay/dash#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.
src/llmq/context.h (3)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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/test/evo_islock_tests.cpp (5)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
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: 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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
src/llmq/context.cpp (1)
Learnt from: kwvg
PR: dashpay/dash#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/init.cpp (3)

undefined

<retrieved_learning>
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.
</retrieved_learning>

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

<retrieved_learning>
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
</retrieved_learning>

src/rpc/rawtransaction.cpp (5)
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#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-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: dashpay/dash#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/test/cachemap_tests.cpp (2)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/**/*.{cpp,h,cc,cxx,hpp} : Dash uses unordered_lru_cache for efficient caching with LRU eviction
src/instantsend/lock.cpp (1)
Learnt from: kwvg
PR: dashpay/dash#6629
File: src/test/evo_netinfo_tests.cpp:39-45
Timestamp: 2025-05-10T00:55:16.184Z
Learning: In Dash's validation testing for network entries, checking `IsTriviallyValid()` is specifically used to ensure all three validation methods (`AddEntry()`, `Validate()`, and `IsTriviallyValid()`) consistently work together rather than replacing one check with another. `AddEntry()` and `Validate()` handle the consensus rule checks, while `IsTriviallyValid()` confirms the basic validation steps.
test/util/data/non-backported.txt (7)
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: 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-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/**/*.{cpp,h,cc,cxx,hpp} : Dash Core codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
src/interfaces/chain.h (2)
Learnt from: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
Learning: Applies to src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp} : Masternode lists must use immutable data structures (Immer library) for thread safety
src/validationinterface.cpp (3)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
src/wallet/wallet.cpp (2)

undefined

<retrieved_learning>
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.
</retrieved_learning>

<retrieved_learning>
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.
</retrieved_learning>

src/zmq/zmqabstractnotifier.cpp (1)
Learnt from: kwvg
PR: dashpay/dash#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/zmq/zmqnotificationinterface.h (1)
Learnt from: kwvg
PR: dashpay/dash#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/Makefile.am (5)
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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-10T16:26:00.371Z
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-10T16:26:00.371Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be implemented in src/test/, src/wallet/test/, and src/qt/test/ using Boost::Test or Qt 5 for GUI tests
Learnt from: kwvg
PR: dashpay/dash#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/txmempool.cpp (6)
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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
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: knst
PR: dashpay/dash#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.
Learnt from: kwvg
PR: dashpay/dash#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.
test/lint/lint-circular-dependencies.py (2)
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-10T16:26:00.371Z
Learning: Applies to depends/** : Unless specifically prompted, avoid making changes to the depends directory (dependency build system)
src/zmq/zmqnotificationinterface.cpp (1)
Learnt from: kwvg
PR: dashpay/dash#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/instantsend/lock.h (1)
Learnt from: kwvg
PR: dashpay/dash#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 (3)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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/interfaces.cpp (2)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: dashpay/dash#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/net_processing.cpp (5)

undefined

<retrieved_learning>
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.
</retrieved_learning>

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

<retrieved_learning>
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.
</retrieved_learning>

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

<retrieved_learning>
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
</retrieved_learning>

src/wallet/wallet.h (2)
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
Learning: Applies to src/evo/specialtx.h : Special transactions must use payload extensions as implemented in src/evo/specialtx.h
Learnt from: kwvg
PR: dashpay/dash#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/zmq/zmqpublishnotifier.cpp (3)
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#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-10T16:26:00.371Z
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: kwvg
PR: dashpay/dash#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/instantsend/signing.cpp (2)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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/instantsend/db.h (1)
Learnt from: kwvg
PR: dashpay/dash#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/instantsend/instantsend.h (3)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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.h (2)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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/instantsend/instantsend.cpp (8)
Learnt from: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
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: 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: 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: knst
PR: dashpay/dash#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.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: dashpay/dash#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: kwvg
PR: dashpay/dash#6629
File: src/test/evo_netinfo_tests.cpp:39-45
Timestamp: 2025-05-10T00:55:16.184Z
Learning: In Dash's validation testing for network entries, checking `IsTriviallyValid()` is specifically used to ensure all three validation methods (`AddEntry()`, `Validate()`, and `IsTriviallyValid()`) consistently work together rather than replacing one check with another. `AddEntry()` and `Validate()` handle the consensus rule checks, while `IsTriviallyValid()` confirms the basic validation steps.
🧬 Code Graph Analysis (6)
src/interfaces/chain.h (2)
src/node/interfaces.cpp (12)
  • tx (497-500)
  • tx (497-497)
  • tx (620-623)
  • tx (620-620)
  • tx (624-627)
  • tx (624-624)
  • tx (645-648)
  • tx (645-645)
  • tx (890-897)
  • tx (890-890)
  • tx (909-924)
  • tx (909-909)
src/instantsend/instantsend.h (1)
  • islock (117-117)
src/validationinterface.cpp (4)
src/zmq/zmqabstractnotifier.cpp (2)
  • NotifyTransactionLock (51-54)
  • NotifyTransactionLock (51-51)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyTransactionLock (216-221)
  • NotifyTransactionLock (216-216)
src/zmq/zmqpublishnotifier.cpp (6)
  • NotifyTransactionLock (256-264)
  • NotifyTransactionLock (256-256)
  • NotifyTransactionLock (418-425)
  • NotifyTransactionLock (418-418)
  • NotifyTransactionLock (427-435)
  • NotifyTransactionLock (427-427)
src/validationinterface.h (5)
  • tx (152-152)
  • tx (152-152)
  • tx (166-166)
  • tx (166-166)
  • tx (234-234)
src/zmq/zmqabstractnotifier.cpp (3)
src/validationinterface.cpp (2)
  • NotifyTransactionLock (269-275)
  • NotifyTransactionLock (269-269)
src/zmq/zmqnotificationinterface.cpp (2)
  • NotifyTransactionLock (216-221)
  • NotifyTransactionLock (216-216)
src/zmq/zmqpublishnotifier.cpp (6)
  • NotifyTransactionLock (256-264)
  • NotifyTransactionLock (256-256)
  • NotifyTransactionLock (418-425)
  • NotifyTransactionLock (418-418)
  • NotifyTransactionLock (427-435)
  • NotifyTransactionLock (427-427)
src/zmq/zmqnotificationinterface.h (2)
src/instantsend/instantsend.h (5)
  • tx (111-111)
  • tx (115-115)
  • tx (133-133)
  • tx (139-139)
  • islock (117-117)
src/validationinterface.h (5)
  • tx (152-152)
  • tx (152-152)
  • tx (166-166)
  • tx (166-166)
  • tx (234-234)
src/zmq/zmqpublishnotifier.h (3)
src/zmq/zmqabstractnotifier.h (4)
  • transaction (66-66)
  • transaction (68-68)
  • transaction (70-70)
  • transaction (72-72)
src/instantsend/instantsend.h (1)
  • islock (117-117)
src/instantsend/signing.h (1)
  • islock (73-73)
src/instantsend/instantsend.h (9)
src/instantsend/db.h (12)
  • unitTests (80-80)
  • hash (72-72)
  • hash (91-91)
  • hash (97-97)
  • hash (123-123)
  • txid (77-77)
  • txid (133-133)
  • txid (143-143)
  • islockHash (111-111)
  • islockHash (157-157)
  • pblock (109-109)
  • pblock (110-110)
src/instantsend/instantsend.cpp (2)
  • CInstantSendManager (56-74)
  • CInstantSendManager (76-76)
src/net_processing.cpp (24)
  • pfrom (619-619)
  • pfrom (642-643)
  • pfrom (717-719)
  • pfrom (725-725)
  • pfrom (733-733)
  • pfrom (736-736)
  • pfrom (738-738)
  • pfrom (740-740)
  • pfrom (833-833)
  • pfrom (1015-1015)
  • from (1018-1018)
  • hash (986-986)
  • hash (992-992)
  • tx (1043-1043)
  • txid (637-637)
  • txid (652-652)
  • txid (654-654)
  • pindex (614-614)
  • pindex (831-831)
  • pblock (606-606)
  • ret (657-657)
  • ret (658-658)
  • id (676-676)
  • id (680-680)
src/instantsend/signing.h (5)
  • islock (73-73)
  • tx (81-81)
  • tx (85-85)
  • tx (96-97)
  • tx (99-99)
src/interfaces/chain.h (9)
  • hash (57-57)
  • hash (57-57)
  • hash (128-128)
  • hash (143-143)
  • txid (193-193)
  • txid (196-196)
  • txid (207-207)
  • pindexChainLock (270-270)
  • pindexChainLock (270-270)
src/node/interfaces.cpp (25)
  • hash (741-758)
  • hash (741-741)
  • hash (780-784)
  • hash (780-780)
  • hash (806-811)
  • hash (806-806)
  • tx (497-500)
  • tx (497-497)
  • tx (620-623)
  • tx (620-620)
  • tx (624-627)
  • tx (624-624)
  • tx (645-648)
  • tx (645-645)
  • tx (890-897)
  • txid (877-882)
  • txid (877-877)
  • txid (883-889)
  • txid (883-883)
  • txid (898-903)
  • txid (898-898)
  • pindexChainLock (641-644)
  • pindexChainLock (641-641)
  • id (407-413)
  • id (407-407)
src/validationinterface.h (6)
  • pindex (167-167)
  • pindex (167-167)
  • pindex (200-200)
  • pindex (232-232)
  • pindex (233-233)
  • pindex (235-235)
src/zmq/zmqabstractnotifier.h (4)
  • pindex (60-60)
  • pindex (62-62)
  • pindex (64-64)
  • pindex (71-71)
src/zmq/zmqpublishnotifier.h (3)
  • pindex (42-42)
  • pindex (48-48)
  • pindex (90-90)
🪛 GitHub Actions: Clang Diff Format Check
src/instantsend/signing.cpp

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

src/instantsend/db.h

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


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

src/instantsend/instantsend.h

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

src/instantsend/signing.h

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

src/instantsend/db.cpp

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


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


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


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


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

src/instantsend/instantsend.cpp

[error] 27-932: 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). (3)
  • GitHub Check: linux64_tsan-test / Test source
  • GitHub Check: linux64-test / Test source
  • GitHub Check: linux64_multiprocess-build / Build source
🔇 Additional comments (55)
src/rpc/mempool.cpp (1)

19-19: Include path migration looks correct

The switch to the new instantsend/instantsend.h location compiles cleanly and keeps the dependency minimal.
No further action required.

src/rest.cpp (1)

14-14: Header path update acknowledged

The new InstantSend include path is correct and keeps REST build-able after the refactor.

src/rpc/blockchain.cpp (1)

57-57: Header path updated; confirm build picks up new location

The include has been switched to instantsend/instantsend.h, which aligns with the module relocation.
Please double-check that:

  1. The build system (Makefile.am / CMake, etc.) already adds src/instantsend/ to the compiler’s header-search paths.
  2. instantsend/instantsend.h still defines llmq::CInstantSendManager, as this TU continues to rely on that namespace (e.g. isman.IsLocked() below).

A quick sanity compile should surface any mismatch early.

src/test/evo_deterministicmns_tests.cpp (1)

26-26: Header path update looks good

The test now pulls in the correct InstantSend header; no further action needed.

src/dsnotificationinterface.cpp (1)

19-19: Include path update looks correct.

dsnotificationinterface.cpp now includes the refactored InstantSend header (instantsend/instantsend.h), matching the new module layout. No further action required.

src/bench/rpc_blockchain.cpp (1)

9-9: Bench file brought in sync with refactor.

The include was updated to <instantsend/instantsend.h>, ensuring the benchmark continues to compile after the module move. All good.

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

17-18: List update acknowledged.

Adding the new src/instantsend/* patterns keeps the non-backported registry up-to-date with the module split. ✔️

src/coinjoin/coinjoin.cpp (1)

12-12: Include path correctly migrated to new InstantSend module

The update from the old llmq location to <instantsend/instantsend.h> is consistent with the refactor and compiles cleanly.
No further issues spotted.

src/node/miner.cpp (1)

36-36: Header moved to new namespace – looks good

<instantsend/instantsend.h> is now the canonical header; the include order remains logically grouped.
All good.

src/llmq/context.cpp (1)

10-10: Include update aligns with refactor

Switching to <instantsend/instantsend.h> removes the obsolete dependency; no circular-include concerns observed.

src/llmq/chainlocks.cpp (1)

23-26: Updated include block is accurate

The new InstantSend header and reordered LLMQ headers compile without warnings; dependency graph unaffected.
No further action needed.

src/llmq/context.h (1)

72-72: Comment removal only – safe

Only a stale TODO was deleted; no functional impact.

src/rpc/rawtransaction.cpp (2)

53-54: LGTM: Include updates align with InstantSend namespace refactoring.

The includes are correctly updated from llmq/instantsend.h to the new dedicated instantsend/lock.h and instantsend/instantsend.h headers, consistent with the PR's goal of moving InstantSend functionality out of the llmq namespace.


459-459: LGTM: Type update correctly reflects namespace changes.

The type change from llmq::CInstantSendLockPtr to instantsend::InstantSendLockPtr is consistent with the InstantSend refactoring and maintains the same functionality while using the new namespace.

src/interfaces/chain.h (2)

34-36: LGTM: Forward declaration correctly added for new namespace.

The forward declaration for instantsend::InstantSendLock is properly added to support the namespace refactoring while maintaining clean header dependencies.


271-271: LGTM: Interface method signature correctly updated.

The parameter type change from llmq::CInstantSendLockPtr to std::shared_ptr<const instantsend::InstantSendLock> is consistent with the InstantSend refactoring and maintains the same const-correctness and shared pointer semantics.

src/test/evo_islock_tests.cpp (6)

1-1: Copyright year update is appropriate for refactoring.

The copyright year update to 2025 is consistent with the refactoring effort.


7-7: Include path correctly updated for the new module structure.

The include path change from llmq/instantsend.h to instantsend/lock.h correctly reflects the refactoring of InstantSend into a dedicated module.


14-16: Include additions are appropriate for the test file.

The added includes for <string_view> and <boost/test/unit_test.hpp> are correctly formatted and appropriate for the test file's needs.


31-31: Type reference correctly updated to new namespace.

The change from llmq::CInstantSendLock to instantsend::InstantSendLock is consistent with the refactoring objectives and maintains the same functionality.


34-34: Comment updated to reflect new type name.

The comment correctly refers to InstantSendLock instead of CInstantSendLock, maintaining consistency with the new naming convention.


79-79: Consistent type usage throughout the test.

The second instance of type change from llmq::CInstantSendLock to instantsend::InstantSendLock maintains consistency throughout the test file.

src/zmq/zmqabstractnotifier.cpp (1)

51-51: Parameter type correctly updated for namespace refactoring.

The change from std::shared_ptr<const llmq::CInstantSendLock> to std::shared_ptr<const instantsend::InstantSendLock> is consistent with the refactoring objectives and maintains the same method signature semantics. This aligns with the corresponding updates in src/zmq/zmqnotificationinterface.cpp and src/zmq/zmqpublishnotifier.cpp.

src/net_processing.cpp (2)

65-66: LGTM! Include directives updated correctly.

The new include directives for <instantsend/lock.h> and <instantsend/instantsend.h> properly reflect the InstantSend module extraction from the llmq namespace to the dedicated instantsend namespace.


2869-2869: LGTM! Type rename is consistent with the refactor.

The change from llmq::CInstantSendLock to instantsend::InstantSendLock is consistent with the comprehensive refactoring that moves InstantSend implementation to the instantsend namespace. The functionality remains identical, just using the new type definition.

src/wallet/wallet.h (1)

916-916: LGTM! Type signature correctly updated for the InstantSend refactoring.

The method signature change from llmq::CInstantSendLock to instantsend::InstantSendLock is consistent with the refactoring that moves InstantSend functionality from the llmq namespace to the dedicated instantsend namespace.

src/zmq/zmqnotificationinterface.h (1)

35-35: LGTM: Namespace change correctly implemented.

The parameter type update from llmq::CInstantSendLock to instantsend::InstantSendLock is consistent with the move-only refactor to reorganize InstantSend functionality into a dedicated module.

src/zmq/zmqnotificationinterface.cpp (1)

216-216: LGTM: Implementation correctly updated to match header.

The method implementation properly updates the parameter type to instantsend::InstantSendLock, maintaining consistency with the header file change and preserving the same functionality.

src/validationinterface.cpp (1)

269-269: LGTM: Consistent namespace update in validation interface.

The parameter type change to instantsend::InstantSendLock is consistent with the move-only refactor and properly maintains the same notification functionality.

src/node/interfaces.cpp (2)

21-21: LGTM: Include directive properly updated.

The include directive correctly reflects the new file location of the InstantSend module under the instantsend directory structure.


645-645: LGTM: Method signature consistently updated.

The parameter type change to instantsend::InstantSendLock is consistent with the namespace reorganization and maintains the same notification functionality.

src/Makefile.am (2)

233-236: LGTM: Header files properly added to build system.

The new instantsend module header files are correctly added to the BITCOIN_CORE_H section, ensuring they will be included in the build.


493-496: LGTM: Source files properly added to build system.

The new instantsend module source files are correctly added to the libbitcoin_node_a_SOURCES section, completing the integration of the refactored module into the build system.

src/instantsend/lock.cpp (3)

13-13: LGTM! Good use of string_view for constant prefix.

Using std::string_view for the constant prefix is efficient as it avoids unnecessary string copies during hashing operations.


16-22: LGTM! Request ID generation is correctly implemented.

The implementation properly hashes the prefix and inputs to generate a unique request ID, which is consistent with the expected behavior for InstantSend locks.


28-43: LGTM! Validation logic is comprehensive and correct.

The trivial validation correctly checks for:

  • Null transaction ID
  • Empty inputs vector
  • Duplicate inputs using efficient set-based detection

The duplicate detection logic using std::set::emplace().second is correct and efficient.

src/instantsend/lock.h (2)

19-41: LGTM! Well-designed struct with proper serialization support.

The struct definition is well-structured with:

  • Appropriate version field for future compatibility
  • Proper member types (vector, uint256, CBLSLazySignature)
  • Comprehensive serialization support
  • Forward declaration usage to minimize dependencies

The default constructor and serialization macros are correctly implemented.


43-43: LGTM! Convenient type alias for shared pointer usage.

The InstantSendLockPtr alias provides a clean way to use shared pointers to InstantSendLock throughout the codebase.

src/validationinterface.h (3)

31-33: LGTM! Proper namespace organization.

The forward declaration of instantsend::InstantSendLock is correctly placed and follows the established pattern for other namespace declarations in the file.


166-166: LGTM! Interface updated to use the new InstantSend type.

The NotifyTransactionLock method signature correctly uses std::shared_ptr<const instantsend::InstantSendLock> instead of the previous llmq::CInstantSendLock, which aligns with the refactoring objectives.


234-234: LGTM! Consistent method signature update.

The CMainSignals::NotifyTransactionLock method signature is correctly updated to match the interface change, maintaining consistency across the validation interface.

src/zmq/zmqpublishnotifier.h (3)

60-60: LGTM! Consistent type update for hash transaction lock notifier.

The method signature correctly updates to use std::shared_ptr<const instantsend::InstantSendLock> instead of the previous llmq::CInstantSendLock, maintaining consistency with the refactoring.


123-123: LGTM! Consistent type update for raw transaction lock notifier.

The method signature correctly updates to use std::shared_ptr<const instantsend::InstantSendLock> instead of the previous llmq::CInstantSendLock, maintaining consistency with the refactoring.


129-129: LGTM! Consistent type update for raw transaction lock signature notifier.

The method signature correctly updates to use std::shared_ptr<const instantsend::InstantSendLock> instead of the previous llmq::CInstantSendLock, maintaining consistency with the refactoring.

src/zmq/zmqabstractnotifier.h (3)

17-26: LGTM! Well-organized namespace declarations.

The namespace declarations are properly organized with:

  • Consistent formatting and style
  • Correct forward declaration of instantsend::InstantSendLock
  • Removal of the old llmq::CInstantSendLock declaration
  • Retention of other necessary llmq forward declarations

This aligns with the refactoring objectives.


28-28: LGTM! Modern C++ style improvement.

The change from typedef to using declaration is a good modernization and follows C++11+ best practices.


72-72: LGTM! Method signature correctly updated.

The NotifyTransactionLock method signature is correctly updated to use std::shared_ptr<const instantsend::InstantSendLock> instead of the previous llmq::CInstantSendLock, maintaining consistency with the refactoring across all interface files.

src/zmq/zmqpublishnotifier.cpp (2)

15-20: LGTM!

The include directive changes correctly reflect the refactoring of InstantSend into its own module.


256-256: LGTM!

The parameter type updates correctly use the new instantsend::InstantSendLock type, maintaining consistency with the namespace refactoring.

Also applies to: 418-418, 427-427

src/instantsend/signing.h (1)

28-102: Well-designed class structure!

The InstantSendSigner class has a clear separation of concerns, extracting the signing logic from the main manager class. The thread-safety annotations are comprehensive and will help prevent concurrency issues.

src/instantsend/db.h (1)

29-158: Excellent database interface design!

The CInstantSendDb class provides a comprehensive and well-documented interface for managing InstantSend locks. The use of GSL's not_null pointers and thorough thread-safety annotations demonstrates attention to safety and correctness.

src/instantsend/instantsend.h (1)

46-167: Excellent refactoring of the InstantSend manager!

The refactored CInstantSendManager successfully delegates signing responsibilities to the InstantSendSigner class, resulting in a cleaner separation of concerns. The comprehensive thread-safety annotations will help maintain correctness in concurrent scenarios.

src/instantsend/signing.cpp (1)

30-396: High-quality implementation of the InstantSend signer!

The implementation is comprehensive with proper error handling, detailed logging for debugging, and appropriate thread safety measures. The extraction of signing logic into this dedicated class improves modularity and maintainability.

src/instantsend/db.cpp (1)

357-394: Well-designed implementation for removing chained locks.

The stack-based approach avoids recursion issues, and the use of an unordered_set to track processed transactions prevents infinite loops from circular dependencies. The batch operations ensure atomicity.

src/instantsend/instantsend.cpp (1)

620-627: Good helper function implementation.

The TryEmplacePendingLock function properly checks if the lock is already known before adding it to pending locks, with appropriate locking.

const CMasternodeSync& m_mn_sync;

private:
mutable Mutex cs_inputReqests;
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 the typo in the mutex name.

The mutex name has a typo: cs_inputReqests should be cs_inputRequests.

Apply this diff to fix the typo:

-    mutable Mutex cs_inputReqests;
+    mutable Mutex cs_inputRequests;

Also update the corresponding GUARDED_BY annotation:

-    std::unordered_set<uint256, StaticSaltedHasher> inputRequestIds GUARDED_BY(cs_inputReqests);
+    std::unordered_set<uint256, StaticSaltedHasher> inputRequestIds GUARDED_BY(cs_inputRequests);

Also applies to: 49-49

🤖 Prompt for AI Agents
In src/instantsend/signing.h at lines 42 and 49, there is a typo in the mutex
name `cs_inputReqests` which should be corrected to `cs_inputRequests`. Rename
the mutex variable to fix the typo and update any corresponding `GUARDED_BY`
annotations to use the corrected name to maintain consistency and proper
thread-safety annotations.

@kwvg kwvg changed the title refactor: move InstantSend impl.to src/instantsend/ and split sources for islock, database and masternode logic out of manager source refactor: move InstantSend impl. to src/instantsend/ and split sources for islock, database and masternode logic out of manager source Jul 15, 2025
Comment on lines +34 to +40
// Check that each input is unique
std::set<COutPoint> dups;
for (const auto& o : inputs) {
if (!dups.emplace(o).second) {
return false;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

@coderabbitai can we use std algorithms here to improve it?

(nit not for this PR)

Copy link

Choose a reason for hiding this comment

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

@PastaPastaPasta Yes, there are several ways to use standard algorithms to improve the duplicate detection in the TriviallyValid() method. Here are a few alternatives:

Option 1: Using std::unordered_set (potentially faster)

bool InstantSendLock::TriviallyValid() const
{
    if (txid.IsNull() || inputs.empty()) {
        return false;
    }

    std::unordered_set<COutPoint> seen;
    for (const auto& o : inputs) {
        if (!seen.insert(o).second) {
            return false;
        }
    }
    return true;
}

Option 2: Using std::ranges::unique (C++20, more expressive)

bool InstantSendLock::TriviallyValid() const
{
    if (txid.IsNull() || inputs.empty()) {
        return false;
    }

    auto sorted_inputs = inputs;
    std::ranges::sort(sorted_inputs);
    auto unique_end = std::ranges::unique(sorted_inputs);
    return unique_end.begin() == sorted_inputs.end();
}

Option 3: Using std::adjacent_find after sorting

bool InstantSendLock::TriviallyValid() const
{
    if (txid.IsNull() || inputs.empty()) {
        return false;
    }

    auto sorted_inputs = inputs;
    std::sort(sorted_inputs.begin(), sorted_inputs.end());
    return std::adjacent_find(sorted_inputs.begin(), sorted_inputs.end()) == sorted_inputs.end();
}

Trade-offs:

  • Current approach: O(n log n), early termination on duplicates, clear intent
  • unordered_set: O(n) average case, but requires good hash function for COutPoint
  • sort + unique/adjacent_find: O(n log n), more "algorithmic" style, but copies the vector

The current implementation is actually quite good - it's efficient and clear. The std::unordered_set approach might be the most beneficial performance-wise if COutPoint has a good hash function.


🧠 Learnings used
Learnt from: kwvg
PR: dashpay/dash#6629
File: src/test/evo_netinfo_tests.cpp:39-45
Timestamp: 2025-05-10T00:55:16.184Z
Learning: In Dash's validation testing for network entries, checking `IsTriviallyValid()` is specifically used to ensure all three validation methods (`AddEntry()`, `Validate()`, and `IsTriviallyValid()`) consistently work together rather than replacing one check with another. `AddEntry()` and `Validate()` handle the consensus rule checks, while `IsTriviallyValid()` confirms the basic validation steps.

Learnt from: kwvg
PR: dashpay/dash#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: 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.

}
}

void CInstantSendDb::RemoveInstantSendLock(CDBBatch& batch, const uint256& hash, InstantSendLockPtr islock, bool keep_cache)
Copy link
Member

Choose a reason for hiding this comment

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

nit not for this pr

@coderabbitai, can this islock be taken in as a raw pointer to avoid having to copy in the shared_ptr?

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

@PastaPastaPasta Looking at the RemoveInstantSendLock method, you're right that it could potentially take a raw pointer instead of InstantSendLockPtr to avoid copying the shared_ptr.

The method currently:

  1. Uses the shared_ptr only for temporary access (islock->txid, islock->inputs)
  2. Has null-checking logic that fetches from database if needed
  3. Doesn't store or pass the shared_ptr elsewhere

A raw pointer would work, but would require:

  • Caller to handle shared_ptr→raw pointer conversion
  • Careful lifetime management (caller must ensure object stays alive)
  • Reconsidering the null-checking logic (maybe require non-null raw pointer)

Since the method only needs temporary access and doesn't maintain ownership, a raw pointer would indeed avoid the shared_ptr copy overhead. Good catch for a future optimization!


🏁 Script executed:

#!/bin/bash
# Let's examine the call sites and usage patterns
echo "=== Call sites for RemoveInstantSendLock ==="
rg "RemoveInstantSendLock" -A 2 -B 2

echo -e "\n=== How InstantSendLockPtr is defined ==="
rg "InstantSendLockPtr" -A 1 -B 1 src/instantsend/lock.h

Length of output: 2964


Looking at the call sites and usage patterns, you're absolutely right that this could be optimized!

Current usage analysis:

  1. The method takes InstantSendLockPtr (shared_ptr) but only uses it for temporary access (islock->txid, islock->inputs)
  2. It doesn't store or pass the shared_ptr elsewhere - just reads from it
  3. Call sites are:
    • RemoveInstantSendLock(batch, islockHash, islock) - passes shared_ptr from GetInstantSendLockByHashInternal
    • RemoveInstantSendLock(batch, childIslockHash, childIsLock, false) - similar
    • RemoveInstantSendLock(batch, islockHash, nullptr, false) - passes nullptr explicitly

Optimization potential:
Yes, a raw pointer would work and avoid the shared_ptr copy overhead. The method only needs temporary read access to the lock data.

Design considerations:
The current method serves dual purposes:

  1. Remove a lock the caller already has
  2. Remove a lock the caller doesn't have (fetches internally when passed nullptr)

For a raw pointer approach, you could:

  • Require non-null raw pointer (caller must fetch first)
  • Have two overloads: RemoveInstantSendLock(batch, hash, const InstantSendLock*) and RemoveInstantSendLock(batch, hash)
  • Keep current design but change signature to const InstantSendLock* islock = nullptr

The shared_ptr→raw pointer conversion at call sites would be trivial (islock.get()), and lifetime is guaranteed since callers already hold the shared_ptr.

Good catch for a future optimization - it would reduce reference counting overhead for what's essentially a read-only parameter! 🐰


🧬 Code Graph Analysis Results

Relevant snippets from src/instantsend/db.cpp (entire file, lines 1-280 approx.)

The entire file src/instantsend/db.cpp is relevant as it contains the implementation of the CInstantSendDb class, which manages InstantSend locks (ISLocks) in the database. Key points include:

  • The class uses a std::shared_ptr<InstantSendLock> type alias InstantSendLockPtr for caching ISLocks.
  • The method WriteNewInstantSendLock(const uint256& hash, const InstantSendLock& islock) inserts a new ISLock into the database and caches it by creating a std::shared_ptr<InstantSendLock> from the passed InstantSendLock reference.
  • The method RemoveInstantSendLock(CDBBatch& batch, const uint256& hash, InstantSendLockPtr islock, bool keep_cache) accepts an InstantSendLockPtr shared pointer for the ISLock to remove. If the pointer is null, it fetches the ISLock internally.
  • The caching mechanism uses std::shared_ptr<InstantSendLock> extensively.
  • The code uses locking (LOCK(cs_db)) to protect database and cache access.
  • The user comment suggests a nit about passing the ISLock as a raw pointer instead of a shared pointer to avoid copying the shared pointer.

Relevant snippets from src/instantsend/db.h

  • Declaration of RemoveInstantSendLock method:
void RemoveInstantSendLock(CDBBatch& batch, const uint256& hash, InstantSendLockPtr islock, bool keep_cache = true);
  • Declaration of WriteNewInstantSendLock method:
void WriteNewInstantSendLock(const uint256& hash, const InstantSendLock& islock);
  • Declaration of InstantSendLockPtr as a shared pointer type alias for InstantSendLock.
  • The header defines the interface for the database operations on ISLocks, including caching and batch operations.

Summary of relevant context from src/instantsend/db.cpp

  • WriteNewInstantSendLock takes the ISLock by const reference and then creates a std::shared_ptr<InstantSendLock> to insert into the cache.
  • RemoveInstantSendLock takes an InstantSendLockPtr shared pointer, which may be null, and if so, fetches the ISLock internally.
  • The user comment suggests that the islock parameter in RemoveInstantSendLock could be passed as a raw pointer instead of a shared pointer to avoid copying the shared pointer.
  • The code uses shared pointers for caching and lifetime management of ISLocks.
  • The locking and batch write patterns are consistent throughout the file.

Possibly relevant snippets from src/instantsend/instantsend.cpp

At lines 863-870:

instantsend::InstantSendLockPtr CInstantSendManager::GetInstantSendLockByTxid(const uint256& txid) const
{
    if (!IsInstantSendEnabled()) {
        return nullptr;
    }

    return db.GetInstantSendLockByTxid(txid);
}
  • Shows usage of InstantSendLockPtr returned from the DB interface.

At lines 919-922:

size_t CInstantSendManager::GetInstantSendLockCount() const
{
    return db.GetInstantSendLockCount();
}
  • Shows delegation to DB for lock count.

Possibly relevant snippets from src/instantsend/instantsend.h

  • Declaration of methods related to ISLocks, including:
RemoveConflictingLock(const uint256& islockHash, const instantsend::InstantSendLock& islock);
TryEmplacePendingLock(const uint256& hash, const NodeId id, const instantsend::InstantSendLockPtr& islock);
GetInstantSendLockByTxid(const uint256& txid) const;
  • Shows that InstantSendLockPtr is used in the interface.

Possibly relevant snippets from src/zmq/zmqnotificationinterface.h

At lines 31-32:

BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override
BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected) override
  • Shows usage of std::shared_ptr<const CBlock> in block connected/disconnected notifications, similar to how std::shared_ptr is used in WriteBlockInstantSendLocks and RemoveBlockInstantSendLocks in db.cpp.

Possibly relevant snippets from src/dbwrapper.h

At lines 687-689:

std::unique_ptr<CDBTransactionIterator<CDBTransaction>> NewIteratorUniquePtr() {
    return std::make_unique<CDBTransactionIterator<CDBTransaction>>(*this);
}
  • Shows usage of std::unique_ptr for DB iterators, relevant to how iterators are used in RemoveConfirmedInstantSendLocks and RemoveArchivedInstantSendLocks.

Summary

The main relevant context is the use of std::shared_ptr<InstantSendLock> in the CInstantSendDb class, especially in the RemoveInstantSendLock method where the user suggests passing a raw pointer instead of a shared pointer to avoid copying the shared pointer. The file shows consistent use of shared pointers for caching and lifetime management of ISLocks. Other snippets show similar usage patterns of shared pointers in related code areas.


🧠 Learnings used
Learnt from: kwvg
PR: dashpay/dash#6629
File: src/evo/netinfo.h:248-256
Timestamp: 2025-05-10T00:54:30.887Z
Learning: The Dash codebase includes a specialization for serializing std::shared_ptr objects in src/serialize.h, which allows direct serialization of shared_ptr instances with stream operators.

Learnt from: kwvg
PR: dashpay/dash#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: 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.

Comment on lines +12 to +18
static const std::string_view DB_ARCHIVED_BY_HASH = "is_a2";
static const std::string_view DB_ARCHIVED_BY_HEIGHT_AND_HASH = "is_a1";
static const std::string_view DB_HASH_BY_OUTPOINT = "is_in";
static const std::string_view DB_HASH_BY_TXID = "is_tx";
static const std::string_view DB_ISLOCK_BY_HASH = "is_i";
static const std::string_view DB_MINED_BY_HEIGHT_AND_HASH = "is_m";
static const std::string_view DB_VERSION = "is_v";
Copy link
Member

Choose a reason for hiding this comment

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

nit @coderabbitai can these be constexpr

Copy link

Choose a reason for hiding this comment

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

@PastaPastaPasta Yes, these can definitely be constexpr!

Since C++17, std::string_view is a literal type and its constructor for string literals is constexpr. All of these variables are initialized with string literals, which are constant expressions, so they can be evaluated at compile time.

static constexpr std::string_view DB_ARCHIVED_BY_HASH = "is_a2";
static constexpr std::string_view DB_ARCHIVED_BY_HEIGHT_AND_HASH = "is_a1";
static constexpr std::string_view DB_HASH_BY_OUTPOINT = "is_in";
static constexpr std::string_view DB_HASH_BY_TXID = "is_tx";
static constexpr std::string_view DB_ISLOCK_BY_HASH = "is_i";
static constexpr std::string_view DB_MINED_BY_HEIGHT_AND_HASH = "is_m";
static constexpr std::string_view DB_VERSION = "is_v";

This is a nice optimization that makes these compile-time constants rather than runtime constants, and better expresses the intent that these values are never meant to change.

🐰💭


🧠 Learnings used
Learnt from: kwvg
PR: dashpay/dash#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: 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.

using node::GetTransaction;

namespace llmq {
static const std::string_view INPUTLOCK_REQUESTID_PREFIX = "inlock";
Copy link
Member

Choose a reason for hiding this comment

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

nit constexpr

Comment on lines 65 to 113
uint256 hashBlock{};
const auto tx = GetTransaction(nullptr, &mempool, txid, Params().GetConsensus(), hashBlock);
if (!tx) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

nit mark hashBlock sas unused via _

Comment on lines 99 to 108
CTransactionRef tx;
{
{
LOCK(cs_nonLocked);
auto it = nonLockedTxs.find(txid);
if (it == nonLockedTxs.end()) {
continue;
}
tx = it->second.tx;
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: rework this to use a lambda that returns the tx

@PastaPastaPasta
Copy link
Member

@coderabbitai can you generate the Sequence Diagram for the new architecture?

Copy link

coderabbitai bot commented Jul 15, 2025

Tip

For best results, initiate chat on the files or code changes.

@PastaPastaPasta I'll generate a sequence diagram showing the new InstantSend architecture after the refactoring. Let me create a diagram that illustrates the key interactions between the components.

sequenceDiagram
    participant TxPool as Transaction Pool
    participant ISMgr as CInstantSendManager
    participant ISSigner as InstantSendSigner
    participant ISDb as CInstantSendDb
    participant QuorumMgr as CQuorumManager
    participant SigningMgr as CSigningManager
    participant SigSharesMgr as CSigSharesManager
    participant PeerMgr as PeerManager

    Note over TxPool, PeerMgr: New Transaction Processing Flow

    TxPool->>ISMgr: TransactionAddedToMempool()
    ISMgr->>ISSigner: ProcessTx()
    ISSigner->>ISSigner: CheckCanLock()
    
    alt Transaction can be locked
        ISSigner->>ISSigner: TrySignInputLocks()
        ISSigner->>QuorumMgr: GetQuorumForSigning()
        QuorumMgr-->>ISSigner: Return quorum info
        ISSigner->>SigningMgr: AsyncSignIfMember()
        SigningMgr->>SigSharesMgr: ProcessMessage()
        
        Note over ISSigner, SigningMgr: Input Lock Recovery
        SigningMgr-->>ISSigner: HandleNewInputLockRecoveredSig()
        ISSigner->>ISSigner: All inputs locked?
        
        alt All inputs have recovered signatures
            ISSigner->>ISSigner: TrySignInstantSendLock()
            ISSigner->>QuorumMgr: GetQuorumForSigning()
            QuorumMgr-->>ISSigner: Return quorum info
            ISSigner->>SigningMgr: AsyncSignIfMember()
            
            Note over ISSigner, SigningMgr: InstantSend Lock Recovery
            SigningMgr-->>ISSigner: HandleNewInstantSendLockRecoveredSig()
            ISSigner->>ISDb: WriteNewInstantSendLock()
            ISDb->>ISDb: Update caches
            ISSigner-->>ISMgr: Lock created
            ISMgr->>PeerMgr: Broadcast lock
        end
    end

    Note over TxPool, PeerMgr: Incoming InstantSend Lock Processing

    PeerMgr->>ISMgr: ProcessMessageInstantSendLock()
    ISMgr->>ISDb: KnownInstantSendLock()
    ISDb-->>ISMgr: Lock status
    
    alt Lock not known
        ISMgr->>ISMgr: ProcessInstantSendLock()
        ISMgr->>ISDb: WriteNewInstantSendLock()
        ISDb->>ISDb: Update caches
        ISMgr->>ISMgr: RemoveMempoolConflictsForLock()
        ISMgr->>TxPool: Remove conflicting transactions
    end

    Note over TxPool, PeerMgr: Block Connection Events

    ISMgr->>ISMgr: BlockConnected()
    ISMgr->>ISDb: WriteBlockInstantSendLocks()
    ISDb->>ISDb: Mark locks as mined
    ISMgr->>ISDb: RemoveConfirmedInstantSendLocks()
    ISDb->>ISDb: Cleanup old locks

    Note over TxPool, PeerMgr: Query Operations

    ISMgr->>ISDb: GetInstantSendLockByTxid()
    ISDb-->>ISMgr: Return lock
    ISMgr->>ISDb: GetInstantSendLockByInput()
    ISDb-->>ISMgr: Return lock
    ISMgr->>ISDb: GetInstantSendLockCount()
    ISDb-->>ISMgr: Return count
Loading

This sequence diagram illustrates the key aspects of the new InstantSend architecture:

Key Changes in the New Architecture:

  1. Separation of Concerns: The InstantSendSigner now handles all signing logic, while CInstantSendManager focuses on coordination and networking.

  2. Database Isolation: CInstantSendDb is a dedicated component for persistent storage with its own caching layer.

  3. Simplified Manager: CInstantSendManager delegates complex signing operations to InstantSendSigner.

  4. Cleaner Integration: The components interact through well-defined interfaces, making it easier to isolate non-networking code for libbitcoinkernel.

Main Flow:

  • Transaction processing starts in the manager but is delegated to the signer
  • The signer handles input lock creation and InstantSend lock signing
  • Database operations are encapsulated in the dedicated DB component
  • Conflict resolution and mempool management remain in the manager

This architecture better separates networking-dependent code (in llmq namespace) from validation logic (in instantsend namespace), supporting the goal of extracting validation code into a lightweight library.


🧠 Learnings used
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.

@PastaPastaPasta
Copy link
Member

generally LGTM; a few minor changes to do.

Copy link

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

♻️ Duplicate comments (4)
src/instantsend/db.h (1)

33-70: Fix clang-format issues and member initialization.

The code has clang-format violations that need to be addressed, and the member initialization should use proper brace initialization.

Apply this fix for the member initialization:

-    int best_confirmed_height GUARDED_BY(cs_db) {0};
+    int best_confirmed_height GUARDED_BY(cs_db){0};

Please run clang-format on the entire file to fix the formatting issues.

src/instantsend/instantsend.h (1)

63-63: Fix clang-format violation.

The line has a clang-format violation that needs to be addressed.

Please run clang-format on this file to fix the formatting issue.

src/instantsend/db.cpp (2)

12-18: Make database constants constexpr for better performance.

These constants should be constexpr since they're initialized with string literals and never change.

Apply this diff:

-static const std::string_view DB_ARCHIVED_BY_HASH = "is_a2";
-static const std::string_view DB_ARCHIVED_BY_HEIGHT_AND_HASH = "is_a1";
-static const std::string_view DB_HASH_BY_OUTPOINT = "is_in";
-static const std::string_view DB_HASH_BY_TXID = "is_tx";
-static const std::string_view DB_ISLOCK_BY_HASH = "is_i";
-static const std::string_view DB_MINED_BY_HEIGHT_AND_HASH = "is_m";
-static const std::string_view DB_VERSION = "is_v";
+static constexpr std::string_view DB_ARCHIVED_BY_HASH = "is_a2";
+static constexpr std::string_view DB_ARCHIVED_BY_HEIGHT_AND_HASH = "is_a1";
+static constexpr std::string_view DB_HASH_BY_OUTPOINT = "is_in";
+static constexpr std::string_view DB_HASH_BY_TXID = "is_tx";
+static constexpr std::string_view DB_ISLOCK_BY_HASH = "is_i";
+static constexpr std::string_view DB_MINED_BY_HEIGHT_AND_HASH = "is_m";
+static constexpr std::string_view DB_VERSION = "is_v";

283-290: Remove redundant database read attempts.

The code redundantly attempts to read and deserialize the same data twice with identical logic. The second attempt will produce the same result as the first.

Apply this diff to remove the redundant read:

-    ret = std::make_shared<InstantSendLock>();
-    bool exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret);
-    if (!exists || (::SerializeHash(*ret) != hash)) {
-        ret = std::make_shared<InstantSendLock>();
-        exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret);
-        if (!exists || (::SerializeHash(*ret) != hash)) {
-            ret = nullptr;
-        }
-    }
+    ret = std::make_shared<InstantSendLock>();
+    bool exists = db->Read(std::make_tuple(DB_ISLOCK_BY_HASH, hash), *ret);
+    if (!exists || (::SerializeHash(*ret) != hash)) {
+        ret = nullptr;
+    }
🧹 Nitpick comments (1)
src/instantsend/db.cpp (1)

71-71: Consider using raw pointer to avoid shared_ptr copy overhead.

The RemoveInstantSendLock method only needs temporary read access to the lock data but currently takes a shared_ptr which involves copy overhead.

As suggested in past reviews, consider changing the signature to use a raw pointer since the method only needs temporary access and doesn't maintain ownership:

void RemoveInstantSendLock(CDBBatch& batch, const uint256& hash, const InstantSendLock* islock = nullptr, bool keep_cache = true)

This would require callers to use .get() on their shared_ptr but would eliminate the reference counting overhead for read-only access.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf2b2d and f12ef02.

📒 Files selected for processing (30)
  • src/instantsend/db.cpp (1 hunks)
  • src/instantsend/db.h (1 hunks)
  • src/instantsend/instantsend.cpp (20 hunks)
  • src/instantsend/instantsend.h (1 hunks)
  • src/instantsend/lock.cpp (1 hunks)
  • src/instantsend/lock.h (1 hunks)
  • src/instantsend/signing.cpp (1 hunks)
  • src/instantsend/signing.h (1 hunks)
  • src/interfaces/chain.h (2 hunks)
  • src/net_processing.cpp (2 hunks)
  • src/node/interfaces.cpp (2 hunks)
  • src/rpc/mining.cpp (0 hunks)
  • src/rpc/rawtransaction.cpp (2 hunks)
  • src/test/cachemap_tests.cpp (1 hunks)
  • src/test/cachemultimap_tests.cpp (1 hunks)
  • src/test/evo_islock_tests.cpp (3 hunks)
  • src/test/fuzz/process_message.cpp (0 hunks)
  • src/test/governance_validators_tests.cpp (1 hunks)
  • src/test/miner_tests.cpp (0 hunks)
  • src/test/ratecheck_tests.cpp (1 hunks)
  • src/validationinterface.cpp (1 hunks)
  • src/validationinterface.h (3 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)
💤 Files with no reviewable changes (3)
  • src/test/miner_tests.cpp
  • src/rpc/mining.cpp
  • src/test/fuzz/process_message.cpp
✅ Files skipped from review due to trivial changes (3)
  • src/test/cachemap_tests.cpp
  • src/test/cachemultimap_tests.cpp
  • src/zmq/zmqpublishnotifier.cpp
🚧 Files skipped from review as they are similar to previous changes (20)
  • src/test/governance_validators_tests.cpp
  • src/test/ratecheck_tests.cpp
  • src/zmq/zmqabstractnotifier.cpp
  • src/test/evo_islock_tests.cpp
  • src/rpc/rawtransaction.cpp
  • src/zmq/zmqnotificationinterface.cpp
  • src/validationinterface.cpp
  • src/wallet/wallet.h
  • src/zmq/zmqnotificationinterface.h
  • src/instantsend/lock.cpp
  • src/interfaces/chain.h
  • src/instantsend/lock.h
  • src/zmq/zmqpublishnotifier.h
  • src/validationinterface.h
  • src/zmq/zmqabstractnotifier.h
  • src/node/interfaces.cpp
  • src/wallet/wallet.cpp
  • src/instantsend/signing.cpp
  • src/instantsend/signing.h
  • src/net_processing.cpp
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.{cpp,h,cc,cxx,hpp}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
🧠 Learnings (5)
📓 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: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
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-10T16:26:00.371Z
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/instantsend/db.h (4)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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: knst
PR: dashpay/dash#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.
src/instantsend/instantsend.h (5)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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-10T16:26:00.371Z
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: knst
PR: dashpay/dash#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/instantsend/db.cpp (4)
Learnt from: knst
PR: dashpay/dash#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.
Learnt from: kwvg
PR: dashpay/dash#6629
File: src/evo/netinfo.h:248-256
Timestamp: 2025-05-10T00:54:30.887Z
Learning: The Dash codebase includes a specialization for serializing std::shared_ptr objects in src/serialize.h, which allows direct serialization of shared_ptr instances with stream operators.
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: 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.
src/instantsend/instantsend.cpp (8)
Learnt from: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
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: knst
PR: dashpay/dash#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.
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: kwvg
PR: dashpay/dash#6532
File: src/net.cpp:4329-4329
Timestamp: 2025-01-14T09:07:12.446Z
Learning: Keep suggestions focused on the scope of the current commit/PR. Avoid suggesting unrelated improvements that should be handled in separate PRs, even if technically valid.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: dashpay/dash#6629
File: src/test/evo_netinfo_tests.cpp:39-45
Timestamp: 2025-05-10T00:55:16.184Z
Learning: In Dash's validation testing for network entries, checking `IsTriviallyValid()` is specifically used to ensure all three validation methods (`AddEntry()`, `Validate()`, and `IsTriviallyValid()`) consistently work together rather than replacing one check with another. `AddEntry()` and `Validate()` handle the consensus rule checks, while `IsTriviallyValid()` confirms the basic validation steps.
🪛 GitHub Actions: Clang Diff Format Check
src/instantsend/db.h

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

src/instantsend/instantsend.h

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

src/instantsend/db.cpp

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

src/instantsend/instantsend.cpp

[error] 27-27: 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). (6)
  • GitHub Check: mac-build / Build source
  • GitHub Check: linux64_tsan-build / Build source
  • GitHub Check: arm-linux-build / Build source
  • GitHub Check: linux64_nowallet-build / Build source
  • GitHub Check: win64-build / Build source
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (18)
src/instantsend/db.cpp (1)

19-19: Fix clang-format violation.

The line has a clang-format violation that needs to be addressed.

Please run clang-format on this file to fix the formatting issue.

src/instantsend/instantsend.cpp (17)

5-5: LGTM: Include path reflects new structure

The include path change from llmq/instantsend.h to instantsend/instantsend.h correctly reflects the new directory structure after the refactoring.


16-23: LGTM: Includes properly organized for new architecture

The includes are properly organized to support the new architecture, with instantsend/signing.h for the new signing component and the necessary LLMQ headers maintained for continued integration.


41-53: LGTM: Modern C++20 concepts implementation

The template function correctly uses C++20 concepts with requires clause, which provides better error messages and aligns with modern C++ best practices. The implementation is clean and efficient.


55-72: LGTM: Constructor properly integrates new signer architecture

The constructor correctly integrates the new InstantSendSigner component, conditionally creating it only for masternodes. The parameter forwarding and initialization are appropriate for the new architecture.


85-88: LGTM: Signer lifecycle management

The Start method properly manages the signer lifecycle by calling m_signer->Start() when the signer is available.


92-94: LGTM: Consistent signer lifecycle management

The Stop method properly manages the signer lifecycle by calling m_signer->Stop() before stopping the work thread.


110-110: LGTM: Type update to new InstantSendLock

The type change from llmq::CInstantSendLock to instantsend::InstantSendLock is consistent with the namespace refactoring.


355-357: LGTM: Signer integration for queue management

The code correctly delegates to the signer for clearing locks from the queue when the signer is available, maintaining proper separation of concerns.


427-427: LGTM: Masternode status check

The masternode status check using m_signer != nullptr is appropriate and consistent with the new architecture.


456-458: LGTM: Transaction processing delegation

The code correctly delegates transaction processing to the signer when available, maintaining the proper separation between manager and signing responsibilities.


497-499: LGTM: Retroactive transaction processing

The code correctly delegates retroactive transaction processing to the signer for block-connected transactions, maintaining consistency with the new architecture.


602-605: LGTM: Conflict resolution with signer integration

The method correctly delegates input clearing to the signer when available, ensuring proper queue management during conflict resolution.


607-616: LGTM: Signature truncation with signer integration

The method correctly integrates signer queue clearing with signature truncation, maintaining consistency in the cleanup process.


618-625: LGTM: Pending lock management

The method correctly manages pending locks with appropriate duplicate checking and locking mechanisms.


721-721: LGTM: Masternode status check consistency

The masternode status check using m_signer != nullptr is consistent with the pattern used throughout the refactored code.


925-947: LGTM: Modern lambda-based work loop

The refactored work loop using an immediately invoked lambda expression (IIFE) is more modern and readable than the previous do...while(0) pattern. The performance characteristics remain identical while improving code clarity.


1-1: Please run clang-format locally to fix formatting in src/instantsend/instantsend.cpp

I wasn’t able to verify formatting changes in the CI environment (no clang-format installed). Please confirm and apply clang-format, for example:

clang-format -i src/instantsend/instantsend.cpp

Then re-run the pipeline to ensure no formatting diffs remain.

Copy link

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

♻️ Duplicate comments (8)
src/instantsend/db.h (1)

33-33: Fix clang-format issue.

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

src/instantsend/instantsend.h (1)

9-9: Fix clang-format issue.

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

src/instantsend/signing.cpp (2)

31-31: Use constexpr for compile-time constant.

This constant should be declared as constexpr instead of const since it's a compile-time constant.

-static const std::string_view INPUTLOCK_REQUESTID_PREFIX = "inlock";
+static constexpr std::string_view INPUTLOCK_REQUESTID_PREFIX = "inlock";

48-48: Fix clang-format issue.

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

src/instantsend/signing.h (4)

50-50: Fix clang-format issue.

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


42-42: Fix the typo in the mutex name.

The mutex name has a typo: cs_inputReqests should be cs_inputRequests.

-    mutable Mutex cs_inputReqests;
+    mutable Mutex cs_inputRequests;

49-49: Update GUARDED_BY annotation to use correct mutex name.

This should use the corrected mutex name cs_inputRequests.

-    std::unordered_set<uint256, StaticSaltedHasher> inputRequestIds GUARDED_BY(cs_inputReqests);
+    std::unordered_set<uint256, StaticSaltedHasher> inputRequestIds GUARDED_BY(cs_inputRequests);

77-77: Update EXCLUSIVE_LOCKS_REQUIRED annotation to use correct mutex name.

This should use the corrected mutex name cs_inputRequests.

-        EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
+        EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputRequests);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f12ef02 and 6360725.

📒 Files selected for processing (48)
  • src/Makefile.am (2 hunks)
  • src/bench/rpc_blockchain.cpp (1 hunks)
  • src/coinjoin/coinjoin.cpp (1 hunks)
  • src/dsnotificationinterface.cpp (1 hunks)
  • src/evo/chainhelper.cpp (1 hunks)
  • src/init.cpp (1 hunks)
  • src/instantsend/db.cpp (1 hunks)
  • src/instantsend/db.h (1 hunks)
  • src/instantsend/instantsend.cpp (20 hunks)
  • src/instantsend/instantsend.h (1 hunks)
  • src/instantsend/lock.cpp (1 hunks)
  • src/instantsend/lock.h (1 hunks)
  • src/instantsend/signing.cpp (1 hunks)
  • src/instantsend/signing.h (1 hunks)
  • src/interfaces/chain.h (2 hunks)
  • src/llmq/chainlocks.cpp (1 hunks)
  • src/llmq/context.cpp (1 hunks)
  • src/llmq/context.h (1 hunks)
  • src/llmq/instantsend.h (0 hunks)
  • src/net_processing.cpp (2 hunks)
  • src/node/interfaces.cpp (2 hunks)
  • src/node/miner.cpp (1 hunks)
  • src/rest.cpp (1 hunks)
  • src/rpc/blockchain.cpp (1 hunks)
  • src/rpc/mempool.cpp (1 hunks)
  • src/rpc/mining.cpp (0 hunks)
  • src/rpc/rawtransaction.cpp (2 hunks)
  • src/test/cachemap_tests.cpp (1 hunks)
  • src/test/cachemultimap_tests.cpp (1 hunks)
  • src/test/evo_deterministicmns_tests.cpp (1 hunks)
  • src/test/evo_islock_tests.cpp (3 hunks)
  • src/test/fuzz/process_message.cpp (0 hunks)
  • src/test/governance_validators_tests.cpp (1 hunks)
  • src/test/miner_tests.cpp (0 hunks)
  • src/test/ratecheck_tests.cpp (1 hunks)
  • src/txmempool.cpp (1 hunks)
  • src/validationinterface.cpp (1 hunks)
  • src/validationinterface.h (3 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/rpc/mining.cpp
  • src/test/miner_tests.cpp
  • src/llmq/instantsend.h
✅ Files skipped from review due to trivial changes (10)
  • src/test/cachemultimap_tests.cpp
  • src/bench/rpc_blockchain.cpp
  • src/dsnotificationinterface.cpp
  • src/rpc/blockchain.cpp
  • src/test/cachemap_tests.cpp
  • src/test/ratecheck_tests.cpp
  • src/llmq/context.h
  • src/test/evo_deterministicmns_tests.cpp
  • src/rpc/mempool.cpp
  • src/node/miner.cpp
🚧 Files skipped from review as they are similar to previous changes (29)
  • src/test/governance_validators_tests.cpp
  • src/evo/chainhelper.cpp
  • src/rest.cpp
  • src/llmq/context.cpp
  • test/util/data/non-backported.txt
  • src/coinjoin/coinjoin.cpp
  • src/llmq/chainlocks.cpp
  • src/txmempool.cpp
  • src/zmq/zmqnotificationinterface.h
  • src/init.cpp
  • src/rpc/rawtransaction.cpp
  • src/zmq/zmqabstractnotifier.cpp
  • src/wallet/wallet.h
  • src/test/evo_islock_tests.cpp
  • src/interfaces/chain.h
  • src/instantsend/lock.cpp
  • src/node/interfaces.cpp
  • src/net_processing.cpp
  • src/zmq/zmqnotificationinterface.cpp
  • src/validationinterface.cpp
  • src/wallet/wallet.cpp
  • src/instantsend/lock.h
  • src/Makefile.am
  • src/zmq/zmqpublishnotifier.h
  • test/lint/lint-circular-dependencies.py
  • src/zmq/zmqabstractnotifier.h
  • src/zmq/zmqpublishnotifier.cpp
  • src/validationinterface.h
  • src/instantsend/db.cpp
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.{cpp,h,cc,cxx,hpp}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • CLAUDE.md
🧠 Learnings (6)
📓 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: kwvg
PR: dashpay/dash#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-10T16:26:00.371Z
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-10T16:26:00.371Z
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/instantsend/signing.cpp (4)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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: knst
PR: dashpay/dash#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/instantsend/db.h (4)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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: knst
PR: dashpay/dash#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.
src/instantsend/signing.h (4)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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: knst
PR: dashpay/dash#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/instantsend/instantsend.h (4)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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: dashpay/dash#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-10T16:26:00.371Z
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/instantsend.cpp (8)
Learnt from: kwvg
PR: dashpay/dash#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: dashpay/dash#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.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: 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: kwvg
PR: dashpay/dash#6532
File: src/net.cpp:4329-4329
Timestamp: 2025-01-14T09:07:12.446Z
Learning: Keep suggestions focused on the scope of the current commit/PR. Avoid suggesting unrelated improvements that should be handled in separate PRs, even if technically valid.
Learnt from: CR
PR: dashpay/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-10T16:26:00.371Z
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: dashpay/dash#6629
File: src/test/evo_netinfo_tests.cpp:39-45
Timestamp: 2025-05-10T00:55:16.184Z
Learning: In Dash's validation testing for network entries, checking `IsTriviallyValid()` is specifically used to ensure all three validation methods (`AddEntry()`, `Validate()`, and `IsTriviallyValid()`) consistently work together rather than replacing one check with another. `AddEntry()` and `Validate()` handle the consensus rule checks, while `IsTriviallyValid()` confirms the basic validation steps.
🧬 Code Graph Analysis (3)
src/instantsend/db.h (1)
src/instantsend/db.cpp (6)
  • CInstantSendDb (28-32)
  • CInstantSendDb (34-34)
  • GetInstantSendLockByHashInternal (270-293)
  • GetInstantSendLockByHashInternal (270-270)
  • GetInstantSendLockHashByTxidInternal (295-306)
  • GetInstantSendLockHashByTxidInternal (295-295)
src/instantsend/signing.h (6)
src/validation.h (1)
  • chainstate (371-377)
src/instantsend/signing.cpp (2)
  • InstantSendSigner (33-47)
  • InstantSendSigner (49-49)
src/instantsend/instantsend.h (9)
  • islock (117-117)
  • tx (111-111)
  • tx (115-115)
  • tx (133-133)
  • tx (139-139)
  • txHash (131-131)
  • txHash (132-132)
  • txid (113-113)
  • txid (147-147)
src/validationinterface.h (4)
  • tx (152-152)
  • tx (152-152)
  • tx (166-166)
  • tx (166-166)
src/instantsend/db.h (4)
  • outpoint (149-149)
  • txid (77-77)
  • txid (133-133)
  • txid (143-143)
src/node/interfaces.cpp (6)
  • txid (892-897)
  • txid (892-892)
  • txid (898-904)
  • txid (898-898)
  • txid (913-918)
  • txid (913-913)
src/instantsend/instantsend.cpp (5)
src/net_processing.cpp (11)
  • ret (657-657)
  • ret (658-658)
  • hash (986-986)
  • hash (992-992)
  • from (1018-1018)
  • tx (1043-1043)
  • id (676-676)
  • id (680-680)
  • txid (637-637)
  • txid (652-652)
  • txid (654-654)
src/instantsend/instantsend.h (19)
  • CInstantSendManager (89-92)
  • CInstantSendManager (93-93)
  • islock (117-117)
  • hash (145-145)
  • hash (155-155)
  • from (108-108)
  • peerman (95-95)
  • peerman (101-101)
  • peerman (119-119)
  • peerman (124-124)
  • peerman (137-137)
  • tx (111-111)
  • tx (115-115)
  • tx (133-133)
  • tx (139-139)
  • islockHash (121-121)
  • islockHash (154-154)
  • txid (113-113)
  • txid (147-147)
src/instantsend/signing.cpp (2)
  • Stop (56-59)
  • Stop (56-56)
src/llmq/chainlocks.cpp (2)
  • Stop (78-82)
  • Stop (78-78)
src/instantsend/db.cpp (2)
  • GetInstantSendLockByTxid (308-312)
  • GetInstantSendLockByTxid (308-308)
🪛 GitHub Actions: Clang Diff Format Check
src/instantsend/signing.cpp

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

src/instantsend/db.h

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

src/instantsend/signing.h

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

src/instantsend/instantsend.h

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

src/instantsend/instantsend.cpp

[error] 27-27: Clang format differences found. Code formatting does not match the expected style. 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). (9)
  • GitHub Check: linux64_tsan-build / Build source
  • GitHub Check: linux64_ubsan-build / Build source
  • GitHub Check: linux64_sqlite-build / Build source
  • GitHub Check: linux64-build / Build source
  • GitHub Check: linux64_fuzz-build / Build source
  • GitHub Check: linux64_nowallet-build / Build source
  • GitHub Check: arm-linux-build / Build source
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-w64-mingw32 / Build depends
🔇 Additional comments (26)
src/instantsend/instantsend.cpp (26)

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

The include path change from llmq/instantsend.h to instantsend/instantsend.h correctly reflects the new directory structure.


16-23: LGTM: New includes support the refactored architecture.

The additional includes for instantsend/signing.h and other dependencies are necessary to support the split of functionality into separate components.


40-53: LGTM: Excellent use of C++20 concepts.

The refactoring to use requires std::same_as<T, CTxIn> || std::same_as<T, COutPoint> instead of static_assert is a modern C++20 improvement that provides better error messages and clearer type constraints.


55-72: LGTM: Constructor properly delegates to new components.

The conditional creation of InstantSendSigner only for masternodes is correct, and the use of std::make_unique with proper parameter forwarding demonstrates good modern C++ practices.


85-88: LGTM: Start method properly delegates to signer.

The conditional starting of the signer component when it exists is correct and follows the delegation pattern consistently.


92-95: LGTM: Stop method properly delegates to signer.

The conditional stopping of the signer component mirrors the Start method and ensures proper cleanup of the signing subsystem.


110-110: LGTM: Correctly uses new InstantSendLock type.

The change from llmq::CInstantSendLock to instantsend::InstantSendLock is consistent with the namespace refactoring.


122-122: LGTM: Parameter type correctly updated.

The parameter type change to instantsend::InstantSendLockPtr is consistent with the refactoring and maintains type safety.


242-242: LGTM: Method signature correctly updated.

The parameter type change to use instantsend::InstantSendLockPtr in the method signature is consistent with the refactoring.


351-357: LGTM: Method properly delegates to signer component.

The signature update to use instantsend::InstantSendLockPtr and the conditional delegation to m_signer->ClearLockFromQueue() correctly implements the separation of concerns.


427-427: LGTM: Correctly uses signer existence check.

The /*is_masternode=*/m_signer != nullptr parameter correctly determines masternode status based on signer existence.


437-437: LGTM: Type correctly updated.

The type change to instantsend::InstantSendLockPtr is consistent with the refactoring.


456-459: LGTM: Method properly delegates to signer.

The conditional delegation to m_signer->ProcessTx() correctly implements the separation of transaction processing logic.


472-472: LGTM: Type correctly updated.

The type change to instantsend::InstantSendLockPtr is consistent with the refactoring.


497-499: LGTM: Method properly delegates to signer.

The conditional delegation to m_signer->ProcessTx() correctly implements the separation of transaction processing logic for block-connected transactions.


602-616: LGTM: Methods properly delegate to signer.

The conditional delegation to m_signer->ClearInputsFromQueue() in both methods correctly implements the separation of signing-related logic. The signature update to use instantsend::InstantSendLock is consistent with the refactoring.


925-947: LGTM: Excellent refactoring to use lambda pattern.

The immediately invoked lambda expression (IIFE) is a modern and cleaner approach compared to the previous do...while(0) pattern. The conditional delegation to m_signer->ProcessPendingRetryLockTxs() correctly implements the separation of retry logic.


618-625: LGTM: Method signature correctly updated.

The signature update to use instantsend::InstantSendLockPtr is consistent with the refactoring.


692-692: LGTM: Parameter type correctly updated.

The parameter type change to instantsend::InstantSendLock is consistent with the refactoring.


721-721: LGTM: Correctly uses signer existence check.

The /*is_masternode=*/m_signer != nullptr parameter correctly determines masternode status based on signer existence.


725-725: LGTM: Parameter type correctly updated.

The parameter type change to instantsend::InstantSendLock is consistent with the refactoring.


813-813: LGTM: Parameter type correctly updated.

The parameter type change to instantsend::InstantSendLock is consistent with the refactoring.


836-836: LGTM: Return type correctly updated.

The return type change to instantsend::InstantSendLock is consistent with the refactoring.


861-861: LGTM: Return type correctly updated.

The return type change to instantsend::InstantSendLockPtr is consistent with the refactoring.


898-898: LGTM: Return type correctly updated.

The return type change to instantsend::InstantSendLockPtr is consistent with the refactoring.


27-27: Fix clang-format issue.

The pipeline failure indicates formatting differences on this line. Please run clang-format to fix the formatting issue.

void ProcessPendingRetryLockTxs(const std::vector<CTransactionRef>& retryTxs)
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
void ProcessTx(const CTransaction& tx, bool fRetroactive, const Consensus::Params& params)
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update EXCLUSIVE_LOCKS_REQUIRED annotation to use correct mutex name.

This should use the corrected mutex name cs_inputRequests.

-        EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
+        EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputRequests);
📝 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
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputRequests);
🤖 Prompt for AI Agents
In src/instantsend/signing.h at line 82, the EXCLUSIVE_LOCKS_REQUIRED annotation
uses the incorrect mutex name 'cs_inputReqests'. Update this annotation to use
the correct mutex name 'cs_inputRequests' to fix the typo.

void Stop();

void ClearInputsFromQueue(const std::unordered_set<uint256, StaticSaltedHasher>& ids)
EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update EXCLUSIVE_LOCKS_REQUIRED annotation to use correct mutex name.

This should use the corrected mutex name cs_inputRequests.

-        EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests);
+        EXCLUSIVE_LOCKS_REQUIRED(!cs_inputRequests);
📝 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
EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests);
EXCLUSIVE_LOCKS_REQUIRED(!cs_inputRequests);
🤖 Prompt for AI Agents
In src/instantsend/signing.h at line 71, the EXCLUSIVE_LOCKS_REQUIRED annotation
uses an incorrect mutex name `cs_inputReqests`. Update this annotation to use
the correct mutex name `cs_inputRequests` to ensure proper lock requirement
specification.


[[nodiscard]] bool TrySignInputLocks(const CTransaction& tx, bool allowResigning, Consensus::LLMQType llmqType,
const Consensus::Params& params)
EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update EXCLUSIVE_LOCKS_REQUIRED annotation to use correct mutex name.

This should use the corrected mutex name cs_inputRequests.

-        EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests);
+        EXCLUSIVE_LOCKS_REQUIRED(!cs_inputRequests);
📝 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
EXCLUSIVE_LOCKS_REQUIRED(!cs_inputReqests);
EXCLUSIVE_LOCKS_REQUIRED(!cs_inputRequests);
🤖 Prompt for AI Agents
In src/instantsend/signing.h at line 98, the EXCLUSIVE_LOCKS_REQUIRED annotation
uses an incorrect mutex name 'cs_inputReqests'. Update this annotation to use
the correct mutex name 'cs_inputRequests' to ensure proper lock requirement
specification.

EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);

void ProcessPendingRetryLockTxs(const std::vector<CTransactionRef>& retryTxs)
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update EXCLUSIVE_LOCKS_REQUIRED annotation to use correct mutex name.

This should use the corrected mutex name cs_inputRequests.

-        EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
+        EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputRequests);
📝 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
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputReqests);
EXCLUSIVE_LOCKS_REQUIRED(!cs_creating, !cs_inputRequests);
🤖 Prompt for AI Agents
In src/instantsend/signing.h at line 80, the EXCLUSIVE_LOCKS_REQUIRED annotation
uses the incorrect mutex name cs_inputReqests. Update the annotation to use the
correct mutex name cs_inputRequests to fix the typo.

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK6 360725db965101dd99dd975257f15001e508bef; I found code rabbit's sequence diagram helpful for this PR to understand the new structure a bit more.

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK 6360725

@PastaPastaPasta PastaPastaPasta merged commit 7a549c4 into dashpay:develop Jul 18, 2025
54 of 60 checks passed
PastaPastaPasta added a commit that referenced this pull request Jul 26, 2025
…ons, avoid redundant transaction queries

f488c43 fix: remove unnecessary tx fetching in `RemoveMempoolConflictsForLock` (Kittywhiskers Van Gogh)
dd54011 refactor: move inexpensive checks earlier in `ProcessInstantSendLock()` (Kittywhiskers Van Gogh)
c86d886 refactor: abstract away InstantSend parent implementation from signer (Kittywhiskers Van Gogh)
cbfd325 refactor: avoid shared_ptr copies in `{WriteNew,Remove}InstantSendLock()` (Kittywhiskers Van Gogh)
234a16a refactor: use unordered set for faster duplicates checking (Kittywhiskers Van Gogh)
0459848 refactor: `constexpr` static string definitions (Kittywhiskers Van Gogh)
710c504 refactor: s/cs_inputReqests/cs_input_requests/g (Kittywhiskers Van Gogh)
31065d1 chore: mark `hashBlock` as unused in `HandleNewInputLockRecoveredSig()` (Kittywhiskers Van Gogh)
cf47f14 chore: apply most `clang-format` suggestions (Kittywhiskers Van Gogh)
63371e0 trivial: move forward declaration above `using` declarations (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependent on #6742

  * This pull request aims to address reviewer concerns raised during [dash#6742](#6742), the following changes were made with that in mind
    * Marking unused variable `hashBlock` by prefixing with underscore, [comment](#6742 (comment))
    * Correct typo in variable name `cs_inputReqests` (now `cs_input_requests`, [comment](#6770 (comment))), [comment](#6742 (comment))
    * Using `constexpr` for `std::string_view`s, [comment](#6742 (comment))
    * Utilizing a faster way to validate uniqueness of entries (`std::unordered_set`), [comment](#6742 (comment)). The construction of the unordered set is inspired by similar usage in `policy/package.cpp` ([source](https://github.com/dashpay/dash/blob/f648039258d2192ec5e505721e34edaa0bda568c/src/policy/packages.cpp#L51)).
    * Avoiding unnecessary `std::shared_ptr` copying (`InstantSendLockPtr` is a `std::shared_ptr<InstantSendLock>`), [comment](#6742 (comment))
    * Resolving circular dependency by cherry-picking 1e2e854, [comment](#6742 (comment)) but has been renamed to `InstantSendSignerParent`. For rationale, see [comment](#6761 (comment)).

  * Additionally, optimizations have been made to `ProcessInstantSendLock()`
    * The _cheaper_ database checks have been moved _earlier_ in the function to allow for faster bail-out. This is alongside consolidating network requests to the tail of the function and general cleanup for better clarity.

    * Dropping the peer request for a transaction we know about in `RemoveMempoolConflictsForLock()` (introduced in [dash#2898](#2898)) as `ProcessInstantSendLock()` calls it when we _know_ about the transaction and seek to remove conflicts ([source](https://github.com/dashpay/dash/blob/f648039258d2192ec5e505721e34edaa0bda568c/src/instantsend/instantsend.cpp#L419-L420))

      The only other caller, `TransactionAddedToMempool()` calls it when we have knowledge of the transaction and want to purge conflicts from the mempool ([source](https://github.com/dashpay/dash/blob/f648039258d2192ec5e505721e34edaa0bda568c/src/instantsend/instantsend.cpp#L455-L463)).

      In both cases, we already know the _good_ transaction. Additionally, tests introduced in [dash#2898](#2898) still pass ([source](https://github.com/dashpay/dash/blob/f648039258d2192ec5e505721e34edaa0bda568c/test/functional/p2p_instantsend.py#L95-L142)), indicating a lack of regression but this change may require additional scrutiny.

  ## 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:
  PastaPastaPasta:
    utACK f488c43
  knst:
    utACK f488c43
  UdjinM6:
    utACK f488c43

Tree-SHA512: dcd153e14747639f8dbbbd5c3bea1123e4f84f82884787992e20f494227913763bf19a73b485e345dddb63ad551c856bc56dcad72e67304f84df60cb76deaa74
PastaPastaPasta added a commit that referenced this pull request Aug 5, 2025
…split masternode logic out of manager source

fd8af9c refactor: abstract away ChainLocks parent implementation from signer (Kittywhiskers Van Gogh)
733f7d3 refactor: remove `Internal*()` function definitions, consolidate (Kittywhiskers Van Gogh)
e742b7b refactor: remove need for mutual access to private members (Kittywhiskers Van Gogh)
74c1b28 refactor: separate masternode mode logic into dedicated manager class (Kittywhiskers Van Gogh)
f469c46 refactor: inline single-use `ChainLocksSigningEnabled()` definition (Kittywhiskers Van Gogh)
7e0a3f8 refactor: move masternode mode logic to `chainlock/signer.{cpp,h}` (Kittywhiskers Van Gogh)
5663eac refactor: split `Cleanup()`'s masternode and non-masternode concerns (Kittywhiskers Van Gogh)
ef15fee refactor: cleanup `src/chainlock/clsig.*`, move to dedicated namespace (Kittywhiskers Van Gogh)
021062c refactor: `llmq/chainlocks.{cpp,h}` > `chainlock/chainlock.{cpp,h}` (Kittywhiskers Van Gogh)
f10912b refactor: `llmq/clsig.{cpp,h}` > `chainlock/clsig.{cpp,h}` (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  A continuation of [dash#6742](#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 `chainlock` namespace.

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

  ## 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 fd8af9c

Tree-SHA512: b9de697d2c3d762824449972ce206ccfca9d878a9a8c1cf38efdb9223ee563dd7305a00ebd80ddb09bc8805133b8b5e45fbbc5e472d23b4bd710454c1048be22
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.

4 participants