Skip to content

backport: bitcoin#30355, bitcoin#30697, bitcoin#28979, bitcoin#29586 - #8173

Open
DCG-Claude wants to merge 4 commits into
dashpay:developfrom
thepastaclaw:backport-0.28-b021-src-wallet
Open

DCG-Claude wants to merge 4 commits into
dashpay:developfrom
thepastaclaw:backport-0.28-b021-src-wallet

Conversation

@DCG-Claude

@DCG-Claude DCG-Claude commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Backports 4 Bitcoin Core v0.28 pull request(s) to Dash.

What was done?

How Has This Been Tested?

Breaking Changes

None beyond the upstream changes themselves.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@DCG-Claude

DCG-Claude commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Maintainer controls

Tick a box; backportsys acts within a few minutes, then clears it. For other requests, leave a review comment.

  • 🔒 Hands off — stop every automated update to this branch
  • 🔄 Rebase onto current develop
  • ❌ Close — abandon this batch and release its items

Hands off persists after its box clears: no automated branch updates until operator release (not tracker Release hold). Close abandons the batch and releases its items.

Review confidence

🟢 4/5 overall (3 at 5/5, 1 at 4/5).

How sure the system is that each commit is exactly right, so how much review it needs: 5 clean or plainly correct, a glance · 4 small adaptations, check the noted spots · 3 real judgment calls, review them · 2 substantial or risky, review in full · 1 not checked, or the system doubts it. The independent reviewer gives the score; a failed check or an open decision below caps it. Below 5 the cause of concern says why. The adapting lane's explanations are in the PR description and each commit body.

Upstream Confidence Cause of concern Where it differs from upstream
bitcoin#28979 🟢 4/5 The ancestor-aware fee subtraction in sendall is left out because Dash has no calculateCombinedBumpFee. That is right only as long as Dash keeps declining bitcoin#26152 (MiniMiner). If it ever takes that PR, this hunk and its test will be owed. Check: src/wallet/rpc/spend.cpp: confirm Dash still intends to skip bitcoin#26152, so that effective_value correctly stays total_input_value - fee_from_size same lines as upstream, placement adapted for Dash in src/wallet/rpc/spend.cpp; skips upstream hunks as not needed in Dash: src/wallet/rpc/spend.cpp, test/functional/wallet_sendall.py
bitcoin#30355 🟢 5/5 none identical to upstream
bitcoin#30697 🟢 5/5 none identical to upstream
bitcoin#29586 🟢 5/5 none docs/tests/build differ in test/functional/wallet_migration.py; upstream's change to src/wallet/wallet.cpp is not in that file; see the declared adaptation

Needs maintainer input

Nothing. Reviewing means checking the differences listed above.

Fork gate: thepastaclaw#142 at d58c507 (CI pending).

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The chain interface now supports callback-based settings updates, overwrite, and deletion. Wallet setting additions and removals use the callback API, and a test covers concurrent changes. Functional tests cover sendall spending unconfirmed funds. The default-wallet migration test checks its backup file and path. SQLite statement traces use the WALLETDB trace logger.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WalletSettingCaller
  participant Chain
  participant ChainImpl
  participant SettingsFile
  WalletSettingCaller->>Chain: updateRwSetting with callback
  Chain->>ChainImpl: invoke update callback
  ChainImpl->>ChainImpl: mutate setting under lock
  ChainImpl->>SettingsFile: write unless action is SKIP_WRITE
Loading
Merge Risk: Low · up to d58c5

Removing an unrecorded wallet can leave a null entry in the wallet settings, which a later write may persist and which could break wallet loading at startup. The PR author says the fix is a separate upstream follow-up. The rest of the change is low risk, so the PR is mergeable if that follow-up is tracked. A milestone also needs to be set.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title lists four upstream Bitcoin PR numbers (#30355, #30697, #28979, #29586) that match the four backports in the changeset. It names the backport action and the source references, but it does no…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is on-topic. It lists four Bitcoin Core v0.28 backports to Dash (#28979, #30355, #30697, #29586). It names the files touched by the changeset, including src/wallet/rpc/spend.cpp, test/…
Full details: Title check

Explanation

The title lists four upstream Bitcoin PR numbers (#30355, #30697, #28979, #29586) that match the four backports in the changeset. It names the backport action and the source references, but it does not name the main change. It is a list of references, not a summary of the change, so it is only partially related to the changeset. It is not vague or unrelated, so it does not fail.

Full details: Description check

Explanation

The description is on-topic. It lists four Bitcoin Core v0.28 backports to Dash (#28979, #30355, #30697, #29586). It names the files touched by the changeset, including src/wallet/rpc/spend.cpp, test/functional/wallet_migration.py, and the sendall tests. It also gives the Dash adaptations and the test results. The changeset matches these claims, so the description relates directly to the changes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e8e85a0f-445c-4b60-9955-581b43005c7d
Commits

Reviewing files that changed from the base of the PR and between 04949e4 and d58c507.

Files selected for processing: 1

  • src/wallet/wallet.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@thepastaclaw

thepastaclaw commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because the new head is waiting for the 30-minute push debounce.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit d58c507. Normal review starts when eligible; priority review starts as soon as a slot is available.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

The atomic wallet-settings backport introduces a real null-entry bug: removing a wallet that is absent from the startup list inserts a null wallet setting, which can later be persisted and then consumed as a wallet name during startup. The ancestor-aware sendall implementation and test omissions are explicitly documented adaptations for the unavailable MiniMiner dependency and are not actionable findings. CI shows no completed code-check failures; remaining build checks are pending, and the milestone failure is a policy check unrelated to the code.

🔴 1 blocking

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: backport-reviewer); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The backport includes wallet sendall coin-selection behavior, wallet migration backup handling, and wallet settings atomicity changes, but the diff is a set of scoped upstream changes rather than a large or intricate new change meeting the critical-surface bar.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — backport-reviewer (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — dash-core-commit-history (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `src/node/interfaces.cpp`:
- [BLOCKING] src/node/interfaces.cpp:1734-1737: Do not insert a null setting for no-op updates
  When `name` is absent, `settings.rw_settings[name]` creates a null `SettingsValue` before the callback runs. `RemoveWalletSetting` receives that null value, returns `SKIP_WRITE` because it is not an array, and leaves the null entry in the in-memory settings map. Although that call does not immediately write the file, any later settings write serializes the entry as `"wallet": null`; on the next startup, `getSettingsList("wallet")` returns the null value and `VerifyWallets` calls `get_str()` on it. The update path must operate on a temporary value for absent keys and erase an existing value if the callback leaves it null, inserting a new key only when the callback produces a non-null value.

Comment thread src/node/interfaces.cpp
Comment on lines +1734 to +1737
auto* ptr_value = common::FindKey(settings.rw_settings, name);
// Create value if it doesn't exist
auto& value = ptr_value ? *ptr_value : settings.rw_settings[name];
action = update_settings_func(value);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Blocking: Do not insert a null setting for no-op updates

When name is absent, settings.rw_settings[name] creates a null SettingsValue before the callback runs. RemoveWalletSetting receives that null value, returns SKIP_WRITE because it is not an array, and leaves the null entry in the in-memory settings map. Although that call does not immediately write the file, any later settings write serializes the entry as "wallet": null; on the next startup, getSettingsList("wallet") returns the null value and VerifyWallets calls get_str() on it. The update path must operate on a temporary value for absent keys and erase an existing value if the callback leaves it null, inserting a new key only when the callback produces a non-null value.

Suggested change
auto* ptr_value = common::FindKey(settings.rw_settings, name);
// Create value if it doesn't exist
auto& value = ptr_value ? *ptr_value : settings.rw_settings[name];
action = update_settings_func(value);
if (auto* value = common::FindKey(settings.rw_settings, name)) {
action = update_settings_func(*value);
if (value->isNull()) settings.rw_settings.erase(name);
} else {
common::SettingsValue new_value;
action = update_settings_func(new_value);
if (!new_value.isNull()) settings.rw_settings[name] = std::move(new_value);
}

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This hunk matches upstream bitcoin#30697 exactly. The suggested change is upstream commit df60199 from bitcoin#30828, which also changes src/interfaces/chain.h, so it belongs in a backport of bitcoin#30828 and not in this commit.


🤖 backportsys, on behalf of the Dash backport pipeline.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Matching upstream bitcoin#30697 does not make this implementation safe; the regression is introduced by this backport's new absent-key handling. In the existing RemoveWalletSetting caller, an absent wallet setting remains a null map entry because the callback returns SKIP_WRITE, and a later unrelated settings write persists that null value. The mention of bitcoin#30828 confirms this was fixed upstream later, but it does not resolve the defect in this commit.

@thepastaclaw thepastaclaw added the pastaclaw:changes-requested thepastaclaw's latest review requested changes label Nov 16, 2026
@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

The updateRwSetting code in this commit is identical to upstream bitcoin#30697, so the backport matches upstream. Upstream fixed the null-entry issue later in df60199, part of the follow-up bitcoin#30828 ('interfaces: bitcoin#30697 follow ups'). That fix should be backported as bitcoin#30828 rather than patched into this commit.


🤖 backportsys, on behalf of the Dash backport pipeline.

@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

CI failed at 04949e4 on dashpay/dash: PastaClaw review

This external status context came with no log and names no file, test or diff hunk, so there is nothing on this branch to fix; a rerun or the bot's own output is needed if it points at something concrete.


🤖 backportsys, on behalf of the Dash backport pipeline.

@DCG-Claude

Copy link
Copy Markdown
Collaborator Author

CI failed at 04949e4 on dashpay/dash: linux64_tsan-build / Build source

The only failure is a ThreadSanitizer data race in dashbls/runtest, inside the vendored mimalloc allocator (mi_tld_free vs _mi_meta_free), with no wallet frames; this branch touches nothing under src/dashbls. Develop commit 84f36b2 ('test: suppress TSan races reported inside mimalloc') adds the race:dashbls/depends/mimalloc/ suppression for exactly this stack, and the branch base b46c5d1 predates it, so rebasing onto develop fixes it. This branch is based on b46c5d1c73, older than develop (5bce2e7fe2); it is being rebased onto develop and this is looked at again there.


🤖 backportsys, on behalf of the Dash backport pipeline.

…t trace level

46819f5 wallet: use LogTrace for walletdb log messages at trace level (Anthony Towns)

Pull request description:

  Wallet sqlite logging is enabled by `-debug=walletdb -loglevel=walletdb:trace` however the actual log messages are sent at `BCLog::Level::Info`. Switch to the trace level to make this consistent. This adds `[walletdb:trace]` to the log output, eg:

  ```
  [httpworker.3] [wallet/sqlite.cpp:55] [TraceSqlCallback] [/tmp/bitcoin_func_test_4fsnatpg/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

  becomes

  ```
  [httpworker.0] [wallet/sqlite.cpp:55] [TraceSqlCallback] [walletdb:trace] [/tmp/bitcoin_func_test_9lcwth4z/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

ACKs for top commit:
  maflcko:
    ACK 46819f5
  ryanofsky:
    Code review ACK 46819f5. Nice catch!
  furszy:
    ACK 46819f5
  luke-jr:
    utACK 46819f5

Tree-SHA512: 6fc1bc63c2ee686d4ca8f4f558f06c0cd9e7813b5fce1588351f55ef8bedfc23c97ea443e54a6a447008fa79ea022b6d631cb010929932f1db23fa8e255e6482
…tes from Chain Interface

1b41d45 wallet: bugfix: ensure atomicity in settings updates (ismaelsadeeq)

Pull request description:

  This PR fixes bitcoin#30620.

  As outlined in the issue, creating two wallets with `load_on_startup=true` simultaneously results in only one wallet being added to the startup file.

  The current issue arises because the wallet settings update process involves:
  1. Obtaining the settings value while acquiring the settings lock.
  2. Modifying the settings value.
  3. Overwriting the settings value while acquiring the settings lock again.

  This sequence is not thread-safe. Different threads could modify the same base value simultaneously, overwriting data from other workers without realizing it.

  The PR attempts to  fix this by modifying the chain interface's `updateRwSetting` method to accept a function that will be called with the settings reference. This function will either update or delete the setting and return an enum indicating whether the settings need to be overwritten in this or not.

  Additionally, this PR introduces two new methods to the chain interface:
  - `overwriteRwSetting`: This method replaces the setting with a new value.
  Used in `VerifyWallets`
  - `deleteRwSettings`: This method completely erases a specified setting.
  This method is currently used only in `overwriteRwSetting`.

  These changes ensure that updates are race-free across all clients.

ACKs for top commit:
  achow101:
    ACK 1b41d45
  furszy:
    self-code-ACK bitcoin@1b41d45

Tree-SHA512: 50cda612b782aeb5e03e2cf63cc44779a013de1c535b883b57af4de22f24b0de80b4edecbcda235413baec0a12bdf0e5750fb6731c9e67d32e742d8c63f08c13
…ior around unconfirmed inputs

71aae72 test: test sendall does ancestor aware funding (ishaanam)
3675794 wallet, rpc: implement ancestor aware funding for sendall (ishaanam)
544131f rpc, test: test sendall spends unconfirmed change and unconfirmed inputs when specified (ishaanam)

Pull request description:

  This PR:
  - Adds a functional test that `sendall` spends unconfirmed change
  - Adds a functional test that `sendall` spends regular unconfirmed inputs when specified by user
  - Adds ancestor aware funding to `sendall` by using `calculateCombinedBumpFee` and adjusting the effective value accordingly
  - Adds a functional test for ancestor aware funding in `sendall`

ACKs for top commit:
  S3RK:
    ACK 71aae72
  achow101:
    ACK 71aae72
  furszy:
    ACK 71aae72

Tree-SHA512: acaeb7c65166ce53123a1d6cb5012197202246acc02ef9f37a28154cc93afdbd77c25e840ab79bdc7e0b88904014a43ab1ddea79d5337dc310ea210634ab61f0

Dash adaptations:
- src/wallet/rpc/spend.cpp: takes only the sendall help-text update; the bump-fee change to effective_value is left out because Dash declined bitcoin#26152
- test/functional/wallet_sendall.py: leaves out sendall_does_ancestor_aware_funding and its call in run_test, since it only tests the omitted bump-fee change

Not applicable to Dash (intentionally omitted):
- src/wallet/rpc/spend.cpp: Builds outpoints_spent and subtracts chain().calculateCombinedBumpFee(), a MiniMiner interface from bitcoin#26152, which Dash declined
- test/functional/wallet_sendall.py: sendall_does_ancestor_aware_funding checks ancestor bump fees, which Dash does not have without bitcoin#26152
…nient backup filename

a951dba wallet: default wallet migration, modify inconvenient backup filename (furszy)

Pull request description:

  Fixes bitcoin#29584

  On default legacy wallets, the backup filename starts with an "-" due to the wallet name being empty. This is inconvenient for systems who treat what follows the initial "-" character as flags.

  Note:
  As the user can freely set the wallet name to anything, we could also guard the backup filename against other inconvenient characters in the future (we need to be careful here, because the wallet name could also be a path).

ACKs for top commit:
  achow101:
    ACK a951dba
  brunoerg:
    utACK a951dba
  vasild:
    ACK  a951dba

Tree-SHA512: 6347bb12cfb50526a4baad96e4f1df9d82b493f79f0a0f7e0a1c8335a86a1e8e147c7b7f95cec6ede6f4507506a7eaf7972bd35131a2d5ed4cbbf38d94f0a9ca

Dash adaptations:
- src/wallet/wallet.cpp: no change; Dash already names the unnamed wallet's backup default_wallet_<time>.legacy.bak (MigrationPrefixName + basename reduction from its bitcoin#34156 backport)
- test/functional/wallet_migration.py: takes the backup timestamp from the framework's self.mocktime instead of int(time.time()); the file doesn't import time and nearby tests use mocktime
@DCG-Claude
DCG-Claude force-pushed the backport-0.28-b021-src-wallet branch from 04949e4 to d58c507 Compare November 16, 2026 15:31
@thepastaclaw thepastaclaw removed the pastaclaw:changes-requested thepastaclaw's latest review requested changes label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants