Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Nov 30, 2025

What was done?

Some regular backports, mostly from Bitcoin Core v23 that has been missing by various reasons

Also fixed conditions for DNS-seed requesting, as follow-up for bitcoin#19316

How Has This Been Tested?

Run unit & functional tests

Breaking Changes

N/A
Changes of RPC in src/rpc/external_signer.cpp are not breaking changes because it has not been released yet.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

fanquake and others added 4 commits December 1, 2025 00:35
…essing

0829516 [refactor] Remove unused ForEachNodeThen() template (John Newbery)
09cc66c scripted-diff: rename address relay fields (John Newbery)
76568a3 [net processing] Move addr relay data and logic into net processing (John Newbery)
caba7ae [net processing] Make RelayAddress() a member function of PeerManagerImpl (John Newbery)
86acc96 [net processing] Take NodeId instead of CNode* as originator for RelayAddress() (John Newbery)

Pull request description:

  This continues the work of moving application layer data into net_processing, by moving all addr data into the new Peer object added in bitcoin#19607.

  For motivation, see bitcoin#19398.

ACKs for top commit:
  laanwj:
    Code review ACK 0829516
  mzumsande:
    ACK 0829516, reviewed the code and ran tests.
  sipa:
    utACK 0829516
  hebasto:
    re-ACK 0829516

Tree-SHA512: efe0410fac288637f203eb37d1999910791e345872d37e1bd5cde50e25bb3cb1c369ab86b3a166ffd5e06ee72e4508aa2c46d658be6a54e20b4f220d2f57d0a6
…z test only once

faf7623 fuzz: Call const member functions in addrman fuzz test only once (MarcoFalke)

Pull request description:

  Logically based on bitcoin#21940

  Currently the fuzz test may spend a long time generating random numbers:

  ![Screenshot from 2021-05-13 12-14-09](https://user-images.githubusercontent.com/6399679/118112238-06ecd880-b3e5-11eb-8013-6e0c20e6159f.png)

  Fix that by calling const member functions only once.

  Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34224

ACKs for top commit:
  practicalswift:
    cr ACK faf7623: touches only `src/test/fuzz/addrman.cpp`

Tree-SHA512: 0fe9e0111eb1706fc39bd2f90d4b87a771882bada54c01e96d8e79c2afca2f1081139d5ab680285a81835cc5142e74ada422a181db34b01904975d1e167e64c2
fabf170 fuzz: Move CTxDestination fuzzing to script fuzz target (MarcoFalke)
fa42800 fuzz: Simplify CTxDestination fuzzing in the script target (MarcoFalke)
fab9986 fuzz: Improve ConsumeTxDestination (MarcoFalke)
fa40c09 fuzz: Move ConsumeTxDestination to cpp file (MarcoFalke)

Pull request description:

ACKs for top commit:
  practicalswift:
    cr ACK fabf170

Tree-SHA512: afd2cf384d04a810c0c462c6d80849bd0fefd017d7acac877f64f2bffae3fc8d687701bc479e67a727a05f43431a17cb4ccaf09c6b3c68106562c94b7ed19250
@knst knst added this to the 23.1 milestone Nov 30, 2025
@github-actions
Copy link

github-actions bot commented Nov 30, 2025

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Walkthrough

This pull request updates DNS seed handling and related tests and utilities. It adds a placeholder DNS seed for regtest, enforces that -forcednsseed cannot be true when -dnsseed is false, changes three default booleans to constexpr in src/net.h, removes three ForEachNodeThen overloads from CConnman, adjusts DNS seeding logic in ThreadDNSAddressSeed, and updates multiple tests (adds a new p2p DNS-seed functional test, switches tests to use P2P_SERVICES, and modifies several fuzz targets and test utilities).

Sequence Diagram

sequenceDiagram
    autonumber
    participant User
    participant Node
    participant DNS
    participant AddrMan
    participant Peers

    User->>Node: start node (with args: -dnsseed / -forcednsseed / -connect)
    Node->>Node: parse args & init parameters
    Node->>Node: validate flags (-forcednsseed vs -dnsseed)
    alt invalid flags
        Node-->>User: InitError (invalid flag combination)
    else valid
        Node->>AddrMan: query address count
        alt addrman < 1000
            Node->>Node: schedule DNS seed query (11s delay)
        else addrman >= 1000
            Node->>Node: schedule DNS seed query (300s delay)
        end
        Node->>Peers: check outbound / block-relay connections
        alt insufficient outbound peers
            Node->>DNS: query DNS seeds (may use regtest dummySeed)
            DNS-->>Node: return addresses
            Node->>AddrMan: add addresses
            AddrMan-->>Peers: provide addresses for connection attempts
        else enough outbound peers
            Node->>Node: skip DNS seeding
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Areas requiring extra attention:

  • src/init.cpp: new flag validation and localized InitError message
  • src/chainparams.cpp: addition of regtest placeholder DNS seed
  • src/net.cpp / src/net.h: change in ThreadDNSAddressSeed counting logic and removal of ForEachNodeThen overloads; ensure no remaining call sites
  • test/functional/p2p_dns_seeds.py: new comprehensive functional test covering many scenarios and timings
  • Multiple test framework changes: p2p.py, rpc tests, and tests switching to P2P_SERVICES (verify test expectations and message sizes)
  • Fuzz targets and utilities: src/test/fuzz/* and src/test/fuzz/util.{h,cpp} changes (const-qualification, CallOneOf return type, ConsumeTxDestination relocation)

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.11% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the PR as a set of backports from Bitcoin Core v23 and includes reference numbers, clearly communicating the main intent.
Description check ✅ Passed The description is directly related to the changeset, explaining what was done (backports and DNS-seed fix), how it was tested, and any breaking changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6faa2a and ff1557b.

📒 Files selected for processing (18)
  • src/chainparams.cpp (1 hunks)
  • src/init.cpp (1 hunks)
  • src/net.cpp (1 hunks)
  • src/net.h (1 hunks)
  • src/qt/rpcconsole.cpp (2 hunks)
  • src/qt/sendcoinsdialog.cpp (1 hunks)
  • src/rpc/external_signer.cpp (1 hunks)
  • test/functional/feature_config_args.py (2 hunks)
  • test/functional/mempool_package_limits.py (3 hunks)
  • test/functional/p2p_addr_relay.py (3 hunks)
  • test/functional/p2p_addrfetch.py (1 hunks)
  • test/functional/p2p_addrv2_relay.py (3 hunks)
  • test/functional/p2p_dns_seeds.py (1 hunks)
  • test/functional/rpc_net.py (3 hunks)
  • test/functional/rpc_signer.py (1 hunks)
  • test/functional/test_framework/p2p.py (1 hunks)
  • test/functional/test_runner.py (1 hunks)
  • test/functional/tool_wallet.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • test/functional/test_runner.py
  • src/qt/sendcoinsdialog.cpp
  • src/qt/rpcconsole.cpp
  • test/functional/p2p_addrfetch.py
  • test/functional/p2p_addr_relay.py
  • src/rpc/external_signer.cpp
  • test/functional/tool_wallet.py
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.{cpp,h,hpp,cc}

📄 CodeRabbit inference engine (CLAUDE.md)

Dash Core implementation must be written in C++20, requiring at least Clang 16 or GCC 11.1

Files:

  • src/net.cpp
  • src/init.cpp
  • src/net.h
  • src/chainparams.cpp
test/functional/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Functional tests in test/functional/ must be written in Python (minimum version specified in .python-version) and depend on dashd and dash-node

Files:

  • test/functional/p2p_dns_seeds.py
  • test/functional/p2p_addrv2_relay.py
  • test/functional/test_framework/p2p.py
  • test/functional/mempool_package_limits.py
  • test/functional/rpc_net.py
  • test/functional/rpc_signer.py
  • test/functional/feature_config_args.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.

Applied to files:

  • test/functional/feature_config_args.py
🧬 Code graph analysis (6)
test/functional/p2p_dns_seeds.py (1)
test/functional/test_framework/test_node.py (3)
  • assert_debug_log (444-472)
  • assert_start_raises_init_error (606-649)
  • add_outbound_p2p_connection (710-772)
test/functional/p2p_addrv2_relay.py (2)
test/functional/test_framework/p2p.py (1)
  • P2PInterface (492-770)
src/protocol.h (1)
  • nServices (482-490)
test/functional/mempool_package_limits.py (3)
test/functional/test_framework/messages.py (1)
  • tx_from_hex (230-232)
test/functional/test_framework/wallet.py (1)
  • make_chain (346-364)
test/functional/test_framework/util.py (1)
  • assert_equal (69-74)
test/functional/rpc_net.py (1)
test/functional/test_framework/p2p.py (1)
  • P2PInterface (492-770)
test/functional/rpc_signer.py (2)
test/functional/test_framework/util.py (1)
  • assert_raises_rpc_error (132-148)
src/rpc/external_signer.cpp (2)
  • enumeratesigners (16-62)
  • enumeratesigners (16-16)
test/functional/feature_config_args.py (1)
test/functional/test_framework/test_node.py (1)
  • assert_debug_log (444-472)
🪛 Ruff (0.14.6)
test/functional/mempool_package_limits.py

216-216: Loop control variable i not used within loop body

Rename unused i to _i

(B007)

🔇 Additional comments (13)
test/functional/rpc_signer.py (1)

55-61: Platform‑aware error substring looks correct

The conditional expected error string for Windows vs non‑Windows makes the test portable while still asserting the exact failure mode. The usage of platform.system() == "Windows" is consistent with the rest of the file, and the argument ordering to assert_raises_rpc_error remains correct.

src/init.cpp (1)

1226-1229: Validation of -forcednsseed vs -dnsseed is correct and well‑placed

The new check cleanly enforces that DNS seeding cannot be forced when DNS seeding is disabled, and it’s positioned appropriately among other startup argument validations. No issues spotted.

src/chainparams.cpp (1)

857-860: Regtest dummy DNS seed looks correct and matches intended behavior

Adding dummySeed.invalid. as the sole regtest DNS seed is consistent with exercising DNS‑seeding logic while guaranteeing no real peers are discovered. Interaction with fixed seeds and tests remains sound.

test/functional/feature_config_args.py (2)

185-198: Updated DNS‑seed comment and log expectations align with new regtest behavior

The clarified comment and the added expectations ("0 addresses found from DNS seeds" and "opencon thread start", with timeout=10) accurately reflect the new regtest DNS‑seed flow and should make this test more robust.


233-240: Stronger assertions for -dnsseed=0 + -addnode seed‑peer case

Including "opencon thread start" in expected_msgs and extending the timeout mirrors the earlier block and better synchronizes the test with node startup, while staying consistent with the intended fallback‑to‑fixed‑seeds semantics.

src/net.h (1)

115-117: Switch to constexpr DNS seed defaults is safe and consistent

Using static constexpr bool here preserves the existing values, improves compile-time usage, and matches modern C++ style with no behavioral change.

src/net.cpp (1)

2679-2685: DNS seed readiness now keyed off full outbound peers only

Counting only successfully connected, non‑probe IsFullOutboundConn() peers for nRelevant before stopping DNS seeding matches how outbound slots are managed elsewhere and avoids probes influencing readiness; looks correct for the backport.

test/functional/rpc_net.py (2)

10-16: Import adjustment to use P2PInterface directly is appropriate

The new P2PInterface import matches how the class is used throughout this test module and dropping unused message constants keeps the dependency surface minimal while aligning with the current P2P test framework.


296-313: Hardcoding services == 1 in getnodeaddresses checks matches addpeeraddress behavior

For addresses inserted via addpeeraddress, expecting services to be 1 (the NODE_NETWORK bit) for both IPv4 and IPv6 entries is consistent with addrman’s default service flags and mirrors the upstream test logic, keeping this backport faithful. Based on learnings, preserving this upstream behavior is preferable.

test/functional/test_framework/p2p.py (1)

543-543: LGTM! Good refactoring to use P2P_SERVICES constant.

Replacing the hardcoded NODE_NETWORK | NODE_HEADERS_COMPRESSED with the P2P_SERVICES constant improves maintainability and aligns with the broader pattern of using this constant across the test framework.

test/functional/p2p_addrv2_relay.py (1)

15-18: LGTM! Coordinated update to use P2P_SERVICES.

The changes correctly update the test to use P2P_SERVICES instead of just NODE_NETWORK:

  • Import added for P2P_SERVICES
  • Size calculation updated to reflect COMPACTSIZE encoding of P2P_SERVICES (3 bytes instead of 1 byte for NODE_NETWORK)
  • Address service flag assignment updated to P2P_SERVICES

These changes are internally consistent and align with the PR's goal of standardizing service flag usage across tests.

Also applies to: 47-47, 65-65

test/functional/p2p_dns_seeds.py (1)

1-129: LGTM! Comprehensive DNS seed behavior test.

This new test provides thorough coverage of DNS seeding logic:

  • Argument interaction validation (-dnsseed, -connect, -forcednsseed)
  • Connection-based DNS seeding behavior (outbound vs block-relay-only)
  • DNS query timing based on addrman size

The test is well-structured with clear test methods and appropriate assertions. Based on learnings, as a backport from Bitcoin Core, references to "bitcoind" in comments (lines 53, 89) should be preserved to maintain fidelity to the upstream implementation.

test/functional/mempool_package_limits.py (1)

23-52: New DEFAULT_FEE import and test wiring look correct

Pulling in DEFAULT_FEE from test_framework.wallet and adding test_desc_count_limits_2() to run_test() integrates cleanly with the existing fee handling and test sequencing; no issues seen.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 199ac79 and d6faa2a.

📒 Files selected for processing (24)
  • src/chainparams.cpp (1 hunks)
  • src/init.cpp (1 hunks)
  • src/net.h (1 hunks)
  • src/qt/rpcconsole.cpp (2 hunks)
  • src/qt/sendcoinsdialog.cpp (1 hunks)
  • src/rpc/external_signer.cpp (1 hunks)
  • src/test/fuzz/addrman.cpp (2 hunks)
  • src/test/fuzz/connman.cpp (0 hunks)
  • src/test/fuzz/integer.cpp (0 hunks)
  • src/test/fuzz/key_io.cpp (0 hunks)
  • src/test/fuzz/script.cpp (2 hunks)
  • src/test/fuzz/util.cpp (2 hunks)
  • src/test/fuzz/util.h (2 hunks)
  • test/functional/feature_config_args.py (2 hunks)
  • test/functional/mempool_package_limits.py (3 hunks)
  • test/functional/p2p_addr_relay.py (3 hunks)
  • test/functional/p2p_addrfetch.py (1 hunks)
  • test/functional/p2p_addrv2_relay.py (3 hunks)
  • test/functional/p2p_dns_seeds.py (1 hunks)
  • test/functional/rpc_net.py (3 hunks)
  • test/functional/rpc_signer.py (1 hunks)
  • test/functional/test_framework/p2p.py (1 hunks)
  • test/functional/test_runner.py (1 hunks)
  • test/functional/tool_wallet.py (1 hunks)
💤 Files with no reviewable changes (3)
  • src/test/fuzz/key_io.cpp
  • src/test/fuzz/integer.cpp
  • src/test/fuzz/connman.cpp
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.{cpp,h,hpp,cc}

📄 CodeRabbit inference engine (CLAUDE.md)

Dash Core implementation must be written in C++20, requiring at least Clang 16 or GCC 11.1

Files:

  • src/chainparams.cpp
  • src/qt/sendcoinsdialog.cpp
  • src/test/fuzz/util.h
  • src/test/fuzz/script.cpp
  • src/test/fuzz/util.cpp
  • src/init.cpp
  • src/net.h
  • src/qt/rpcconsole.cpp
  • src/test/fuzz/addrman.cpp
  • src/rpc/external_signer.cpp
src/qt/**/*.{cpp,h}

📄 CodeRabbit inference engine (CLAUDE.md)

GUI implementation in src/qt/ must use Qt 5

Files:

  • src/qt/sendcoinsdialog.cpp
  • src/qt/rpcconsole.cpp
src/{test,wallet/test}/**/*.{cpp,h}

📄 CodeRabbit inference engine (CLAUDE.md)

Unit tests in src/test/ and src/wallet/test/ must use Boost::Test framework

Files:

  • src/test/fuzz/util.h
  • src/test/fuzz/script.cpp
  • src/test/fuzz/util.cpp
  • src/test/fuzz/addrman.cpp
test/functional/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Functional tests in test/functional/ must be written in Python (minimum version specified in .python-version) and depend on dashd and dash-node

Files:

  • test/functional/p2p_addrfetch.py
  • test/functional/rpc_signer.py
  • test/functional/rpc_net.py
  • test/functional/p2p_addrv2_relay.py
  • test/functional/test_framework/p2p.py
  • test/functional/feature_config_args.py
  • test/functional/test_runner.py
  • test/functional/tool_wallet.py
  • test/functional/p2p_dns_seeds.py
  • test/functional/mempool_package_limits.py
  • test/functional/p2p_addr_relay.py
🧠 Learnings (5)
📓 Common learnings
Learnt from: knst
Repo: dashpay/dash PR: 6916
File: src/univalue/include/univalue.h:81-88
Timestamp: 2025-10-25T07:08:51.918Z
Learning: For backport PRs from bitcoin/bitcoin, bitcoin-core/gui, etc., backported changes should match the original upstream PRs even if they appear strange, modify vendored code, or seem to violate coding guidelines. Still flag genuine issues like bugs, undefined behavior, crashes, compilation errors, or linter failures.
Learnt from: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.
Learnt from: PastaPastaPasta
Repo: dashpay/dash PR: 6804
File: src/qt/proposalwizard.cpp:40-42
Timestamp: 2025-08-11T17:16:36.654Z
Learning: In the Dash repository, when a PR adds new files that are not from Bitcoin backports, these files must be added to the list in test/util/data/non-backported.txt. This applies to newly created files like qt/proposalwizard.{h,cpp} and forms/proposalwizard.ui. Limited exemptions may exist for subtrees and similar cases.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
📚 Learning: 2025-10-05T20:38:28.457Z
Learnt from: knst
Repo: dashpay/dash PR: 6871
File: contrib/guix/libexec/build.sh:358-360
Timestamp: 2025-10-05T20:38:28.457Z
Learning: In the Dash repository, when backporting code from Bitcoin Core, typos and minor issues in comments should be kept as-is to reduce merge conflicts in future backports, even if they remain unfixed in Bitcoin Core's master branch.

Applied to files:

  • src/qt/sendcoinsdialog.cpp
📚 Learning: 2025-08-08T07:01:47.332Z
Learnt from: knst
Repo: dashpay/dash PR: 6805
File: src/wallet/rpc/wallet.cpp:357-357
Timestamp: 2025-08-08T07:01:47.332Z
Learning: In src/wallet/rpc/wallet.cpp, the upgradetohd RPC now returns a UniValue string message (RPCResult::Type::STR) instead of a boolean, including guidance about mnemonic backup and null-character passphrase handling; functional tests have been updated to assert returned strings in several cases.

Applied to files:

  • src/qt/sendcoinsdialog.cpp
📚 Learning: 2025-11-24T16:41:22.457Z
Learnt from: CR
Repo: dashpay/dash PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:41:22.457Z
Learning: Applies to src/{validation,txmempool}/**/*.{cpp,h} : Block validation and mempool handling must use extensions to Bitcoin Core mechanisms for special transaction validation and enhanced transaction relay

Applied to files:

  • src/test/fuzz/script.cpp
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
Repo: dashpay/dash PR: 6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.

Applied to files:

  • test/functional/feature_config_args.py
🧬 Code graph analysis (9)
test/functional/p2p_addrfetch.py (3)
test/functional/test_framework/messages.py (1)
  • CAddress (258-381)
test/functional/test_framework/p2p.py (1)
  • P2PInterface (492-770)
src/protocol.h (1)
  • nServices (482-490)
src/test/fuzz/script.cpp (2)
src/test/fuzz/util.cpp (2)
  • ConsumeTxDestination (439-455)
  • ConsumeTxDestination (439-439)
src/script/descriptor.cpp (1)
  • EncodeDestination (664-664)
test/functional/rpc_signer.py (2)
test/functional/test_framework/util.py (1)
  • assert_raises_rpc_error (132-148)
src/rpc/external_signer.cpp (2)
  • enumeratesigners (16-62)
  • enumeratesigners (16-16)
test/functional/rpc_net.py (2)
test/functional/test_framework/p2p.py (1)
  • P2PInterface (492-770)
test/functional/test_framework/util.py (1)
  • assert_equal (69-74)
test/functional/p2p_addrv2_relay.py (2)
test/functional/test_framework/p2p.py (1)
  • P2PInterface (492-770)
src/protocol.h (1)
  • nServices (482-490)
test/functional/feature_config_args.py (2)
src/txmempool.h (1)
  • exists (788-792)
test/functional/test_framework/test_node.py (1)
  • assert_debug_log (444-472)
src/init.cpp (2)
src/chainparams.cpp (13)
  • args (699-699)
  • args (708-708)
  • args (754-754)
  • args (755-755)
  • args (756-756)
  • args (757-757)
  • args (758-758)
  • args (759-759)
  • args (961-961)
  • args (971-971)
  • args (982-982)
  • args (1005-1005)
  • args (1006-1006)
src/validation.cpp (3)
  • args (690-690)
  • args (699-699)
  • args (705-705)
test/functional/p2p_dns_seeds.py (3)
test/functional/test_framework/p2p.py (1)
  • P2PInterface (492-770)
test/functional/feature_config_args.py (1)
  • set_test_params (15-20)
test/functional/test_framework/test_node.py (2)
  • assert_debug_log (444-472)
  • add_outbound_p2p_connection (710-772)
test/functional/mempool_package_limits.py (2)
test/functional/test_framework/messages.py (1)
  • tx_from_hex (230-232)
test/functional/test_framework/wallet.py (1)
  • make_chain (346-364)
🪛 Ruff (0.14.6)
test/functional/mempool_package_limits.py

216-216: Loop control variable i not used within loop body

Rename unused i to _i

(B007)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: linux64_tsan-build / Build source
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
🔇 Additional comments (28)
test/functional/rpc_signer.py (1)

56-62: LGTM! Platform-aware error handling is correctly implemented.

The change appropriately handles OS-specific error messages when attempting to execute a non-existent external signer script. The Windows and Unix error messages accurately reflect the underlying system calls (CreateProcess vs. execve), making the test portable across platforms.

src/test/fuzz/addrman.cpp (2)

282-288: LGTM: Const-correctness testing for read-only operations.

The const reference wrapper correctly tests that GetAddr, Select, and Size can be invoked on a const AddrMan instance, which is appropriate for these read-only operations.


290-290: LGTM: Serialization through const reference.

Consistent with the const-correctness pattern, serialization now operates on the const reference, which correctly reflects that serialization is a read-only operation.

test/functional/mempool_package_limits.py (3)

27-27: LGTM!

The DEFAULT_FEE import is appropriately added to support fee calculations in the new test method.


52-52: LGTM!

The new test is appropriately placed in the test sequence after the related test_desc_count_limits test.


197-244: Test logic is correct and well-structured.

The test properly validates descendant count limits by:

  1. Creating M1 with 2 outputs
  2. Building a chain of 23 transactions (M2...M24) from one output
  3. Creating P1 and P2 from the other output
  4. Verifying that M1 exceeds descendant limits (23 in-mempool + 2 in-package = 26 total including M1)
  5. Confirming the package passes after clearing the mempool

Note: Unlike test_desc_count_limits (line 123) and other similar tests, this test doesn't assert the mempool is empty at the start. This is fine since the preceding test clears the mempool, but adding assert_equal(0, node.getmempoolinfo()["size"]) would improve test isolation if this matches upstream.

src/init.cpp (1)

1226-1229: DNS seed flags consistency check is sound

The new guard cleanly rejects the contradictory configuration where -forcednsseed is true while -dnsseed resolves to false after parameter interaction. This matches the intended semantics of the flags and integrates consistently with the surrounding InitError-based validations.

src/qt/sendcoinsdialog.cpp (1)

229-239: Translator hint for hardware signer text is appropriate

The updated translator comment around the “Sign on device” label correctly clarifies that “device” refers to a hardware wallet and does not affect runtime behavior or translation keys.

src/qt/rpcconsole.cpp (1)

735-773: Context-menu translator comments are clearer with no behavioral change

The added/expanded translator comments for “Copy address” and “Copy IP/Netmask” give better context to translators while leaving the actions and UI strings untouched.

src/chainparams.cpp (1)

857-859: Regtest dummy DNS seed aligns with expected behavior

Adding vSeeds.clear(); and a dummy "dummySeed.invalid." entry for regtest keeps real networks unaffected while letting DNS‑seed logic run in tests. Change looks correct and consistent with upstream behavior.

test/functional/tool_wallet.py (1)

355-357: Platform-correct wallet path construction

Using os.path.join(self.nodes[0].datadir, 'regtest', 'wallets', 'todump2') should now match the node’s actual database path on all platforms, making the error assertion robust.

src/rpc/external_signer.cpp (1)

24-32: RPC help schema now matches actual enumeratesigners result

Documenting signers as an array of objects with fingerprint and name correctly reflects the existing implementation that already returns objects, so this is a safe documentation alignment.

test/functional/feature_config_args.py (2)

185-198: Clarified DNS seed expectations and more robust log wait

The added comment and explicit timeout=10 on assert_debug_log make the DNS‑seed/fixed‑seed behavior clearer and the test less flaky on slow CI nodes.


233-240: Second addrman/fixed-seeds wait uses consistent timeout

Using timeout=10 here mirrors the earlier case and should reduce timing-related flakes while preserving the intended semantics of the test.

src/net.h (1)

115-117: constexpr DNS seed defaults are safe and idiomatic

Switching the DNS seed defaults to static constexpr bool preserves semantics while making them usable in constant expressions; fully compatible with the stated C++20 toolchain.

test/functional/test_runner.py (1)

150-163: Including p2p_dns_seeds.py in BASE_SCRIPTS is appropriate

Adding p2p_dns_seeds.py to the base suite integrates the new DNS‑seed test into normal runs and satisfies the naming/prefix checks.

test/functional/p2p_addrfetch.py (1)

11-19: Use of P2P_SERVICES for addr-fetch test address is consistent

Importing P2P_SERVICES and assigning ADDR.nServices = P2P_SERVICES aligns this test with the framework’s standard service flag set, keeping behavior and expectations consistent across P2P tests.

Also applies to: 23-27

test/functional/p2p_addrv2_relay.py (1)

15-18: Correct addrv2 size accounting for multi-bit P2P_SERVICES

Switching to P2P_SERVICES and updating calc_addrv2_msg_size to add 3 bytes for the compactsize‑encoded services field matches the actual wire encoding, so the debug‑log size checks should now be accurate.

Also applies to: 44-52, 61-76

test/functional/p2p_addr_relay.py (1)

11-27: Addr relay test updates correctly aligned with P2P_SERVICES

addr.nServices is now set from P2P_SERVICES and checked against 2049, which matches NODE_NETWORK | NODE_HEADERS_COMPRESSED given the new definition in test_framework/p2p.py. The additional msg_verack send in AddrReceiver.on_version and the use of assert_greater_than_or_equal in the rotation test are consistent with upstream behavior and the rest of this PR. No issues spotted.

Also applies to: 48-55, 107-113, 403-417

test/functional/test_framework/p2p.py (1)

543-547: peer_accept_connection default services correctly updated

Using services=P2P_SERVICES here brings inbound-side defaults in line with peer_connect and the rest of the test framework. Because services is a keyword-only argument, it is not forwarded to P2PConnection.peer_accept_connection, so existing call sites that already pass services keep working without impacting the lower-level protocol object. Looks good.

test/functional/rpc_net.py (1)

10-16: Service flag expectations in rpc_net tests are consistent with new P2P semantics

Importing P2PInterface for test_service_flags and explicitly setting (1 << 4) | (1 << 63) matches the expected servicesnames arrays, with P2P_V2 only present under v2 transport. In test_getnodeaddresses, asserting services == 1 for both IPv4 and IPv6 results correctly encodes that RPC-added peers carry just the NODE_NETWORK bit, decoupling the test from the NODE_NETWORK symbol while staying semantically identical. No functional issues noted.

Also applies to: 262-269, 271-313

test/functional/p2p_dns_seeds.py (1)

1-129: New DNS seed functional test matches upstream behavior and looks correct

The P2PDNSSeeds test class thoroughly covers interactions between -connect, -dnsseed, and -forcednsseed, as well as the outbound vs block-relay-only and addrman-size–dependent delay paths. The use of assert_debug_log for specific messages, explicit -dnsseed=1 where needed, and addrman population logic are consistent with the corresponding upstream Bitcoin Core test, with no Dash-specific regressions apparent.

src/test/fuzz/util.cpp (2)

8-8: LGTM!

The pubkey.h include is appropriately added to support the PKHash type used in the new ConsumeTxDestination function below.


439-455: No action needed. The assertion is correct for Dash Core.

Dash Core explicitly excludes SegWit witness types from its CTxDestination variant, which contains exactly 3 types: CNoDestination, PKHash (equivalent to CKeyID), and ScriptHash (equivalent to CScriptID). The assertion call_size == std::variant_size_v<CTxDestination> correctly validates that the CallOneOf function exercises all 3 variant alternatives.

src/test/fuzz/util.h (2)

103-113: LGTM!

The change to return call_size from CallOneOf is a clean enhancement that enables callers to verify they've provided the expected number of callables, useful for ensuring exhaustive variant coverage.


237-237: LGTM!

Moving the ConsumeTxDestination definition to the .cpp file is appropriate given the new assertion logic and reduces header dependencies.

src/test/fuzz/script.cpp (2)

10-13: LGTM!

The new includes are correctly added to support EncodeDestination, DecodeDestination, IsValidDestinationString from key_io.h and DescribeAddress from rpc/util.h.


131-151: LGTM!

The enhanced destination fuzzing comprehensively exercises the destination encoding/decoding round-trip, script generation, validity checks, and equality comparisons. The assertions correctly verify:

  • Round-trip encoding idempotency (line 138)
  • Script emptiness correlates with validity (line 142)
  • String validity matches destination validity (line 144)
  • Equal destinations produce equal derived values (lines 148-150)

This provides good coverage for destination-related code paths.

Comment on lines +179 to +195
def test_desc_count_limits_2(self):
"""Create a Package with 24 transaction in mempool and 2 transaction in package:
M1
^ ^
M2 ^
. ^
. ^
. ^
M24 ^
^
P1
^
P2
P1 has M1 as a mempool ancestor, P2 has no in-mempool ancestors, but when
combined P2 has M1 as an ancestor and M1 exceeds descendant_limits(23 in-mempool
descendants + 2 in-package descendants, a total of 26 including itself).
"""
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor typo in docstring.

Line 180: "24 transaction" should be "24 transactions" (plural).

     def test_desc_count_limits_2(self):
-        """Create a Package with 24 transaction in mempool and 2 transaction in package:
+        """Create a Package with 24 transactions in mempool and 2 transactions in package:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_desc_count_limits_2(self):
"""Create a Package with 24 transaction in mempool and 2 transaction in package:
M1
^ ^
M2 ^
. ^
. ^
. ^
M24 ^
^
P1
^
P2
P1 has M1 as a mempool ancestor, P2 has no in-mempool ancestors, but when
combined P2 has M1 as an ancestor and M1 exceeds descendant_limits(23 in-mempool
descendants + 2 in-package descendants, a total of 26 including itself).
"""
def test_desc_count_limits_2(self):
"""Create a Package with 24 transactions in mempool and 2 transactions in package:
M1
^ ^
M2 ^
. ^
. ^
. ^
M24 ^
^
P1
^
P2
P1 has M1 as a mempool ancestor, P2 has no in-mempool ancestors, but when
combined P2 has M1 as an ancestor and M1 exceeds descendant_limits(23 in-mempool
descendants + 2 in-package descendants, a total of 26 including itself).
"""
🤖 Prompt for AI Agents
In test/functional/mempool_package_limits.py around lines 179 to 195, the
docstring has a minor grammatical typo: change "24 transaction" to "24
transactions" so the sentence correctly uses the plural form.

Comment on lines +216 to +219
for i in range(23): # M2...M24
(tx, txhex, value, spk) = make_chain(node, self.address, self.privkeys, txid, value, 0, spk)
txid = tx.rehash()
node.sendrawtransaction(txhex)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Unused loop variable flagged by linter.

The loop variable i is not used within the loop body. Per Ruff B007, rename to _ to indicate it's intentionally unused.

-        for i in range(23): # M2...M24
+        for _ in range(23): # M2...M24
             (tx, txhex, value, spk) = make_chain(node, self.address, self.privkeys, txid, value, 0, spk)
             txid = tx.rehash()
             node.sendrawtransaction(txhex)
🧰 Tools
🪛 Ruff (0.14.6)

216-216: Loop control variable i not used within loop body

Rename unused i to _i

(B007)

🤖 Prompt for AI Agents
In test/functional/mempool_package_limits.py around lines 216 to 219, the
for-loop declares an unused loop variable `i`; rename `i` to `_` to satisfy the
linter rule (Ruff B007) indicating the loop index is intentionally unused, e.g.
change "for i in range(23):" to "for _ in range(23):".

@knst knst marked this pull request as draft November 30, 2025 20:27
MarcoFalke and others added 7 commits December 1, 2025 03:42
fa0c194 cirrus: Enable tests on windows (MarcoFalke)
fadecbd test: Fix tests on Windows (MarcoFalke)

Pull request description:

  Only a cherry-picked list. `--extended` can be enabled in a follow-up.

ACKs for top commit:
  hebasto:
    ACK fa0c194, tested locally on Windows 10 Pro 20H2 (build 19042.1165):

Tree-SHA512: 47cfbcef7ce5fe0c62b77a1e45ace513c4f0109b1fcfaec94faf9e488fe9430d6ba0e852230021d432847eb1389a4e4b7cf39bf17f7b09bae36af3079e0d7399
fa7db1c [test] checks descendants limtis for second generation Package descendants (ritickgoenka)

Pull request description:

  This PR adds a new functional test to test the new descendant limits for packages that were proposed in bitcoin#21800.
   ```
  +----------------------+
  |                      |
  |         M1           |
  |        ^  ^          |
  |       M2   ^         |
  |      .      ^        |
  |     .        ^       |
  |    .          ^      |
  |   .            ^     |
  |  M24            ^    |
  |                  ^   |
  |                  P1  |
  |                  ^   |
  |                  P2  |
  |                      |
  +----------------------+
  ```

  This test is for checking a transaction to fail its descendant count limits because of a combination of mempool descendants, package direct descendants, and package indirect descendants.

  In this test,  P1 has M1 as a mempool ancestor, P2 has no in-mempool ancestors, but when combined P2 has M1 as an ancestor and M1 exceeds descendant_limits (23 in-mempool descendants + 2 in-package descendants, a total of 26 including itself)

ACKs for top commit:
  ryanofsky:
    Code review ACK fa7db1c. Only were suggested changes since last review: simplifying test and dropping P3 transaction as John suggested, and adding assert_equal I suggested
  glozow:
    ACK fa7db1c
  jnewbery:
    ACK fa7db1c

Tree-SHA512: d1eb993550ac8ce31cbe42e17c6522a213ede66970d5d9391f31a116477ab5889fefa6ff2df6ceadd63a28c1be1ad893b0e8e449247e9ade2ca61dc636508d68
5cc783f qt: ensure translator comments end in full stop (Jarol Rodriguez)

Pull request description:

  This is a follow-up to dashpay#318 which addresses this [nit](bitcoin-core/gui#318 (comment)) by addressing it globally.

  This ensures that all GUI translator comments end in a full stop. If a comment does not end in a full stop, a translator may think  that the rest of the comment is being cut off.

  While here, add a colon to the word "see" for any comments touched which point to look at a link.

ACKs for top commit:
  hebasto:
    ACK 5cc783f, I have reviewed the code and it looks OK, I agree it can be merged.
  shaavan:
    Code Review ACK 5cc783f

Tree-SHA512: 67a1d56175c974e0af9b460fa44163f7ce139a7b81cfaf8ed2c0e7fb6d5120957c3135d96010aeb6229689468e36673fe9571b5a8c3e1c07e047aba1bd563444
BACKPORT NOTE:
added:
- changes in `rpc/external_signer.cpp`
still missing:
- field `signet_challenge` in rpc/mining.cpp

fa10fbc doc: Fix RPC result documentation (MarcoFalke)

Pull request description:

  Fix:
  * Incorrectly named fields
  * Add missing ones
  * Add missing optional flag

ACKs for top commit:
  fanquake:
    ACK fa10fbc

Tree-SHA512: 2b302e6f7ac8253a55882bc032ddda1932b728abddd12b0adb5fba814b12fb998a67b91e6dd124ebbe0ac16dccdace01332ade01c1dc00a3768647118dd3a2d2
…tant in functional tests

b69a106 test: use test_framework.p2p P2P_SERVICES in functional tests (Jon Atack)

Pull request description:

  `P2P_SERVICES` is defined in `test/functional/test_framework/p2p.py`, so we can use it as a single definition for our functional tests. It may also be a tiny bit more efficient to use the constant rather than calculating `NODE_NETWORK | NODE_WITNESS` every time we need it in the tests.

ACKs for top commit:
  laanwj:
    Code review ACK b69a106
  klementtan:
    crACK b69a106
  fanquake:
    ACK b69a106 - didn't look at the formatting changes.

Tree-SHA512: f83e593663a69182986325d9ba2b4b787b87896d6648973f4f802f191a2573201b9e7d7e10e69662ef1965fa63268845726ed1aa5742a2e38dcccf4aebc6a961
82b6f89 [style] Small style improvements to DNS parameters (Amiti Uttarwar)
4c89e24 [test] Test the delay before querying DNS seeds (Amiti Uttarwar)
6395c8e [test] Test the interactions between -forcednsseed and -dnsseed (Amiti Uttarwar)
6f6b7df [init] Disallow starting up with conflicting paramters for -dnsseed and -forcednsseed (Amiti Uttarwar)
26d0ffe [test] Test -forcednsseed causes querying DNS seeds (Amiti Uttarwar)
3585145 [test] Test the interactions between -connect and -dnsseed (Amiti Uttarwar)
75c05af [test] Test logic to query DNS seeds with block-relay-only connections (Amiti Uttarwar)
9c08719 [test] Introduce test logic to query DNS seeds (Amiti Uttarwar)

Pull request description:

  This PR adds a DNS seed to the regtest chain params to enable testing the DNS seed querying logic of `CConnman::ThreadDNSAddressSeed` and relevant startup parameters. Adds coverage for the changes in bitcoin#22013 (and then some).

  The main behavioral change to bitcoind is that this PR disallows starting up with conflicting parameters for `-dnsseed` and `-forcednsseed`.

  The tests include:
  * parameter interactions of different combinations of `-connect`, `-dnsseed` and `-forcednsseed`
  * the delay before querying DNS seeds depending on how many addresses are in the addrman
  * the behavior of `-forcednsseed`
  * skipping DNS querying if we have outbound full relay connections & not block-relay-only connections

  Huge props to mzumsande for identifying the timing technique for testing successful connections before running `ThreadDNSAddressSeed` 🙌🏽

ACKs for top commit:
  mzumsande:
    ACK 82b6f89
  jnewbery:
    reACK 82b6f89

Tree-SHA512: 9f0c29bfbf99426727e79c0a25606ae09deab91a92e3c5cee7f84c3ca7503a8ac9ab85a85c51841d40b164ef8c991326070f0b2f41d075fb7985df26f6e95d6d
@knst knst marked this pull request as ready for review December 1, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants