Skip to content

Conversation

@vijaydasmp
Copy link

@vijaydasmp vijaydasmp commented Dec 18, 2025

Backporting Bitcoin

@github-actions
Copy link

github-actions bot commented Dec 18, 2025

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@vijaydasmp vijaydasmp changed the title backport : Merge bitcoin#28523, 28583 backport: Merge bitcoin#28523, 28583 Dec 18, 2025
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28523, 28583 backport: Merge bitcoin#28583 Dec 20, 2025
@vijaydasmp vijaydasmp force-pushed the Jan_2026_2 branch 2 times, most recently from d20d4f3 to af9d7c0 Compare December 20, 2025 17:57
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28583 backport: Merge bitcoin#28085,26066 Dec 20, 2025
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28085,26066 backport: Merge bitcoin#28085,26066, 28101 Dec 20, 2025
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28085,26066, 28101 backport: Merge bitcoin#28085,26066, 28101, 28059 Dec 20, 2025
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28085,26066, 28101, 28059 backport: Merge bitcoin#28085, 26066, 28101, 28059 Dec 20, 2025
@vijaydasmp vijaydasmp force-pushed the Jan_2026_2 branch 2 times, most recently from d243418 to dc3ee4b Compare December 21, 2025 15:37
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28085, 26066, 28101, 28059 backport: Merge bitcoin#28085, 26066, 28101 Dec 21, 2025
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28085, 26066, 28101 backport: Merge bitcoin#26066, 28101 Dec 21, 2025
@vijaydasmp vijaydasmp force-pushed the Jan_2026_2 branch 3 times, most recently from 8196782 to ad07778 Compare December 22, 2025 15:54
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#26066, 28101 backport: Merge bitcoin#28101, 28649, 28787, 27572, 28025 Dec 22, 2025
@vijaydasmp vijaydasmp force-pushed the Jan_2026_2 branch 2 times, most recently from d6c3099 to 9ab5b24 Compare December 23, 2025 05:13
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#28101, 28649, 28787, 27572, 28025 backport: Merge bitcoin#28101, 28787, 27572, 28025 Dec 23, 2025
@vijaydasmp vijaydasmp marked this pull request as ready for review December 24, 2025 12:12
@coderabbitai
Copy link

coderabbitai bot commented Dec 24, 2025

Walkthrough

This pull request introduces a compile-time constant DEFAULT_TOR_CONTROL_PORT = 9051 and updates Tor control default address and help text to reference that constant. It removes the hidden wallet CLI option -zapwallettxes from registration and parameter interaction checks and from the lint optional-doc set. Test changes add a sign_input helper and replace inline signing and manual hashing with sign_input and sha256sum_file across several functional tests and test utilities. No public API signatures were changed.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description 'Backporting Bitcoin' is vague and does not convey meaningful information about which upstream changes are being backported or what they accomplish. Expand the description to briefly mention the key changes, such as: refactoring tor control defaults, removing the zapwallettxes option, and adding signing/hashing helpers to tests.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the four specific Bitcoin PRs being backported (28101, 28787, 27572, 28025), which directly aligns with the changeset across multiple files including torcontrol, wallet initialization, and test framework updates.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1269fe and ee2c196.

📒 Files selected for processing (10)
  • src/init.cpp
  • src/torcontrol.cpp
  • src/torcontrol.h
  • src/wallet/init.cpp
  • test/functional/feature_block.py
  • test/functional/rpc_dumptxoutset.py
  • test/functional/test_framework/script.py
  • test/functional/test_framework/wallet.py
  • test/functional/tool_wallet.py
  • test/lint/check-doc.py
💤 Files with no reviewable changes (1)
  • src/wallet/init.cpp
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/functional/feature_block.py
  • src/torcontrol.cpp
  • test/functional/rpc_dumptxoutset.py
  • src/init.cpp
  • test/functional/test_framework/script.py
🧰 Additional context used
📓 Path-based instructions (2)
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/test_framework/wallet.py
  • test/functional/tool_wallet.py
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/torcontrol.h
🧠 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: 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: kwvg
Repo: dashpay/dash PR: 6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: knst
Repo: dashpay/dash PR: 6883
File: src/rpc/rawtransaction.cpp:1088-1125
Timestamp: 2025-10-13T12:37:12.357Z
Learning: In backport pull requests (especially from Bitcoin Core), treat "moved" or refactored code as out-of-scope for content-level review. Focus validation on verifying that code is moved correctly: no fields added, no fields removed, no fields reordered, and no unexpected changes beyond whitespace adjustments. Pre-existing issues in the upstream code should be preserved to maintain fidelity to the original implementation.
Learnt from: 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: UdjinM6
Repo: dashpay/dash PR: 6786
File: ci/test/04_install.sh:99-101
Timestamp: 2025-08-01T07:46:37.840Z
Learning: In backport PRs like #6786, UdjinM6 prefers to defer non-critical fixes (such as shell command expansion issues) to separate commits/PRs to maintain focus on the primary backport objectives, consistent with the project's pattern of avoiding scope creep.
Learnt from: kwvg
Repo: dashpay/dash PR: 7072
File: src/qt/walletcontroller.cpp:520-528
Timestamp: 2025-12-17T13:58:26.891Z
Learning: In Dash Qt wallet code, when leveraging upstream Bitcoin Core wallet capabilities (especially for operations like rescanning), prefer using the inherited signal-based mechanisms (e.g., ShowProgress signals) over adding explicit Qt progress dialogs to minimize upstream deviation and simplify future backports.
📚 Learning: 2025-12-22T15:42:48.595Z
Learnt from: kwvg
Repo: dashpay/dash PR: 7068
File: src/qt/guiutil_font.h:68-77
Timestamp: 2025-12-22T15:42:48.595Z
Learning: In C++/Qt codebases, use fail-fast asserts in setters to enforce invariants (e.g., ensuring internal maps contain necessary keys). Prefer assert() for programmer errors that should be caught in development and debugging, rather than defensive runtime checks with fallbacks. This helps catch invariant violations early during development. Apply to header and source files where invariant-driven state mutations occur, especially in setters like SetWeightBold/SetWeightNormal that assume established relationships or preconditions.

Applied to files:

  • src/torcontrol.h
🧬 Code graph analysis (2)
test/functional/test_framework/wallet.py (1)
test/functional/test_framework/script.py (1)
  • sign_input (669-677)
test/functional/tool_wallet.py (1)
test/functional/test_framework/util.py (2)
  • assert_equal (69-74)
  • sha256sum_file (304-311)
🔇 Additional comments (6)
src/torcontrol.h (1)

22-22: LGTM! Clean refactoring to eliminate magic number.

The introduction of the DEFAULT_TOR_CONTROL_PORT constant follows C++ best practices and improves code maintainability by replacing the hardcoded port 9051 with a named constant.

test/lint/check-doc.py (1)

26-26: Removal of -zapwallettxes from SET_DOC_OPTIONAL is correct.

The option has been completely removed from the codebase. No references to -zapwallettxes remain in any GetArg, IsArgSet, or AddArg calls, so excluding it from the lint documentation requirements is appropriate.

test/functional/tool_wallet.py (2)

15-18: LGTM: Clean refactoring to use shared utility.

The import changes correctly replace the manual hashing implementation with the sha256sum_file helper from the test framework utilities.


51-52: LGTM: Upgrade from SHA-1 to SHA-256 with shared helper.

The refactored implementation is cleaner and uses SHA-256 instead of SHA-1, which is a security improvement. Since wallet_shasum() is only used for before/after comparisons in the tests (not checked against hardcoded values), this change is safe and won't break existing test logic.

test/functional/test_framework/wallet.py (2)

35-35: LGTM: Import updated to use shared signing helper.

The addition of sign_input from the test framework aligns with the PR objective to use shared utilities for signature generation across tests.


138-145: LGTM: Refactored to use sign_input helper with fixed-length signature generation.

The implementation correctly uses a probabilistic loop to generate signatures with exactly 73 bytes of scriptSig overhead when fixed_length=True. The clearing of scriptSig on line 142 ensures each sign_input call starts with a clean state, which is necessary since sign_input prepends to the existing scriptSig. The loop will converge quickly given the >49.89% probability per attempt mentioned in the comment.


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

❤️ Share

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

UdjinM6
UdjinM6 previously approved these changes Dec 27, 2025
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK b655259 with a nit

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK b1269fe

achow101 and others added 4 commits January 4, 2026 14:05
…ify that a default port is used

9a84200 doc, refactor: Changing -torcontrol help to specify that a default port is used (kevkevin)

Pull request description:

  Right now when we get the help for -torcontrol it says that there is a default ip and port we dont specify if there is a specified ip that we would also use port 9051 as default

  Also I create a new const instead of using 9051 directly in the function

  linking this PR because this was discussed here bitcoin#28018

ACKs for top commit:
  jonatack:
    re-ACK 9a84200
  achow101:
    ACK 9a84200
  MarnixCroes:
    utACK 9a84200
  kristapsk:
    utACK 9a84200

Tree-SHA512: 21d9e65f3c280a2853a9cf60d4e93e8d72caccea106206d1862c19535bde7ea6ada7f55e6ea19a1fc0f59dbe791ec6fc4084fdbe7fa6d6991fa89c62070db637
…ing hidden option)

5039c34 init: completely remove `-zapwallettxes` (remaining hidden option) (Sebastian Falbesoner)

Pull request description:

  The `-zapwallettxes` functionality has been removed in v0.21.0 (see commit 3340dba / PR bitcoin#19671), with the parameter being kept as hidden option, to inform users via an exit error that `abandontransaction` should be used instead.

  As any guides that still suggest to use `-zapwallettxes` would refer to a Bitcoin Core version that is EOL since many years (i.e. <= v0.20.x), it is highly unlikely that the error caused by the option is still relevant for any user, hence it seems fine to remove it now.

ACKs for top commit:
  achow101:
    ACK 5039c34
  BrandonOdiwuor:
    ACK 5039c34
  fanquake:
    ACK 5039c34

Tree-SHA512: e3ccc6918e0f8fa68dbd1a7ec4999cc2a44e28038711919fcddaf0727648c73a9ba0fb77674317147592a113fad20755d4e727f48176bc17b048fbdebad2d6c9
…helper

2c0c6f4 test: dedup file hashing using `sha256sum_file` helper (Sebastian Falbesoner)

Pull request description:

  Rather than doing the open/read/hash-steps manually in the affected functional tests, we can just use the `sha256sum_file` helper from the utils module instead.

  Note that for the tool_wallet.py test, the used hash is changed from sha1 to sha256, but as the only purpose is to detect file content changes, this doesn't matter. Also, the optimization using `memoryview` is overkill here, as the opened file has only a size of 24KiB and determining the hash via the helper doesn't take longer than a few hundred micro-seconds on my machine.

ACKs for top commit:
  kristapsk:
    ACK 2c0c6f4

Tree-SHA512: 64fe21650b56a50e9f1a95f6ef27d88d8bfbb621e5be456f327ef8dbb5596b529d03976c200f3fd68da48cc427de9f257b403f3228e38cf1df918006674fac68
… for tx inputs

5cf4427 test: refactor: deduplicate legacy ECDSA signing for tx inputs (Sebastian Falbesoner)

Pull request description:

  There are several instances in functional tests and the framework (MiniWallet, feature_block.py, p2p_segwit.py) where we create a legacy ECDSA signature for a certain transaction's input by doing the following steps:

  1. calculate the `LegacySignatureHash` with the desired sighash type
  2. create the actual digital signature by calling `ECKey.sign_ecdsa` on the signature message hash calculated above
  3. put the DER-encoded result as CScript data push into tx input's scriptSig

  Create a new helper `sign_input_legacy` which hides those details and takes only the necessary parameters (tx, input index, relevant scriptPubKey, private key, sighash type [SIGHASH_ALL by default]). For further convenience, the signature is prepended to already existing data-pushes in scriptSig, in order to avoid rehashing the transaction after calling the new signing function.

ACKs for top commit:
  dimitaracev:
    ACK `5cf4427`
  achow101:
    ACK 5cf4427
  pinheadmz:
    ACK 5cf4427

Tree-SHA512: 8f0e4fb2c3e0f84fac5dbc4dda87973276242b0f628034272a7f3e45434c1e17dd1b26a37edfb302dcaf380dbfe98b0417391ace5e0ac9720155d8fba702031e
@vijaydasmp
Copy link
Author

Hello @knst @PastaPastaPasta , requesting review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants