-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: bitcoin#22235, #23635, #23662, #24147, #24152, #24538, #24786, #24796, #24906, #25043, #25067 #6871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
WalkthroughAdds a full Miniscript front-end (public miniscript.h API, internal implementation, parsing/decoding, script decomposition, script-number parsing, extensive unit tests and fuzzers) and wires it into build and test targets. Implements package-level feerate computation and propagation through mempool acceptance APIs/results (new ATMPArgs flag, PackageMempoolAcceptResult field/ctor, package validation paths, and many tests). Moves minimal-push validation into script.{h,cpp} (adds CheckMinimalPush, BuildScript, CScriptNum::GetInt64) and removes the prior interpreter CheckMinimalPush. Tightens -rpcauth parsing and adds functional tests. Miscellaneous: CI/Docker bumps, OpenBSD/doc/devtools updates, wallet RPC switched to scriptPubKey filtering, miner fee accounting tweak, small formatting and forward-declaration adjustments. Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/validationinterface.cpp (1)
282-320
: Forwardid
to validation callbacks
NotifyChainLock
,NotifyGovernanceVote
,NotifyGovernanceObject
, andNotifyRecoveredSig
now accept anid
, but the lambdas never capture or forward it. Callers relying on the new identifier won’t see it, and onceCValidationInterface
is updated this will miscompile. Please propagateid
through the lambdas.- auto event = [pindex, clsig, this] { - m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyChainLock(pindex, clsig); }); + auto event = [pindex, clsig, id, this] { + m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyChainLock(pindex, clsig, id); }); }; @@ - auto event = [vote, tip_mn_list, this] { - m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyGovernanceVote(tip_mn_list, vote); }); + auto event = [vote, tip_mn_list, id, this] { + m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyGovernanceVote(tip_mn_list, vote, id); }); }; @@ - auto event = [object, this] { - m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyGovernanceObject(object); }); + auto event = [object, id, this] { + m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyGovernanceObject(object, id); }); }; @@ - auto event = [sig, this] { - m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyRecoveredSig(sig); }); + auto event = [sig, id, this] { + m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyRecoveredSig(sig, id); }); };src/validationinterface.h (1)
235-239
: Include<string>
for the new id parameters.
std::string
is now used in this header but<string>
is not included, so any translation unit that includesvalidationinterface.h
before pulling in<string>
will fail to compile. Please add the missing include.#include <functional> #include <memory> +#include <string>
🧹 Nitpick comments (2)
contrib/devtools/README.md (1)
93-106
: Consider using fenced code blocks for consistency.The documentation for
gen-dash-conf.sh
is clear and helpful. However, the code blocks on lines 97 and 103 use indented style rather than fenced (```) style, which is flagged by markdownlint and is less consistent with modern markdown conventions.Based on static analysis hints.
Consider applying this formatting adjustment:
-Generates a dash.conf file in `share/examples/` by parsing the output from `dashd--help`. This script is run during the +Generates a dash.conf file in `share/examples/` by parsing the output from `dashd --help`. This script is run during the release process to include a dash.conf with the release binaries and can also be run by users to generate a file locally. When generating a file as part of the release process, make sure to commit the changes after running the script. With in-tree builds this tool can be run from any directory within the repository. To use this tool with out-of-tree builds set `BUILDDIR`. For example: +```bash - - BUILDDIR=$PWD/build contrib/devtools/gen-dash-conf.sh +BUILDDIR=$PWD/build contrib/devtools/gen-dash-conf.sh +``` -Note: Also fixed a typo:
dashd--help
→dashd --help
on line 96.doc/policy/packages.md (1)
64-98
: LGTM: Package fees documentation is clear and well-reasoned.The new "Package Fees and Feerate" section effectively documents the package-level feerate policy. The explanations of:
- Feerate calculation excluding mempool transactions
- CPFP within packages
- Individual-first validation approach
- Rationale for policy decisions
are all clear and align with the implementation changes in
src/validation.h
and related files.Minor: Consider using fenced code blocks for consistency.
The static analysis tool suggests using fenced code blocks instead of indented blocks for better markdown consistency. While this is a minor formatting preference, fenced blocks (```) are more explicit and portable across markdown renderers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (49)
CONTRIBUTING.md
(2 hunks)README.md
(1 hunks)ci/lint/04_install.sh
(1 hunks)contrib/containers/ci/ci-slim.Dockerfile
(1 hunks)contrib/debian/examples/dash.conf
(1 hunks)contrib/devtools/README.md
(1 hunks)contrib/devtools/gen-dash-conf.sh
(1 hunks)contrib/guix/libexec/build.sh
(1 hunks)doc/build-openbsd.md
(1 hunks)doc/dash-conf.md
(1 hunks)doc/policy/packages.md
(1 hunks)doc/release-process.md
(1 hunks)src/Makefile.am
(2 hunks)src/Makefile.test.include
(2 hunks)src/bitcoin-tx.cpp
(1 hunks)src/httprpc.cpp
(2 hunks)src/init.cpp
(1 hunks)src/masternode/node.h
(1 hunks)src/node/chainstate.cpp
(1 hunks)src/node/miner.h
(1 hunks)src/psbt.cpp
(2 hunks)src/rest.cpp
(1 hunks)src/rpc/blockchain.cpp
(1 hunks)src/rpc/rawtransaction.cpp
(1 hunks)src/rpc/util.cpp
(2 hunks)src/script/interpreter.cpp
(0 hunks)src/script/interpreter.h
(0 hunks)src/script/miniscript.cpp
(1 hunks)src/script/miniscript.h
(1 hunks)src/script/script.cpp
(1 hunks)src/script/script.h
(2 hunks)src/script/sign.cpp
(4 hunks)src/script/sign.h
(2 hunks)src/script/standard.cpp
(0 hunks)src/script/standard.h
(1 hunks)src/test/fuzz/miniscript_decode.cpp
(1 hunks)src/test/fuzz/script_sign.cpp
(1 hunks)src/test/fuzz/tx_pool.cpp
(1 hunks)src/test/miner_tests.cpp
(5 hunks)src/test/miniscript_tests.cpp
(1 hunks)src/test/script_tests.cpp
(1 hunks)src/test/txpackage_tests.cpp
(9 hunks)src/validation.cpp
(12 hunks)src/validation.h
(2 hunks)src/validationinterface.cpp
(3 hunks)src/validationinterface.h
(1 hunks)src/wallet/rpc/backup.cpp
(2 hunks)src/wallet/rpc/coins.cpp
(3 hunks)test/functional/rpc_users.py
(1 hunks)
💤 Files with no reviewable changes (3)
- src/script/interpreter.cpp
- src/script/interpreter.h
- src/script/standard.cpp
🧰 Additional context used
📓 Path-based instructions (7)
doc/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the doc directory (documentation)
Files:
doc/release-process.md
doc/dash-conf.md
doc/policy/packages.md
doc/build-openbsd.md
test/functional/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Functional tests should be written in Python and placed in test/functional/
Files:
test/functional/rpc_users.py
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}
: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/node/chainstate.cpp
src/rest.cpp
src/rpc/util.cpp
src/test/script_tests.cpp
src/script/standard.h
src/script/script.h
src/test/miner_tests.cpp
src/script/script.cpp
src/test/txpackage_tests.cpp
src/init.cpp
src/masternode/node.h
src/script/sign.cpp
src/script/miniscript.cpp
src/node/miner.h
src/psbt.cpp
src/wallet/rpc/coins.cpp
src/validation.h
src/script/sign.h
src/wallet/rpc/backup.cpp
src/rpc/blockchain.cpp
src/httprpc.cpp
src/test/fuzz/tx_pool.cpp
src/test/miniscript_tests.cpp
src/validationinterface.h
src/rpc/rawtransaction.cpp
src/validation.cpp
src/test/fuzz/script_sign.cpp
src/test/fuzz/miniscript_decode.cpp
src/bitcoin-tx.cpp
src/validationinterface.cpp
src/script/miniscript.h
contrib/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the contrib directory (contributed scripts)
Files:
contrib/devtools/gen-dash-conf.sh
contrib/guix/libexec/build.sh
contrib/devtools/README.md
contrib/debian/examples/dash.conf
contrib/containers/ci/ci-slim.Dockerfile
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests for C++ code should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests
Files:
src/test/script_tests.cpp
src/test/miner_tests.cpp
src/test/txpackage_tests.cpp
src/test/fuzz/tx_pool.cpp
src/test/miniscript_tests.cpp
src/test/fuzz/script_sign.cpp
src/test/fuzz/miniscript_decode.cpp
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Masternode lists must use immutable data structures (Immer library) for thread safety
Files:
src/masternode/node.h
ci/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the ci directory (continuous integration)
Files:
ci/lint/04_install.sh
🧠 Learnings (1)
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
PR: dashpay/dash#6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.
Applied to files:
src/wallet/rpc/backup.cpp
🧬 Code graph analysis (19)
test/functional/rpc_users.py (1)
test/functional/test_framework/test_node.py (1)
assert_start_raises_init_error
(606-649)
src/rest.cpp (1)
src/node/transaction.cpp (2)
GetTransaction
(120-151)GetTransaction
(120-120)
src/test/script_tests.cpp (1)
src/script/sign.cpp (4)
ProduceSignature
(189-218)ProduceSignature
(189-189)MutableTransactionSignatureCreator
(20-24)MutableTransactionSignatureCreator
(26-32)
src/script/script.h (1)
src/script/script.cpp (2)
CheckMinimalPush
(386-409)CheckMinimalPush
(386-386)
src/test/txpackage_tests.cpp (2)
src/test/util/setup_common.cpp (4)
mineBlocks
(447-461)mineBlocks
(447-447)CreateValidMempoolTransaction
(544-591)CreateValidMempoolTransaction
(544-550)src/validation.cpp (2)
ProcessNewPackage
(1420-1438)ProcessNewPackage
(1420-1421)
src/script/miniscript.cpp (3)
src/script/script.h (4)
DecodeOP_N
(488-494)vector
(330-361)CScriptNum
(211-226)CScriptNum
(230-240)src/script/standard.h (1)
IsPushdataOp
(111-114)src/script/script.cpp (2)
CheckMinimalPush
(386-409)CheckMinimalPush
(386-386)
src/psbt.cpp (1)
src/script/sign.cpp (1)
creator
(327-327)
src/wallet/rpc/coins.cpp (2)
src/wallet/rpc/util.cpp (2)
LabelFromValue
(117-123)LabelFromValue
(117-117)src/wallet/scriptpubkeyman.h (1)
wallet
(28-227)
src/validation.h (1)
src/node/psbt.cpp (1)
feerate
(140-140)
src/script/sign.h (1)
src/script/sign.cpp (2)
MutableTransactionSignatureCreator
(20-24)MutableTransactionSignatureCreator
(26-32)
src/test/fuzz/tx_pool.cpp (1)
src/validation.cpp (2)
ProcessNewPackage
(1420-1438)ProcessNewPackage
(1420-1421)
src/test/miniscript_tests.cpp (2)
src/test/fuzz/miniscript_decode.cpp (8)
key
(24-27)key
(24-24)key
(28-30)key
(28-28)key
(31-34)key
(31-31)FromString
(37-41)FromString
(37-37)src/crypto/ripemd160.h (1)
CRIPEMD160
(12-26)
src/validationinterface.h (1)
src/validationinterface.cpp (2)
MainSignalsImpl
(47-47)MainSignalsImpl
(47-47)
src/rpc/rawtransaction.cpp (1)
src/script/sign.cpp (4)
ProduceSignature
(189-218)ProduceSignature
(189-189)MutableTransactionSignatureCreator
(20-24)MutableTransactionSignatureCreator
(26-32)
src/validation.cpp (1)
src/validation.h (1)
state
(169-194)
src/test/fuzz/miniscript_decode.cpp (1)
src/test/miniscript_tests.cpp (6)
key
(75-75)key
(75-75)key
(78-83)key
(78-78)FromString
(87-91)FromString
(87-87)
src/bitcoin-tx.cpp (2)
src/script/sign.cpp (4)
ProduceSignature
(189-218)ProduceSignature
(189-189)MutableTransactionSignatureCreator
(20-24)MutableTransactionSignatureCreator
(26-32)src/rpc/rawtransaction.cpp (1)
mergedTx
(863-863)
src/validationinterface.cpp (1)
src/net_processing.cpp (2)
scheduler
(625-625)scheduler
(676-676)
src/script/miniscript.h (2)
src/script/miniscript.cpp (12)
ComputeType
(38-251)ComputeType
(38-38)ComputeScriptLen
(253-284)ComputeScriptLen
(253-253)SanitizeType
(16-36)SanitizeType
(16-16)FindNextChar
(338-346)FindNextChar
(338-338)DecomposeScript
(286-321)DecomposeScript
(286-286)ParseScriptNumber
(323-336)ParseScriptNumber
(323-323)src/test/miniscript_tests.cpp (6)
key
(75-75)key
(75-75)key
(78-83)key
(78-78)FromString
(87-91)FromString
(87-87)
🪛 markdownlint-cli2 (0.18.1)
contrib/devtools/README.md
97-97: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
103-103: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
doc/policy/packages.md
97-97: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build container / Build container
🔇 Additional comments (22)
src/test/fuzz/tx_pool.cpp (1)
236-247
: LGTM! Proper handling of package-policy results.The conditional logic correctly guards per-transaction result verification when a package-policy issue occurs. This prevents potential assertion failures when
ProcessNewPackage
doesn't return per-transaction results due to package-level policy violations. The implementation aligns with the package-feerate policy changes introduced in this PR.src/node/miner.h (1)
138-138
: LGTM! Correctness improvement for fee accounting.Switching from
GetFee()
toGetModifiedFee()
ensures consistency with hownModFeesWithAncestors
is initialized (Line 63 usesGetModFeesWithAncestors()
, which tracks modified fees). When a parent is included in the block, subtracting its modified fee correctly updates the child's ancestor fee total, accounting for any fee prioritization.doc/release-process.md (1)
4-6
: LGTM! Branch reference updates are consistent.The checklist item URLs have been correctly updated to reference the
develop
branch instead ofmaster
, aligning with the repository's branch structure. The addition of thegen-dash-conf.sh
reference is consistent with the new script documented incontrib/devtools/README.md
.src/masternode/node.h (1)
14-14
: LGTM! Appropriate forward declaration for header decoupling.Adding the
CConnman
forward declaration here reduces header dependencies and follows best practices for modular design. This aligns with the broader effort noted in the AI summary to decouple components across the codebase.src/node/chainstate.cpp (1)
151-153
: LGTM! Minor formatting improvement.Removing spaces around parameter names in the inline comments improves consistency with the codebase's comment style. No functional changes.
src/script/standard.h (1)
111-114
: LGTM! Appropriate constexpr function for pushdata identification.The
IsPushdataOp
function is correctly implemented as aconstexpr
function, enabling compile-time evaluation. The logic correctly identifies pushdata opcodes (OP_FALSE < opcode ≤ OP_PUSHDATA4), and moving it to the header improves its accessibility across the codebase.doc/build-openbsd.md (1)
13-15
: LGTM! Improved build instructions for OpenBSD.Consolidating the package installation into a single command and adding the clarifying comment about selecting the newest versions improves the documentation's clarity and usability.
src/rpc/blockchain.cpp (1)
1301-1301
: LGTM! Type safety and modern C++ style improvement.The change from
int
touint32_t
improves type safety, asCOutPoint::n
is typically an unsigned 32-bit value. Using braced initialization aligns with modern C++20 style and makes the code more concise by eliminating the intermediate variable.CONTRIBUTING.md (2)
13-15
: LGTM! Simplified governance structure description.The updated wording clarifies the maintainer role by removing the explicit "lead maintainer" concept and simplifying to "repository maintainers." This provides a clearer and more general description of responsibilities without changing the underlying process.
274-274
: LGTM! Consistent governance terminology.The simplification to "maintainers" aligns with the earlier changes in the document and maintains consistency throughout the contribution guidelines.
src/validation.h (2)
234-237
: LGTM: Package feerate field is well-documented.The new
m_package_feerate
field correctly captures the package-level feerate with clear documentation explaining its definition (aggregated modified fees divided by total size) and caveats about availability. The use ofstd::optional<CFeeRate>
appropriately models the possibility that the field may be unavailable in certain scenarios.
243-246
: LGTM: Constructor overload properly initializes package feerate.The new constructor correctly accepts a
CFeeRate feerate
parameter and initializesm_package_feerate
with it, alongside the existingstate
andresults
parameters. This follows the established pattern of the existing constructor while extending functionality.src/script/script.cpp (1)
386-409
: LGTM: Minimal push check correctly enforces consensus rules.The
CheckMinimalPush
function properly validates that data is pushed using the minimal encoding required by script consensus rules. The logic correctly handles all size ranges and special cases (empty data, OP_1..OP_16, OP_1NEGATE). The assertion on line 388 ensures the opcode is within the valid push range [0, OP_PUSHDATA4].src/script/script.h (2)
323-323
: LGTM: Accessor provides direct access to internal value.The
GetInt64()
method correctly exposes the internalm_value
asint64_t
, following the existing pattern of accessor methods inCScriptNum
.
547-547
: LGTM: Declaration matches implementation.The
CheckMinimalPush
declaration correctly matches the implementation insrc/script/script.cpp
(lines 386-409).src/psbt.cpp (2)
208-208
: LGTM: Constructor invocation updated to use reference.The change from
&tx
totx
correctly updates theMutableTransactionSignatureCreator
constructor invocation to pass a reference instead of a pointer, aligning with the updated API insrc/script/sign.h
.
270-270
: LGTM: Constructor invocation updated to use reference.The change from
&tx
totx
correctly updates theMutableTransactionSignatureCreator
constructor invocation to pass a reference instead of a pointer, consistent with the API change.src/wallet/rpc/coins.cpp (2)
20-42
: LGTM: Script-based filtering is correctly implemented.The refactoring from destination-based to script-based filtering is sound. The code now:
- Converts addresses to scripts via
GetScriptForDestination
- Filters scripts by ownership (
IsMine
) at collection time- Stores scripts directly in
output_scripts
This approach maintains correctness while simplifying the filtering logic in the balance calculation loop. Early ownership validation at collection time is a good practice.
74-74
: LGTM: Direct scriptPubKey comparison is efficient.The change to compare
txout.scriptPubKey
directly againstoutput_scripts
is more efficient than the previous destination-based approach, as it avoids the overhead of extracting destinations from scripts during the balance tallying loop.src/test/fuzz/miniscript_decode.cpp (2)
21-52
: LGTM: Converter implementation is correct for fuzz testing.The
Converter
struct properly implements all required methods for Miniscript fuzz testing:
ToString
andFromString
correctly handle hex encoding/decodingToPKBytes
andToPKHBytes
produce appropriate byte representationsFromPKBytes
validates key constructionFromPKHBytes
correctly returns false for the unsupported PKH-to-key path with an assertion to catch test logic errors
56-72
: LGTM: Fuzz target correctly validates Miniscript round-tripping.The fuzz target properly:
- Deserializes a CScript from fuzz input
- Parses it as Miniscript
- Validates round-trip via string representation
- Verifies script round-trip consistency
This provides good coverage for Miniscript parsing and serialization.
contrib/devtools/gen-dash-conf.sh (1)
1-80
: Script appears functional but review is limited per coding guidelines.The script structure looks reasonable for generating a dash.conf file from
dashd --help
output. The sed/awk pipeline transforms help text into configuration format, and path handling uses standard bash patterns. However, per the coding guidelines: "Unless specifically prompted, avoid making changes to the contrib directory."Note: This is a new contributed script for tooling purposes. While the implementation appears sound, changes to contrib/ are generally outside typical review scope unless issues are critical.
#include <string> | ||
#include <vector> | ||
#include <script/script.h> | ||
#include <script/standard.h> | ||
#include <script/miniscript.h> | ||
|
||
#include <assert.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the missing <algorithm>
include
std::reverse
is used (Line 319) but <algorithm>
is not included. This file won't compile on standard-compliant toolchains without it. Please add the header.
#include <string>
#include <vector>
+#include <algorithm>
📝 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.
#include <string> | |
#include <vector> | |
#include <script/script.h> | |
#include <script/standard.h> | |
#include <script/miniscript.h> | |
#include <assert.h> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <script/script.h> | |
#include <script/standard.h> | |
#include <script/miniscript.h> | |
#include <assert.h> |
🤖 Prompt for AI Agents
In src/script/miniscript.cpp around lines 5 to 12, the file uses std::reverse
later but does not include <algorithm>; add the missing #include <algorithm> to
the existing include block near the top of the file so the translation unit
compiles on standard-compliant toolchains.
#include <algorithm> | ||
#include <numeric> | ||
#include <memory> | ||
#include <optional> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <stdlib.h> | ||
#include <assert.h> | ||
|
||
#include <policy/policy.h> | ||
#include <primitives/transaction.h> | ||
#include <script/script.h> | ||
#include <span.h> | ||
#include <util/spanparsing.h> | ||
#include <util/strencodings.h> | ||
#include <util/string.h> | ||
#include <util/vector.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the missing standard headers
This header uses std::logic_error
(Line 175) and std::tuple
(Line 892), but neither <stdexcept>
nor <tuple>
is included. Under C++20 with Clang 16/GCC 11, this leads to hard compilation errors (std::logic_error
not declared / incomplete type for std::tuple
). Please add the explicit includes.
#include <optional>
#include <string>
#include <vector>
+#include <stdexcept>
+#include <tuple>
+
#include <stdlib.h>
#include <assert.h>
📝 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.
#include <algorithm> | |
#include <numeric> | |
#include <memory> | |
#include <optional> | |
#include <string> | |
#include <vector> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <policy/policy.h> | |
#include <primitives/transaction.h> | |
#include <script/script.h> | |
#include <span.h> | |
#include <util/spanparsing.h> | |
#include <util/strencodings.h> | |
#include <util/string.h> | |
#include <util/vector.h> | |
#include <algorithm> | |
#include <numeric> | |
#include <memory> | |
#include <optional> | |
#include <string> | |
#include <vector> | |
#include <stdexcept> | |
#include <tuple> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <policy/policy.h> | |
#include <primitives/transaction.h> | |
#include <script/script.h> | |
#include <span.h> | |
#include <util/spanparsing.h> | |
#include <util/strencodings.h> | |
#include <util/string.h> | |
#include <util/vector.h> |
🤖 Prompt for AI Agents
In src/script/miniscript.h around lines 8 to 26, the header uses
std::logic_error (line ~175) and std::tuple (line ~892) but does not include
<stdexcept> or <tuple>; add explicit #include <stdexcept> and #include <tuple>
alongside the other standard headers near the top of the file (with <algorithm>,
<numeric>, etc.) so the types are declared and compilation errors are resolved.
/** Build a script by concatenating other scripts, or any argument accepted by CScript::operator<<. */ | ||
template<typename... Ts> | ||
CScript BuildScript(Ts&&... inputs) | ||
{ | ||
CScript ret; | ||
int cnt{0}; | ||
|
||
([&ret, &cnt] (Ts&& input) { | ||
cnt++; | ||
if constexpr (std::is_same_v<std::remove_cv_t<std::remove_reference_t<Ts>>, CScript>) { | ||
// If it is a CScript, extend ret with it. Move or copy the first element instead. | ||
if (cnt == 0) { | ||
ret = std::forward<Ts>(input); | ||
} else { | ||
ret.insert(ret.end(), input.begin(), input.end()); | ||
} | ||
} else { | ||
// Otherwise invoke CScript::operator<<. | ||
ret << input; | ||
} | ||
} (std::forward<Ts>(inputs)), ...); | ||
|
||
return ret; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify the counter initialization in BuildScript.
The cnt
variable is initialized to 0 but the condition if (cnt == 0)
on line 560 will never be true because cnt
is incremented to 1 before the check. This appears to be a logic error.
Generate a verification script to confirm the intended behavior:
🏁 Script executed:
#!/bin/bash
# Description: Search for usage patterns of BuildScript to understand intended behavior
# Expected: Find call sites that demonstrate whether the counter logic is correct
# Search for BuildScript usage
rg -n -C 5 'BuildScript\s*\(' --type=cpp
# Search for related test cases
rg -n -C 3 'BuildScript' src/test/ --type=cpp
Length of output: 7449
Correct first-element handling in BuildScript
Incrementing cnt before if(cnt == 0) makes the initial branch unreachable; change to if(cnt == 1) or move the increment after the check.
🤖 Prompt for AI Agents
In src/script/script.h around lines 549 to 573, the lambda increments cnt before
checking if it's the first element so the cnt==0 branch is never taken; adjust
logic so the first-element branch runs correctly by either moving the increment
to after the check or changing the comparison to if(cnt == 1). Ensure you still
use perfect forwarding for the first-element assignment (ret =
std::forward<Ts>(input)) and keep the subsequent-element behavior (insert or
operator<<) unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/script/miniscript.h (1)
8-26
: Add the missing standard headers.This header uses
std::logic_error
(Line 175) andstd::tuple
(Line 892), but neither<stdexcept>
nor<tuple>
is included. This will cause compilation errors in C++20 with Clang 16/GCC 11.1 as per the coding guidelines.Apply this diff to add the required headers:
#include <optional> #include <string> +#include <stdexcept> +#include <tuple> #include <vector> #include <stdlib.h>Based on past review comments.
🧹 Nitpick comments (4)
src/script/script.cpp (1)
386-409
: Simplify the redundant condition in the assert.The condition
0 <= opcode
is always true becauseopcode
is of typeopcodetype
, which is an unsigned integer. This part of the assertion is redundant and can be removed for clarity.Apply this diff to simplify the assertion:
- assert(0 <= opcode && opcode <= OP_PUSHDATA4); + assert(opcode <= OP_PUSHDATA4);src/wallet/rpc/coins.cpp (1)
74-74
: Consider usingstd::set
for faster lookups.The linear search with
std::find
inside nested loops could become slow for large labels or wallets with many transactions. Usingstd::set<CScript>
foroutput_scripts
would reduce lookup complexity from O(n) to O(log n).Apply this diff to use
std::set
:- std::vector<CScript> output_scripts; + std::set<CScript> output_scripts;And update line 74:
- if (std::find(output_scripts.begin(), output_scripts.end(), txout.scriptPubKey) != output_scripts.end()) { + if (output_scripts.count(txout.scriptPubKey)) { amount += txout.nValue; }src/test/miner_tests.cpp (1)
641-641
: Verify necessity of direct height manipulation.Directly decrementing
nHeight
on the active chain tip is unusual and potentially fragile. This manual state manipulation bypasses normal blockchain state management and could lead to inconsistencies.Consider whether this adjustment is necessary or if there's a cleaner approach using standard blockchain operations (e.g., proper invalidation/rollback). Since this is a backport from Bitcoin Core, the logic is likely correct, but it may be worth verifying that this state manipulation is intentional and necessary for the test to function properly.
Would you like me to investigate whether there's a cleaner alternative to this direct height manipulation?
src/validation.h (1)
183-183
: Use consistent “virtual size” terminology
Update the comment in src/validation.h (line 183) to refer to “virtual size” instead of just “size,” e.g.:- /** Size as used by the mempool, calculated using serialized size and sigops. */ + /** Virtual size as used by the mempool, calculated using serialized size and sigops. */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (32)
ci/lint/04_install.sh
(1 hunks)contrib/containers/ci/ci-slim.Dockerfile
(2 hunks)doc/build-openbsd.md
(1 hunks)doc/policy/packages.md
(1 hunks)src/Makefile.am
(2 hunks)src/Makefile.test.include
(2 hunks)src/httprpc.cpp
(2 hunks)src/masternode/node.h
(1 hunks)src/node/chainstate.cpp
(1 hunks)src/node/miner.h
(1 hunks)src/rest.cpp
(1 hunks)src/rpc/util.cpp
(2 hunks)src/script/interpreter.cpp
(0 hunks)src/script/interpreter.h
(0 hunks)src/script/miniscript.cpp
(1 hunks)src/script/miniscript.h
(1 hunks)src/script/script.cpp
(1 hunks)src/script/script.h
(2 hunks)src/script/standard.cpp
(0 hunks)src/script/standard.h
(1 hunks)src/test/fuzz/miniscript_decode.cpp
(1 hunks)src/test/fuzz/tx_pool.cpp
(1 hunks)src/test/miner_tests.cpp
(5 hunks)src/test/miniscript_tests.cpp
(1 hunks)src/test/txpackage_tests.cpp
(9 hunks)src/validation.cpp
(12 hunks)src/validation.h
(2 hunks)src/validationinterface.cpp
(3 hunks)src/validationinterface.h
(1 hunks)src/wallet/rpc/backup.cpp
(2 hunks)src/wallet/rpc/coins.cpp
(3 hunks)test/functional/rpc_users.py
(1 hunks)
💤 Files with no reviewable changes (3)
- src/script/interpreter.cpp
- src/script/interpreter.h
- src/script/standard.cpp
✅ Files skipped from review due to trivial changes (1)
- src/node/chainstate.cpp
🚧 Files skipped from review as they are similar to previous changes (11)
- doc/build-openbsd.md
- src/rest.cpp
- src/script/standard.h
- src/rpc/util.cpp
- src/wallet/rpc/backup.cpp
- src/script/script.h
- src/Makefile.test.include
- src/validationinterface.cpp
- src/test/fuzz/tx_pool.cpp
- src/node/miner.h
- src/script/miniscript.cpp
🧰 Additional context used
📓 Path-based instructions (7)
test/functional/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Functional tests should be written in Python and placed in test/functional/
Files:
test/functional/rpc_users.py
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}
: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/test/txpackage_tests.cpp
src/test/fuzz/miniscript_decode.cpp
src/script/script.cpp
src/wallet/rpc/coins.cpp
src/test/miniscript_tests.cpp
src/validation.h
src/validation.cpp
src/script/miniscript.h
src/httprpc.cpp
src/masternode/node.h
src/validationinterface.h
src/test/miner_tests.cpp
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests for C++ code should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests
Files:
src/test/txpackage_tests.cpp
src/test/fuzz/miniscript_decode.cpp
src/test/miniscript_tests.cpp
src/test/miner_tests.cpp
doc/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the doc directory (documentation)
Files:
doc/policy/packages.md
ci/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the ci directory (continuous integration)
Files:
ci/lint/04_install.sh
contrib/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the contrib directory (contributed scripts)
Files:
contrib/containers/ci/ci-slim.Dockerfile
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Masternode lists must use immutable data structures (Immer library) for thread safety
Files:
src/masternode/node.h
🧬 Code graph analysis (9)
test/functional/rpc_users.py (1)
test/functional/test_framework/test_node.py (1)
assert_start_raises_init_error
(606-649)
src/test/txpackage_tests.cpp (2)
src/test/util/setup_common.cpp (4)
mineBlocks
(447-461)mineBlocks
(447-447)CreateValidMempoolTransaction
(544-591)CreateValidMempoolTransaction
(544-550)src/validation.cpp (2)
ProcessNewPackage
(1420-1438)ProcessNewPackage
(1420-1421)
src/test/fuzz/miniscript_decode.cpp (1)
src/test/miniscript_tests.cpp (6)
key
(75-75)key
(75-75)key
(78-83)key
(78-78)FromString
(87-91)FromString
(87-87)
src/wallet/rpc/coins.cpp (3)
src/wallet/interfaces.cpp (6)
label
(184-188)label
(184-184)txout
(459-463)txout
(459-459)txout
(469-473)txout
(469-469)src/wallet/rpc/util.cpp (2)
LabelFromValue
(117-123)LabelFromValue
(117-117)src/wallet/scriptpubkeyman.h (1)
wallet
(28-227)
src/test/miniscript_tests.cpp (2)
src/test/fuzz/miniscript_decode.cpp (6)
key
(24-27)key
(24-24)key
(28-30)key
(28-28)key
(31-34)key
(31-31)src/crypto/ripemd160.h (1)
CRIPEMD160
(12-26)
src/validation.cpp (1)
src/validation.h (1)
state
(169-194)
src/script/miniscript.h (1)
src/script/miniscript.cpp (12)
ComputeType
(38-251)ComputeType
(38-38)ComputeScriptLen
(253-284)ComputeScriptLen
(253-253)SanitizeType
(16-36)SanitizeType
(16-16)FindNextChar
(338-346)FindNextChar
(338-338)DecomposeScript
(286-321)DecomposeScript
(286-286)ParseScriptNumber
(323-336)ParseScriptNumber
(323-323)
src/httprpc.cpp (1)
src/bitcoin-cli.cpp (1)
gArgs
(445-451)
src/validationinterface.h (1)
src/validationinterface.cpp (2)
MainSignalsImpl
(47-47)MainSignalsImpl
(47-47)
🔇 Additional comments (20)
src/Makefile.am (1)
348-348
: LGTM!The Miniscript header and source files are correctly integrated into the build system.
Also applies to: 926-926
src/test/fuzz/miniscript_decode.cpp (1)
48-51
: Intentionally limited FromPKHBytes implementation.The
FromPKHBytes
method asserts the input is 20 bytes but always returnsfalse
, indicating this conversion path is intentionally unsupported in this fuzz test. This is acceptable for testing round-trips throughFromScript
andToString
, as the test focuses on other conversion paths.src/test/miniscript_tests.cpp (1)
148-291
: LGTM! Comprehensive test coverage.The test suite thoroughly exercises:
- Type system validation and constraints
- Script round-tripping through Miniscript parsing
- Malleability properties
- Timelock semantics
- Threshold and multi-signature constructs
- Edge cases like non-minimal pushes
The singleton test data pattern with proper cleanup (line 290) ensures test isolation.
src/wallet/rpc/coins.cpp (1)
20-42
: LGTM! Script-based filtering is more robust.The refactor from destination-based to script-based filtering is sound:
- Directly matches against
txout.scriptPubKey
without intermediate conversions- Handles non-standard scripts that may not have valid destinations
- Preserves wallet ownership validation in both paths
src/test/miner_tests.cpp (3)
40-41
: LGTM! Clean extraction of test helper methods.The new method declarations properly capture the extracted test logic with appropriate lock annotations. The
baseheight
parameter inTestBasicMining
correctly propagates the block height context needed for sequence lock testing.
210-482
: LGTM! Comprehensive basic mining test extraction.The extracted
TestBasicMining
helper correctly tests various block creation scenarios including sigops limits, size constraints, orphan handling, double spends, and all lock time variations (relative height, relative time, absolute height, absolute time). Thebaseheight
parameter is properly used for calculating sequence lock prevheights.
484-557
: LGTM! Well-structured prioritisation test extraction.The extracted
TestPrioritisedMining
helper thoroughly tests transaction prioritisation, including edge cases where prioritised transactions have prioritised ancestors. The test correctly verifies that parent prioritisation doesn't incorrectly propagate to descendants when calculating ancestor fees.src/validation.h (2)
234-237
: LGTM!The new
m_package_feerate
field is well-designed with clear documentation. Usingstd::optional<CFeeRate>
appropriately models the case where package feerate may be unavailable (e.g., missing inputs or early termination).
243-245
: LGTM!The new constructor correctly initializes the
m_package_feerate
field alongside existing fields. The parameter order and initialization are consistent with the struct's design.src/test/txpackage_tests.cpp (11)
84-84
: LGTM!The increased output amounts (499 COIN for parent, 498 COIN for child) result in higher total fees (~2 COIN) for the package, which aligns with the updated assertions in lines 106-108. This ensures the test package has sufficient fees for validation.
Also applies to: 93-93
106-108
: LGTM!The test correctly validates that
m_package_feerate
is present and equals the expected aggregated feerate computed from total fees (2 COIN) divided by total virtual size.
120-120
: LGTM!Correctly validates that
m_package_feerate
isstd::nullopt
when validation fails due to oversized transaction. This aligns with the field's documented behavior.
241-241
: LGTM!The assertions correctly verify that
m_package_feerate
isstd::nullopt
in policy violation scenarios (unrelated transactions, 3-generation package, missing parent), where package validation doesn't proceed to feerate computation.Also applies to: 283-283, 299-299
319-322
: LGTM!The comment clearly explains why
m_package_feerate
isstd::nullopt
in this case: when both transactions have sufficient individual feerates, package-level validation is unnecessary. Good documentation of optimization behavior.
344-345
: LGTM!Correctly validates that
m_package_feerate
isstd::nullopt
when transactions are already in the mempool (deduplicated case), as package validation is bypassed.
348-398
: LGTM!The test setup and prioritisation scenario are well-structured:
- Lines 360-378: Creates a zero-fee parent and 1 COIN fee child
- Lines 383-398: Correctly tests that negative prioritisation (-1 COIN on parent) brings package feerate to 0, causing validation to fail with "package-fee-too-low"
The assertions properly validate both the failure state and the computed package feerate (0 sat/vbyte).
400-432
: LGTM!The CPFP success case is correctly tested:
- Lines 405-432: After clearing prioritisation, the zero-fee parent + 1 COIN child package succeeds
- Assertions verify both transactions accepted with correct fees (0 for parent, COIN for child)
- Package feerate validation correctly computes expected value from total fees and sizes
- The check
expected_feerate.GetFeePerK() > 1000
ensures the package meets minimum feerateGood validation of the core CPFP functionality.
434-470
: LGTM!The package-fee-too-low scenario is well-tested:
- Lines 437-470: Creates a package paying only 200 satoshis total
- Child alone has >1000 sat/kvB feerate, but combined package falls below 1000 sat/kvB threshold
- Assertions correctly verify failure with "package-fee-too-low" and validate the computed package feerate
Good coverage of the edge case where individual transaction fees aren't sufficient for the entire package.
472-488
: LGTM!The prioritisation-enabled-package scenario is correct:
- Lines 474-488: Adds 1 COIN prioritisation to child, making the previously-failing package succeed
- Correctly validates that modified fees (including prioritisation delta) are used in package feerate calculation
- Expected feerate computation includes the 1 COIN prioritisation:
CFeeRate(1 * COIN + 200, ...)
Good test of prioritisation interaction with package validation.
490-537
: LGTM!The rich-parent scenario correctly tests topology independence:
- Lines 495-537: Creates parent paying 1 COIN fee and zero-fee child
- Parent is accepted individually (sufficient feerate)
- Child is then validated as a "package of 1" and fails with zero feerate
- Package feerate reflects only the child's feerate (0 sat/vbyte)
This validates that parents can't unfairly subsidize children - each transaction is validated individually first, and only insufficient-feerate transactions trigger package validation. Good test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
doc/dash-conf.md (1)
66-74
: Add language specifier to code block.The code block at lines 71-73 should specify
shell
orbash
as the language for proper syntax highlighting and to satisfy Markdown linting rules.Apply this diff to add the language specifier:
-``` +```shell # example copy command for linux user cp share/examples/dash.conf ~/.dashcore</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 22c416aba45672c9cf5e916fa3e6359bf6dfec12 and 6738517c8e736cc6d528aa71e9f9338fe44a037f. </details> <details> <summary>📒 Files selected for processing (7)</summary> * `contrib/debian/examples/dash.conf` (1 hunks) * `contrib/devtools/README.md` (1 hunks) * `contrib/devtools/gen-dash-conf.sh` (1 hunks) * `contrib/guix/libexec/build.sh` (1 hunks) * `doc/dash-conf.md` (1 hunks) * `doc/release-process.md` (1 hunks) * `src/init.cpp` (1 hunks) </details> <details> <summary>✅ Files skipped from review due to trivial changes (1)</summary> * src/init.cpp </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>📓 Path-based instructions (2)</summary> <details> <summary>contrib/**</summary> **📄 CodeRabbit inference engine (CLAUDE.md)** > Unless specifically prompted, avoid making changes to the contrib directory (contributed scripts) Files: - `contrib/devtools/README.md` - `contrib/guix/libexec/build.sh` - `contrib/debian/examples/dash.conf` - `contrib/devtools/gen-dash-conf.sh` </details> <details> <summary>doc/**</summary> **📄 CodeRabbit inference engine (CLAUDE.md)** > Unless specifically prompted, avoid making changes to the doc directory (documentation) Files: - `doc/dash-conf.md` - `doc/release-process.md` </details> </details><details> <summary>🪛 markdownlint-cli2 (0.18.1)</summary> <details> <summary>doc/dash-conf.md</summary> 71-71: Fenced code blocks should have a language specified (MD040, fenced-code-language) </details> </details> </details> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)</summary> * GitHub Check: Build container / Build container </details> <details> <summary>🔇 Additional comments (4)</summary><blockquote> <details> <summary>doc/release-process.md (1)</summary><blockquote> `4-6`: **LGTM!** The documentation updates correctly reflect the new workflow for generating dash.conf and appropriately reference the develop branch for translations, manpages, and configuration generation. </blockquote></details> <details> <summary>contrib/debian/examples/dash.conf (1)</summary><blockquote> `1-1`: **LGTM!** Replacing the static example with a placeholder aligns with the new dynamic generation workflow. The placeholder appropriately directs users to the generation script documentation. </blockquote></details> <details> <summary>contrib/devtools/gen-dash-conf.sh (1)</summary><blockquote> `1-80`: **LGTM with path fix required!** The script logic is well-structured with proper error checking, dirty build warnings, and comprehensive help text parsing. The sed/awk pipeline effectively transforms the `dashd --help` output into a commented configuration format, and the footer correctly includes network-specific section headers. However, this approval is contingent on fixing the critical path issue flagged in the previous comment. </blockquote></details> <details> <summary>contrib/devtools/README.md (1)</summary><blockquote> `93-106`: **Fix typo in script description.** Line 96 contains a typo: "dashd--help" should be "dashd --help" (missing space between command and flag). Apply this diff to fix the typo: ```diff -Generates a dash.conf file in `share/examples/` by parsing the output from `dashd--help`. This script is run during the +Generates a dash.conf file in `share/examples/` by parsing the output from `dashd --help`. This script is run during the release process to include a dash.conf with the release binaries and can also be run by users to generate a file locally.
Likely an incorrect or invalid review comment.
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/contrib/debian/examples/} | ||
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/dash.conf} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Fix incorrect default output path.
The default path for SHARE_EXAMPLES_DIR
is inconsistent with the documentation and the build process:
- This script generates to:
$TOPDIR/contrib/debian/examples/
(line 11 default) - Documentation references:
share/examples/dash.conf
(doc/dash-conf.md line 68) - Build script expects:
${DISTSRC}/share/examples/dash.conf
(contrib/guix/libexec/build.sh line 360)
This path mismatch will break the release process because the build script won't find the generated file at the expected location.
Apply this diff to fix the default path:
-SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/contrib/debian/examples/}
+SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples/}
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/dash.conf}
📝 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.
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/contrib/debian/examples/} | |
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/dash.conf} | |
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples/} | |
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/dash.conf} |
🤖 Prompt for AI Agents
In contrib/devtools/gen-dash-conf.sh around lines 11 to 12, the default
SHARE_EXAMPLES_DIR points to contrib/debian/examples/ which mismatches docs and
build scripts; update the default to $TOPDIR/share/examples/ so
EXAMPLE_CONF_FILE resolves to $TOPDIR/share/examples/dash.conf (ensure trailing
slash and keep the existing environment-override pattern using
${SHARE_EXAMPLES_DIR:-...} and ${EXAMPLE_CONF_FILE:-...}).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
22235: should fix path inconsistencies indeed - replace share/examples/
with contrib/debian/examples/
in all docs and scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all references to share/examples in the repository
echo "=== Searching for 'share/examples' references ==="
rg -n --type-add 'doc:*.md' --type=doc --type=sh "share/examples"
echo ""
echo "=== Searching in all other files ==="
rg -n "share/examples" -g '!*.md' -g '!*.sh'
echo ""
echo "=== Checking specific files mentioned in the review ==="
echo "--- doc/dash-conf.md ---"
rg -n "share/examples" doc/dash-conf.md || echo "No matches found"
echo ""
echo "--- contrib/guix/libexec/build.sh ---"
rg -n "share/examples" contrib/guix/libexec/build.sh || echo "No matches found"
echo ""
echo "--- contrib/devtools/README.md ---"
rg -n "share/examples" contrib/devtools/README.md || echo "No matches found"
Unrecoverable error: Failed to clone repository
@UdjinM6, understood! Based on the PR changes and documentation, here are the files that need updating to use contrib/debian/examples/
instead of share/examples/
:
Files to update:
-
doc/dash-conf.md (line ~68)
- Change:
share/examples/dash.conf
→contrib/debian/examples/dash.conf
- Also update the cp command example to use the correct path
- Change:
-
contrib/guix/libexec/build.sh (line ~360)
- Change:
${DISTSRC}/share/examples/dash.conf
→${DISTSRC}/contrib/debian/examples/dash.conf
- Change:
-
contrib/devtools/README.md
- Update any references to the output path in the gen-dash-conf.sh documentation section
This approach keeps the generated file in contrib/debian/examples/dash.conf
(where gen-dash-conf.sh already writes it) and ensures all documentation and build scripts reference the correct location. This is more consistent with the Debian packaging structure.
contrib/guix/libexec/build.sh
Outdated
# copy over the example dash.conf file. if contrib/devtools/gen-dash-conf.sh | ||
# has not been run before buildling, this file will be a stub | ||
cp "${DISTSRC}/share/examples/dash.conf" "${DISTNAME}/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in comment.
Line 359 contains a typo: "buildling" should be "building".
Apply this diff to fix the typo:
- # copy over the example dash.conf file. if contrib/devtools/gen-dash-conf.sh
- # has not been run before buildling, this file will be a stub
+ # copy over the example dash.conf file. if contrib/devtools/gen-dash-conf.sh
+ # has not been run before building, this file will be a stub
cp "${DISTSRC}/share/examples/dash.conf" "${DISTNAME}/"
📝 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.
# copy over the example dash.conf file. if contrib/devtools/gen-dash-conf.sh | |
# has not been run before buildling, this file will be a stub | |
cp "${DISTSRC}/share/examples/dash.conf" "${DISTNAME}/" | |
# copy over the example dash.conf file. if contrib/devtools/gen-dash-conf.sh | |
# has not been run before building, this file will be a stub | |
cp "${DISTSRC}/share/examples/dash.conf" "${DISTNAME}/" |
🤖 Prompt for AI Agents
contrib/guix/libexec/build.sh around lines 358 to 360: the comment contains a
typo "buildling" — update the comment to "building" so the line reads "... has
not been run before building, this file will be a stub". Make only that spelling
fix in the comment and keep the surrounding code unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's backported typo, let's keep it to reduce conflicts in the future.
p.s. still not fixed in the master of bitcoin core
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knst, understood! That makes sense—maintaining consistency with the upstream Bitcoin Core code to minimize merge conflicts is a practical approach, especially when the issue hasn't been fixed upstream yet.
✏️ Learnings added
Learnt from: knst
PR: dashpay/dash#6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.442Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
…a class, drop unused forward declarations ca1ac1f scripted-diff: Rename MainSignalsInstance() class to MainSignalsImpl() (Jon Atack) 2aaec23 refactor: remove unused forward declarations in validationinterface.h (Jon Atack) 23854f8 refactor: make MainSignalsInstance() a class (Jon Atack) Pull request description: Make MainSignalsInstance a class, rename it to MainSignalsImpl, use Doxygen documentation for it, and remove no longer used forward declarations in src/validationinterface.h. ---- MainSignalsInstance was created in 3a19fed and originally was a collection of boost::signals methods moved to validationinterface.cpp, in order to no longer need to include boost/signals in validationinterface.h. MainSignalsInstance then evolved in d6815a2 to become class-like: - [C.8: Use class rather than struct if any member is non-public](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-class) - [C.2: Use class if the class has an invariant; use struct if the data members can vary independently](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c2-use-class-if-the-class-has-an-invariant-use-struct-if-the-data-members-can-vary-independently) - A class has the advantage of default private access, as opposed to public for a struct. ACKs for top commit: furszy: Code ACK ca1ac1f promag: Code review ACK ca1ac1f. danielabrozzoni: Code review ACK ca1ac1f Tree-SHA512: 25f85e2b582fe8c269e6cf384a4aa29350b97ea6477edf3c63591e4f68a97364f7fb2fc4ad2764f61ff86b27353e31d2f12eed7a23368a247e4cf271c7e133ea
…ormance f336ff7 rpc: avoid expensive `IsMine` calls in `GetReceived` tally (Sebastian Falbesoner) a7b65af rpc: avoid scriptPubKey<->CTxDestination conversions in `GetReceived` tally (Sebastian Falbesoner) Pull request description: The RPC calls `getreceivedbyaddress`/`getreceivedbylabel` both use the internal helper function `GetReceived` which was introduced in PR bitcoin#17579 to deduplicate tallying code. For every wallet-related transaction output, the following unnecessary operations are currently performed in the tally loop, leading to a quite bad performance (as reported in bitcoin#23645): - converting from CScript -> TxDestination (`ExtractDestination(...)`), converting from TxDestination -> CScript (`CWallet::IsMine(const CTxDestination& dest)`); this can be avoided by directly using output scripts in the search set instead of addresses (first commit) - checking if the iterated output script belongs to the wallet by calling `IsMine`; this can be avoided by only adding addresses to the search set which fulfil `IsMine` in the first place (second commit) ### Benchmark results The functional test [wallet_pr23662.py](https://github.com/theStack/bitcoin/blob/pr23662_benchmarks/test/functional/wallet_pr23662.py) (not part of this PR) creates transactions with 15000 different addresses: - 5000 outputs (500 txs with 10 outputs each) with label set, IsMine set (received) - 5000 outputs (500 txs with 10 outputs each) with label set, IsMine not set (sent) - 5000 outputs (500 txs with 10 outputs each) without label set, IsMine not set (sent) Then, the time is measured for calling `getreceivedbyaddress` and `getreceivedbylabel`, the latter with two variants. Results on my machine: | branch | `getreceivedbyaddress` (single) | `getreceivedbylabel` (single) | `getreceivedbylabel` (10000) | |--------------------|---------------------------------|-------------------------------|------------------------------| | master | 406.13ms | 425.33ms | 446.58ms | | PR (first commit) | 367.18ms | 365.81ms | 426.33ms | | PR (second commit) | 3.96ms | 4.83ms | 339.69ms | Fixes bitcoin#23645. ACKs for top commit: achow101: ACK f336ff7 w0xlt: ACK bitcoin@f336ff7 furszy: Code ACK f336ff7 Tree-SHA512: 9cbf402b9e269713bd3feda9e31719d9dca8a0dfd526de12fd3d561711589195d0c50143432c65dae279c4eab90a4fc3f99e29fbc0452fefe05113e92d129b8f
…kages BACKPORT NOTE: This PR is backported to minimize conflicts in future even if Dash Core has no bumpfee feature 9bebf35 [validation] don't package validate if not policy or missing inputs (glozow) 51edcff [unit test] package feerate and package cpfp (glozow) 1b93748 [validation] try individual validation before package validation (glozow) 17a8ffd [packages/policy] use package feerate in package validation (glozow) 09f32cf [docs] package feerate (glozow) Pull request description: Part of bitcoin#22290, aka [Package Mempool Accept](https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a). This enables CPFP fee bumping in child-with-unconfirmed-parents packages by introducing [package feerate](https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a#fee-related-checks-use-package-feerate) (total modified fees divided by total virtual size) and using it in place of individual feerate. We also always [validate individual transactions first](https://gist.github.com/glozow/dc4e9d5c5b14ade7cdfac40f43adb18a#always-try-individual-submission-first) to avoid incentive-incompatible policies like "parents pay for children" or "siblings pay for siblings" behavior. ACKs for top commit: instagibbs: reACK bitcoin@9bebf35 mzumsande: Code review ACK 9bebf35 t-bast: ACK bitcoin@9bebf35 Tree-SHA512: 5117cfcc3ce55c00384d9e8003a0589ceac1e6f738b1c299007d9cd9cdd2d7c530d31cfd23658b041a6604d39073bcc6e81f0639a300082a92097682a6ea8c8f
2da94a4 fuzz: add a fuzz target for Miniscript decoding from Script (Antoine Poinsot) f836999 Miniscript: ops limit and stack size computation (Pieter Wuille) 2e55e88 Miniscript: conversion from script (Pieter Wuille) 1ddaa66 Miniscript: type system, script creation, text notation, tests (Pieter Wuille) 4fe2936 script: expose getter for CScriptNum, add a BuildScript helper (Antoine Poinsot) f4e289f script: move CheckMinimalPush from interpreter to script.h (Antoine Poinsot) 31ec6ae script: make IsPushdataOp non-static (Antoine Poinsot) Pull request description: Miniscript is a language for writing (a subset of) Bitcoin Scripts in a structured way. Miniscript permits: - To safely extend the Output Descriptor language to many more scripting features thanks to the typing system (composition). - Statical analysis of spending conditions, maximum spending cost of each branch, security properties, third-party malleability. - General satisfaction of any correctly typed ("valid" [0]) Miniscript. The satisfaction itself is also analyzable. - To extend the possibilities of external signers, because of all of the above and since it carries enough metadata. Miniscript guarantees: - That for any statically-analyzed as "safe" [0] Script, a witness can be constructed in the bounds of the consensus and standardness rules (standardness complete). - That unless the conditions of the Miniscript are met, no witness can be created for the Script (consensus sound). - Third-party malleability protection for the satisfaction of a sane Miniscript, which is too complex to summarize here. For more details around Miniscript (including the specifications), please refer to the [website](https://bitcoin.sipa.be/miniscript/). Miniscript was designed by Pieter Wuille, Andrew Poelstra and Sanket Kanjalkar. This PR is an updated and rebased version of bitcoin#16800. See [the commit history of the Miniscript repository](https://github.com/sipa/miniscript/commits/master) for details about the changes made since September 2019 (TL;DR: bugfixes, introduction of timelock conflicts in the type system, `pk()` and `pkh()` aliases, `thresh_m` renamed to `multi`, all recursive algorithms were made non-recursive). This PR is also the first in a series of 3: - The first one (here) integrates the backbone of Miniscript. - The second one (bitcoin#24148) introduces support for Miniscript in Output Descriptors, allowing for watch-only support of Miniscript Descriptors in the wallet. - The third one (bitcoin#24149) implements signing for these Miniscript Descriptors, using Miniscript's satisfaction algorithm. Note to reviewers: - Miniscript is currently defined only for P2WSH. No Taproot yet. - Miniscript is different from the policy language (a high-level logical representation of a spending policy). A policy->Miniscript compiler is not included here. - The fuzz target included here is more interestingly extended in the 3rd PR to check a script's satisfaction against `VerifyScript`. I think it could be further improved by having custom mutators as we now have for multisig (see bitcoin#23105). A minified corpus of Miniscript Scripts is available at bitcoin-core/qa-assets#85. [0] We call "valid" any correctly-typed Miniscript. And "safe" any sane Miniscript, ie one whose satisfaction isn't malleable, which requires a key for any spending path, etc.. ACKs for top commit: jb55: ACK 2da94a4 laanwj: Light code review ACK 2da94a4 (mostly reviewed the changes to the existing code and build system) Tree-SHA512: d3ef558436cfcc699a50ad13caf1e776f7d0addddb433ee28ef38f66ea5c3e581382d8c748ccac9b51768e4b95712ed7a6112b0e3281a6551e0f325331de9167
…rmat ffffb7a doc: Convert remaining comments to clang-tidy format (MarcoFalke) Pull request description: This is a follow-up to commit 0da559e, hopefully the last one. ACKs for top commit: Empact: Code review ACK ffffb7a vincenzopalazzo: ACK bitcoin@ffffb7a Tree-SHA512: 541f5e69aeee53815e77e63b9012d3ed24856eec5f7e28cc764b3ce29f897563e56ade07db9891324f2809dcf064ce10333b1a1e4a7490af9bd97dcf6ff4e4f7
f87f259 refactor: fixup named args in txpackage tests (fanquake) 864772c lint: mypy 0.942 (fanquake) 38031ad lint: flake8 4.0.1 (fanquake) eaf712c lint: codespell 2.1.0 (fanquake) Pull request description: Use newer versions of our lint packages. Fix all the outstanding typos. Fix the failing CI. ACKs for top commit: MarcoFalke: review ACK f87f259 Tree-SHA512: 2c1471c13e088d5b9cdd436ebde40180516ae1dd2a2ea4d2f54214762a0712557d899e73c4cfd32992fe45fce6fdba50ba39254f2c79cd5d1180e873a79b9b22
5202bd1 test: Bump shellcheck version to 0.8.0 (Hennadii Stepanov) Pull request description: Among [added](https://github.com/koalaman/shellcheck/blob/master/CHANGELOG.md#v080---2021-11-06) rules, SC2295 could be [useful](bitcoin#23506 (comment)) for us. ACKs for top commit: dongcarl: Code Review ACK 5202bd1 fanquake: ACK 5202bd1 - would have rather this just been a part of bitcoin#23506 to avoid another PR and pointless rebasing. Tree-SHA512: fd7ff801c71af03c5a5b2823b7daba25a430b3ead5e5e50a3663961ee2223e55d322aec91d79999814cd35bd7ed6e9415a0b797718ceb8c0b1dbdbb40c336b82
7417594 miniscript: the 'd:' wrapper must not be 'u' (Antoine Poinsot) Pull request description: The type system was incorrectly relying on a standardness rule to be sound. This bug was found and reported by Andrew Poelstra [based on a question from Aman Kumar Kashyap](rust-bitcoin/rust-miniscript#341). ACKs for top commit: sipa: ACK 7417594 apoelstra: utACK 7417594 achow101: ACK 7417594 Tree-SHA512: af68c1df1c40e40dd105ef54544c226f560524dd8e35248fa0305dbef966e96ec1fa6ff2fe50fb8f2792ac310761a29c55ea81dd7b6d122a0de0a68b135e5aaa
…ing modified fees, not base e4303c3 [unit test] prioritisation in mining (glozow) 7a8d606 [miner] bug fix: update for parent inclusion using modified fee (glozow) 0f9a444 MOVEONLY: group miner tests into MinerTestingSetup functions (glozow) Pull request description: Came up while reviewing bitcoin#24364, where some of us incorrectly assumed that we use the same fee deduction in `CTxMemPoolModifiedEntry::nModFeesWithAncestors` when first constructing an entry and in `update_for_parent_inclusion`. Actually, the behavior is this: when a mempool entry's ancestor is included in the block template, we create a `CTxMemPoolModifiedEntry` for it, subtracting the ancestor's modified fees from `nModFeesWithAncestors`. If another ancestor is included, we update it again, but use the ancestor's _base_ fees instead. I can't explain why we use `GetFee` in one place and `GetModifiedFee` in the other, but I'm quite certain we should be using the same one for both. And should it be base or modified fees? Modified, otherwise the child inherits the prioritisation of the parent, but only until the parent gets mined. If we want prioritisation to cascade down to current in-mempool descendants, we should probably document that in the `prioritsetransaction` helpstring and implement it in `CTxMemPool::mapDeltas`, not as a quirk in the mining code? Wrote a test in which a mempool entry has 2 ancestors, both prioritised, and both included in a block template individually. This test should fail without the s/GetFee/GetModifiedFee commit. ACKs for top commit: ccdle12: tested ACK e4303c3 MarcoFalke: ACK e4303c3 🚗 Tree-SHA512: 4cd94106fbc9353e9f9b6d5af268ecda5aec7539245298c940ca220606dd0737264505bfaae1f83d94765cc2d9e1a6e913a765048fe6c19292482241761a6762
fa12706 Reject invalid rpcauth formats (MacroFake) Pull request description: This was added in commit 438ee59, but I couldn't determine if it was intentional. One reason to accept `foo:bar:baz` over `foo:bar$baz` is that `$` may be eaten by the shell. Though, I don't think many users pass `rpcauth` via the shell. Also it should be easy to avoid by passing `'-rpcauth=foo:bar$baz'` or `"-rpcauth=foo:bar\$baz"`. Can be tested with the added test. ACKs for top commit: pk-b2: ACK fa12706 Tree-SHA512: 9998cbb295c79f7b0342bf86e1d3e5b5ab90851c627662ad6495b699a65a9035998173cf1debfd94325387faba184de683407b609fe86acdd8f6749157644441
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/validation.cpp (1)
1222-1268
: Package feerate still omits already‑accepted parentsWhen
AcceptPackage()
individually admits a parent (or finds it already in the mempool), that tx is removed fromtxns_new
; yetAcceptMultipleTransactions()
still computesm_total_vsize
/m_total_modified_fees
only from theworkspaces
built fromtxns_new
. Consequently the package feerate check sees only the remaining child, so a standard CPFP (high-fee parent already present, low-fee child pending) is rejected as “package-fee-too-low”. The regression flagged earlier is therefore still present.Please carry the size/fee contributions of the accepted/already-present parents into the totals before calling
CheckFeeRate
(e.g. accumulate them inAcceptPackage()
and pass alongsidetxns_new
, or extendworkspaces
with synthetic entries for those parents). Until those contributions are included, valid packages continue to fail admission.
♻️ Duplicate comments (3)
contrib/devtools/gen-dash-conf.sh (1)
11-12
: Critical: Fix incorrect default output path.The default path for
SHARE_EXAMPLES_DIR
is inconsistent with the documentation and the build process:
- This script generates to:
$TOPDIR/contrib/debian/examples/
(line 11 default)- Documentation references:
share/examples/dash.conf
(doc/dash-conf.md line 68)- Build script expects:
${DISTSRC}/share/examples/dash.conf
(contrib/guix/libexec/build.sh line 360)This path mismatch will break the release process because the build script won't find the generated file at the expected location.
Apply this diff to fix the default path:
-SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/contrib/debian/examples/} +SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples/} EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/dash.conf}src/script/miniscript.cpp (1)
5-12
:<algorithm>
include still missing
std::reverse
(Line 319) is still used without including<algorithm>
, so the TU will fail to build on standard-compliant compilers. Please add the header next to the other includes.src/script/miniscript.h (1)
8-26
: Add the missing standard headers.This header uses
std::logic_error
(Line 175) andstd::tuple
(Line 892), but neither<stdexcept>
nor<tuple>
is included. Under C++20 with Clang 16/GCC 11, this leads to hard compilation errors (std::logic_error
not declared / incomplete type forstd::tuple
).Apply this diff to add the explicit includes:
#include <optional> #include <string> +#include <stdexcept> +#include <tuple> #include <vector> #include <stdlib.h>
🧹 Nitpick comments (3)
test/functional/rpc_users.py (1)
109-111
: LGTM! Comprehensive coverage of malformed rpcauth formats.The three new test cases properly validate rejection of distinct malformed
-rpcauth
formats:
foo:bar:baz
: too many colonsfoo$bar:baz
: wrong delimiter between username and saltfoo$bar$baz
: missing colon separator entirelyThese tests follow the existing pattern and align with the tightened parsing implemented in
src/httprpc.cpp
.Optional: Consider adding inline comments above each assertion to document which malformed format is being tested, similar to line 104's comment for the empty case.
Apply this diff to add clarifying comments:
+ # Too many colons (three parts) self.nodes[0].assert_start_raises_init_error(expected_msg=init_error, extra_args=['-rpcauth=foo:bar:baz']) + # Wrong delimiter between username and salt self.nodes[0].assert_start_raises_init_error(expected_msg=init_error, extra_args=['-rpcauth=foo$bar:baz']) + # Missing colon separator self.nodes[0].assert_start_raises_init_error(expected_msg=init_error, extra_args=['-rpcauth=foo$bar$baz'])doc/dash-conf.md (1)
66-74
: Add language identifier to the code block.The documentation clearly explains the new generation workflow. Consider adding a language identifier to the fenced code block for better syntax highlighting and accessibility.
Apply this diff:
-``` +```bash # example copy command for linux user cp share/examples/dash.conf ~/.dashcore</blockquote></details> <details> <summary>src/wallet/rpc/coins.cpp (1)</summary><blockquote> `20-20`: **Consider using `std::set<CScript>` for better lookup performance.** Using `std::vector<CScript>` results in O(n) lookup complexity when checking membership at line 74, which is executed for every output of every transaction in the wallet. For labels with many addresses or wallets with many transactions, this could cause noticeable slowdown. Apply this diff: ```diff - std::vector<CScript> output_scripts; + std::set<CScript> output_scripts;
Then update line 28 and line 41 to use
insert
instead ofemplace_back
:- output_scripts.emplace_back(output_script); + output_scripts.insert(output_script);- output_scripts.emplace_back(script_pub_key); + output_scripts.insert(script_pub_key);And update line 74:
- if (std::find(output_scripts.begin(), output_scripts.end(), txout.scriptPubKey) != output_scripts.end()) { + if (output_scripts.count(txout.scriptPubKey)) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (39)
ci/lint/04_install.sh
(1 hunks)contrib/containers/ci/ci-slim.Dockerfile
(2 hunks)contrib/debian/examples/dash.conf
(1 hunks)contrib/devtools/README.md
(1 hunks)contrib/devtools/gen-dash-conf.sh
(1 hunks)contrib/guix/libexec/build.sh
(1 hunks)doc/build-openbsd.md
(1 hunks)doc/dash-conf.md
(1 hunks)doc/policy/packages.md
(1 hunks)doc/release-process.md
(1 hunks)src/Makefile.am
(2 hunks)src/Makefile.test.include
(2 hunks)src/httprpc.cpp
(2 hunks)src/init.cpp
(1 hunks)src/masternode/node.h
(1 hunks)src/node/chainstate.cpp
(1 hunks)src/node/miner.h
(1 hunks)src/rest.cpp
(1 hunks)src/rpc/util.cpp
(2 hunks)src/script/interpreter.cpp
(0 hunks)src/script/interpreter.h
(0 hunks)src/script/miniscript.cpp
(1 hunks)src/script/miniscript.h
(1 hunks)src/script/script.cpp
(1 hunks)src/script/script.h
(2 hunks)src/script/standard.cpp
(0 hunks)src/script/standard.h
(1 hunks)src/test/fuzz/miniscript_decode.cpp
(1 hunks)src/test/fuzz/tx_pool.cpp
(1 hunks)src/test/miner_tests.cpp
(5 hunks)src/test/miniscript_tests.cpp
(1 hunks)src/test/txpackage_tests.cpp
(9 hunks)src/validation.cpp
(12 hunks)src/validation.h
(2 hunks)src/validationinterface.cpp
(3 hunks)src/validationinterface.h
(1 hunks)src/wallet/rpc/backup.cpp
(2 hunks)src/wallet/rpc/coins.cpp
(3 hunks)test/functional/rpc_users.py
(1 hunks)
💤 Files with no reviewable changes (3)
- src/script/interpreter.h
- src/script/standard.cpp
- src/script/interpreter.cpp
✅ Files skipped from review due to trivial changes (1)
- src/wallet/rpc/backup.cpp
🚧 Files skipped from review as they are similar to previous changes (15)
- contrib/devtools/README.md
- src/Makefile.test.include
- src/test/fuzz/miniscript_decode.cpp
- src/script/standard.h
- src/script/script.cpp
- src/rest.cpp
- src/init.cpp
- src/masternode/node.h
- doc/build-openbsd.md
- src/validationinterface.h
- src/httprpc.cpp
- ci/lint/04_install.sh
- contrib/containers/ci/ci-slim.Dockerfile
- src/node/chainstate.cpp
- src/script/script.h
🧰 Additional context used
📓 Path-based instructions (5)
contrib/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the contrib directory (contributed scripts)
Files:
contrib/debian/examples/dash.conf
contrib/guix/libexec/build.sh
contrib/devtools/gen-dash-conf.sh
src/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{cpp,h,cc,cxx,hpp}
: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction
Files:
src/validationinterface.cpp
src/rpc/util.cpp
src/test/txpackage_tests.cpp
src/node/miner.h
src/test/miner_tests.cpp
src/test/miniscript_tests.cpp
src/script/miniscript.cpp
src/test/fuzz/tx_pool.cpp
src/validation.cpp
src/script/miniscript.h
src/validation.h
src/wallet/rpc/coins.cpp
doc/**
📄 CodeRabbit inference engine (CLAUDE.md)
Unless specifically prompted, avoid making changes to the doc directory (documentation)
Files:
doc/release-process.md
doc/dash-conf.md
doc/policy/packages.md
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Unit tests for C++ code should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests
Files:
src/test/txpackage_tests.cpp
src/test/miner_tests.cpp
src/test/miniscript_tests.cpp
src/test/fuzz/tx_pool.cpp
test/functional/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Functional tests should be written in Python and placed in test/functional/
Files:
test/functional/rpc_users.py
🧠 Learnings (1)
📚 Learning: 2025-10-05T20:38:28.442Z
Learnt from: knst
PR: dashpay/dash#6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.442Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Applied to files:
contrib/guix/libexec/build.sh
🧬 Code graph analysis (8)
src/test/txpackage_tests.cpp (2)
src/test/util/setup_common.cpp (4)
mineBlocks
(453-467)mineBlocks
(453-453)CreateValidMempoolTransaction
(550-597)CreateValidMempoolTransaction
(550-556)src/validation.cpp (2)
ProcessNewPackage
(1420-1438)ProcessNewPackage
(1420-1421)
src/test/miniscript_tests.cpp (2)
src/test/fuzz/miniscript_decode.cpp (8)
key
(24-27)key
(24-24)key
(28-30)key
(28-28)key
(31-34)key
(31-31)FromString
(37-41)FromString
(37-37)src/crypto/ripemd160.h (1)
CRIPEMD160
(12-26)
src/script/miniscript.cpp (3)
src/script/script.h (4)
DecodeOP_N
(488-494)vector
(330-361)CScriptNum
(211-226)CScriptNum
(230-240)src/script/standard.h (1)
IsPushdataOp
(111-114)src/script/script.cpp (2)
CheckMinimalPush
(386-409)CheckMinimalPush
(386-386)
src/test/fuzz/tx_pool.cpp (1)
src/validation.cpp (2)
ProcessNewPackage
(1420-1438)ProcessNewPackage
(1420-1421)
src/validation.cpp (1)
src/validation.h (1)
state
(169-194)
test/functional/rpc_users.py (1)
test/functional/test_framework/test_node.py (1)
assert_start_raises_init_error
(606-649)
src/script/miniscript.h (2)
src/script/miniscript.cpp (12)
ComputeType
(38-251)ComputeType
(38-38)ComputeScriptLen
(253-284)ComputeScriptLen
(253-253)SanitizeType
(16-36)SanitizeType
(16-16)FindNextChar
(338-346)FindNextChar
(338-338)DecomposeScript
(286-321)DecomposeScript
(286-286)ParseScriptNumber
(323-336)ParseScriptNumber
(323-323)src/test/fuzz/miniscript_decode.cpp (8)
key
(24-27)key
(24-24)key
(28-30)key
(28-28)key
(31-34)key
(31-31)FromString
(37-41)FromString
(37-37)
src/wallet/rpc/coins.cpp (2)
src/wallet/rpc/util.cpp (2)
LabelFromValue
(117-123)LabelFromValue
(117-117)src/wallet/scriptpubkeyman.h (1)
wallet
(28-241)
🪛 markdownlint-cli2 (0.18.1)
doc/dash-conf.md
71-71: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
doc/policy/packages.md
71-71: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build container / Build container
🔇 Additional comments (24)
src/rpc/util.cpp (2)
379-379
: LGTM!The named-argument comment
/*oneline=*/false
improves code readability by clarifying the boolean parameter's purpose without changing functionality.
582-582
: LGTM!The named-argument comment
/*oneline=*/true
improves code readability by clarifying the boolean parameter's purpose without changing functionality.doc/release-process.md (1)
4-6
: LGTM!The updated branch references (from master to develop) and the new dash.conf checklist item align with the PR objectives and the new configuration generation workflow.
contrib/debian/examples/dash.conf (1)
1-1
: LGTM!Replacing the static example with a placeholder that references the generation script is a reasonable approach for maintaining an up-to-date configuration example.
contrib/guix/libexec/build.sh (1)
358-360
: Verify the source path matches the generation script output.The copy command expects the dash.conf at
${DISTSRC}/share/examples/dash.conf
. However, the generation scriptgen-dash-conf.sh
has a default path that points tocontrib/debian/examples/
(see my comment on that file). Ensure the generation script is updated to output to the correct location, or this copy will fail during the build process.Based on learnings: keeping the typo "buildling" to reduce merge conflicts with upstream Bitcoin Core.
src/test/miner_tests.cpp (3)
40-41
: LGTM!The new helper function declarations are well-designed with appropriate lock annotations and parameters. The
baseheight
parameter inTestBasicMining
is correctly threaded through to support relative locktime tests.
210-482
: LGTM!The
TestBasicMining
helper effectively consolidates mining test scenarios (sigops limits, block size, orphans, fee rates, and various locktime conditions) into a cohesive function. Thebaseheight
parameter is correctly utilized for relative locktime calculations.
484-557
: LGTM!The
TestPrioritisedMining
helper correctly tests transaction prioritisation logic, including edge cases with ancestor fee calculations and de-prioritised transactions.src/wallet/rpc/coins.cpp (3)
22-30
: LGTM! Correct filtering logic.The by_label path correctly iterates through addresses for the label, converts them to scripts, and filters by wallet ownership using
IsMine()
. This properly handles watch-only or other non-owned addresses.
31-42
: LGTM! Proper validation and error handling.The single-address path correctly validates the destination early, converts it to a script, checks wallet ownership, and provides clear error messages for invalid addresses (
RPC_INVALID_ADDRESS_OR_KEY
) and non-owned addresses (RPC_WALLET_ERROR
).
74-74
: Logic improvement: filtering by scriptPubKey is more accurate.Switching from destination-based filtering to scriptPubKey-based filtering is a positive change, as it correctly handles scriptPubKeys that cannot be converted to destinations. The logic is correct.
Note: The performance concern with
std::find
on a vector has been flagged at line 20.src/node/miner.h (1)
138-138
: LGTM: Modified fee correctly used for parent inclusion accounting.The change from
iter->GetFee()
toiter->GetModifiedFee()
ensures prioritisation deltas are included when adjusting ancestor fee totals during package assembly.src/test/fuzz/tx_pool.cpp (1)
236-247
: LGTM: Conditional validation correctly handles PCKG_POLICY state.The added conditional check prevents accessing
m_tx_results
when the package state isPCKG_POLICY
, which can occur when package-specific policy violations prevent individual transaction validation. This correctly aligns with the package validation flow.src/validationinterface.cpp (1)
21-99
: LGTM: Type rename is consistent and does not affect behavior.The renaming of
MainSignalsInstance
toMainSignalsImpl
is a pure refactoring change with no functional impact. All references are updated consistently.src/Makefile.am (2)
348-348
: LGTM: Miniscript header correctly added to public API.The addition of
script/miniscript.h
to the exported headers list enables Miniscript front-end functionality for the codebase.
926-926
: LGTM: Miniscript implementation correctly added to common library.The addition of
script/miniscript.cpp
tolibbitcoin_common_a_SOURCES
ensures the Miniscript implementation is available to both dashd and dash-qt.doc/policy/packages.md (1)
64-98
: LGTM: Package fees documentation is comprehensive and accurate.The new "Package Fees and Feerate" section clearly explains:
- Package feerate calculation (excluding deduplicated mempool transactions)
- How package feerate satisfies fee requirements
- CPFP semantics and rationales
- Implementation details about individual-first validation
The documentation aligns well with the code changes throughout the PR.
src/test/txpackage_tests.cpp (4)
84-108
: LGTM: Updated amounts and package feerate validation.The increased output amounts (499/498 COIN) ensure sufficient fees for individual transaction validation, and the new assertions correctly verify that
m_package_feerate
is present with the expected value.
120-120
: LGTM: Correct nullopt assertion for oversized transaction.Single oversized transactions fail validation early without computing package feerate, so
std::nullopt
is the correct expectation.
241-344
: LGTM: Appropriate nullopt checks for non-package scenarios.The assertions correctly verify that
m_package_feerate
isstd::nullopt
when:
- Package structure is invalid (unrelated transactions, missing parents, etc.)
- Individual transactions pass validation without requiring package-level checks
348-537
: LGTM: Comprehensive CPFP test coverage.The new
package_cpfp_tests
suite thoroughly validates:
- Zero-fee parent with fee-paying child
- Package feerate calculation with prioritisation deltas
- Low-feerate package rejection
- High-fee parent with low-fee child (parent-only acceptance)
The tests correctly exercise package-fee policy semantics and edge cases.
src/validation.h (2)
183-183
: Minor documentation clarification: "Size" vs "Virtual size".The comment change from "Virtual size" to "Size" is a minor clarification. The field continues to represent the same mempool-used size metric.
234-245
: LGTM: Package feerate field and constructor correctly added.The new
m_package_feerate
field and constructor enable package-level feerate to be propagated through validation results. The field documentation clearly explains when it may be unavailable, and the addition is backward compatible.src/test/miniscript_tests.cpp (1)
1-291
: LGTM: Comprehensive and well-structured Miniscript test suite.The new test file provides excellent coverage of Miniscript functionality:
Test infrastructure:
TestData
precomputes necessary test data (pubkeys, hashes)KeyConverter
handles CPubKey conversions for Miniscript integrationTest
helper validates properties: IsValid, IsValidTopLevel, malleability, signature requirements, timelock semantics, script roundtripsTest coverage:
- Validity rules for wrappers and fragments (andor, and_v, or_b, etc.)
- Threshold edge cases (k=0, k=n, k>n)
- Timelock mixing detection
- Non-minimal push and VERIFY detection
- Ops and stack size limits
- Extensive randomized type/node combinations
The test suite properly initializes and cleans up global state.
const uint32_t k = 0; | ||
//! The keys used by this expression (only for PK_K/PK_H/MULTI) | ||
const std::vector<Key> keys; | ||
//! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD10). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the typo in the comment.
"RIPEMD10" should be "RIPEMD160".
Apply this diff:
- //! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD10).
+ //! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD160).
📝 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.
//! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD10). | |
//! The data bytes in this expression (only for HASH160/HASH256/SHA256/RIPEMD160). |
🤖 Prompt for AI Agents
In src/script/miniscript.h around line 287, the comment contains a typo:
"RIPEMD10" should be "RIPEMD160"; update the comment to read "RIPEMD160" so it
correctly lists HASH160/HASH256/SHA256/RIPEMD160 as the supported hash types.
LOCK2(cs_main, m_node.mempool->cs); | ||
TestPackageSelection(chainparams, scriptPubKey, txFirst); | ||
|
||
m_node.chainman->ActiveChain().Tip()->nHeight--; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct chain state manipulation bypasses normal APIs and risks corruption.
Directly decrementing nHeight
on the chain tip bypasses proper chain management (e.g., InvalidateBlock
) and can leave the blockchain in an inconsistent state. This could break invariants in CChainState
, corrupt metadata like cumulative work, or cause subtle test failures.
Consider using InvalidateBlock
to properly rewind the chain, or investigate why TestPackageSelection
might be advancing the height and prevent that if unintended. If this decrement is a workaround for test state management, document why normal APIs cannot be used and what invariants are being maintained.
🤖 Prompt for AI Agents
In src/test/miner_tests.cpp around line 641, directly decrementing
m_node.chainman->ActiveChain().Tip()->nHeight bypasses chain management APIs and
can corrupt chain state; replace this direct mutation by rewinding via the
proper API (call InvalidateBlock on the current tip or use
CChainState::DisconnectBlock/DeactivateBestChain as appropriate) so the chain
tip is rolled back cleanly, or modify the test to avoid advancing the height in
the first place; if you cannot use normal APIs for test isolation, add a clear
comment explaining why and document the invariants preserved.
pkg_add bash git gmake libevent libtool boost | ||
# Select the newest version of the following packages: | ||
pkg_add autoconf automake python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
24796: this should be reverted
EDIT: typo fix should be applied after 24652 from #6874
SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/contrib/debian/examples/} | ||
EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/dash.conf} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
22235: should fix path inconsistencies indeed - replace share/examples/
with contrib/debian/examples/
in all docs and scripts
b42643c doc: update init.cpp -conf help text (josibake) 970b998 doc: update devtools, release-process readmes (josibake) 50635d2 build: include bitcoin.conf in build outputs (josibake) 6aac946 doc: update bitcoin-conf.md (Josiah Baker) 1c7e820 script: add script to generate example bitcoin.conf (josibake) b483084 doc: replace bitcoin.conf with placeholder file (josibake) Pull request description: create a script for parsing the output from `bitcoind --help` to create an example conf file for new users ## problem per bitcoin#10746 , `bitcoin.conf` not being put into the data directory during installation causes some confusion for users when running bitcoin. in the discussion on the issue, one proposed solution was to have an example config file and instruct users to `cp` it into their data directory after startup. in addition to bitcoin#10746 , there have been other requests for a "skeleton config file" (bitcoin#19641) to help users get started with configuring bitcoind. the main issue with an example config file is that it creates a second source of truth regarding what options are available for configuring bitcoind. this means any changes to the options (including the addition or removal of options) would have to be updated for the command line and also updated in the example file. this PR addresses this issue by providing a script to generate an example file directly from the `bitcoind --help` on-demand by running `contrib/devtools/gen-bitcoin-conf.sh`. this solution was originally proposed on bitcoin#10746 and would also solve bitcoin#19641 . this guarantees any changes made to the command-line options or the command-line options help would also be reflected in the example file after compiling and running the script. the main purpose of this script is to generate a config file to be included with releases, same as `gen-manpages.sh`. this ensures every release also includes an up-to-date, full example config file for users to edit. the script is also available for users who compile from source for generating an example config for their compiled binary. ## special considerations this removes the `bitcoin.conf` example file from the repo as it is now generated by this script. the original example file did contain extra text related to how to use certain options but going forward all option help docs should be moved into `init.cpp` this also edits `init.cpp` to have the option help indicate that `-conf` is not usable from the config file. this is similar to how `-includeconf` 's help indicates it cannot be used from the command line ACKs for top commit: laanwj: Tested and code review ACK b42643c Tree-SHA512: 4546e0cef92aa1398da553294ce4712d02e616dd72dcbe0b921af474e54f24750464ec813661f1283802472d1e8774e634dd1cc26fbf1f13286d3e0406c02c09
BLOCKED BY #6874 see #6871 (review)
What was done?
Regular backports from Bitcoin V24
How Has This Been Tested?
Run unit & functional tests
Breaking Changes
There is a new way to prepare default
dash.conf
, the docs for release process are updated accordinglyChecklist: