Skip to content

feat(key-wallet)!: only final coins fund a build - #1199

Open
ZocoLini wants to merge 6 commits into
devfrom
feat/resolve-uncertain-broadcasts
Open

ZocoLini wants to merge 6 commits into
devfrom
feat/resolve-uncertain-broadcasts

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #1185.

A coin the network has not settled, in a block or with an InstantSend lock, may never exist, and neither would a transaction built on it. Every build now spends only final coins. When the waiting coins would fund it, it fails with BuilderError::FundsAwaitingFinality, added in #1192.

The trusted self-send rule is removed with it. The change of our own mempool transaction stays in the unconfirmed bucket like any other mempool output.

Breaking changes

  • TransactionBuilder::require_final_inputs removed: final inputs are always required.
  • Utxo::is_trusted removed. A Utxo, or an account holding one, encoded with bincode through serde by an earlier version no longer decodes.
  • WalletCoreBalance::spendable() returns only the confirmed balance.

Not covered yet (from #1185)

  • available/required and selected outpoints in the error.
  • Caller-supplied outpoint exclusions.
  • Minimum drain value for asset locks.
  • Checked fee arithmetic.

PR Hygiene · 0ea0afe

  • Bots — coderabbitai skipped after its own rate limit
  • Self-review — post /self-reviewed
  • Build green
  • Approvals
    • dash-spv (dash-spv/tests/dashd_sync/tests_transaction.rs) — QuantumExplorer or xdustinface
    • key-wallet-manager (key-wallet-manager/src/lib.rs, key-wallet-manager/tests/out_of_order_spend_repro_test.rs) — QuantumExplorer or xdustinface
    • key-wallet (key-wallet/src/managed_account/managed_account_collection.rs, key-wallet/src/managed_account/managed_account_ref.rs, key-wallet/src/managed_account/managed_core_funds_account.rs and 10 more) — QuantumExplorer or xdustinface

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7ca9dac2-e84e-4fc3-b442-3c8db763e37b
Commits

Reviewing files that changed from the base of the PR and between 9329b3e and 0ea0afe.

Files selected for processing: 16

  • dash-spv/tests/dashd_sync/tests_transaction.rs
  • key-wallet-manager/src/lib.rs
  • key-wallet-manager/tests/out_of_order_spend_repro_test.rs
  • key-wallet/src/managed_account/managed_account_collection.rs
  • key-wallet/src/managed_account/managed_account_ref.rs
  • key-wallet/src/managed_account/managed_core_funds_account.rs
  • key-wallet/src/tests/locked_outpoints_tests.rs
  • key-wallet/src/tests/restore_utxos_tests.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
  • key-wallet/src/utxo.rs
  • key-wallet/src/wallet/balance.rs
  • key-wallet/src/wallet/managed_wallet_info/asset_lock_builder.rs
  • key-wallet/src/wallet/managed_wallet_info/helpers.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_building.rs
  • key-wallet/src/wallet/managed_wallet_info/wallet_info_interface.rs
  • 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

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (9329b3e) to head (0ea0afe).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1199      +/-   ##
==========================================
- Coverage   88.16%   88.13%   -0.04%     
==========================================
  Files         270      270              
  Lines       72623    72420     -203     
==========================================
- Hits        64031    63829     -202     
+ Misses       8592     8591       -1     
Flag Coverage Δ
core 83.79% <100.00%> (-0.07%) ⬇️
rpc 83.79% <100.00%> (-0.07%) ⬇️
spv 95.45% <ø> (ø)
wallet 83.79% <100.00%> (-0.07%) ⬇️
Files with missing lines Coverage Δ
key-wallet-manager/src/lib.rs 73.27% <ø> (ø)
.../src/managed_account/managed_account_collection.rs 73.97% <ø> (-0.25%) ⬇️
...-wallet/src/managed_account/managed_account_ref.rs 66.51% <ø> (-0.44%) ⬇️
.../src/managed_account/managed_core_funds_account.rs 93.33% <100.00%> (-0.29%) ⬇️
...-wallet/src/transaction_checking/wallet_checker.rs 98.84% <100.00%> (-0.05%) ⬇️
key-wallet/src/utxo.rs 96.10% <ø> (-0.05%) ⬇️
key-wallet/src/wallet/balance.rs 100.00% <100.00%> (ø)
...c/wallet/managed_wallet_info/asset_lock_builder.rs 94.12% <100.00%> (-0.03%) ⬇️
...y-wallet/src/wallet/managed_wallet_info/helpers.rs 73.74% <ø> (ø)
.../wallet/managed_wallet_info/transaction_builder.rs 94.36% <100.00%> (-0.02%) ⬇️
... and 2 more

... and 4 files with indirect coverage changes

@github-actions

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Oct 21, 2026
@ZocoLini
ZocoLini force-pushed the feat/resolve-uncertain-broadcasts branch from 75a01e6 to 95bca69 Compare November 16, 2026 13:35
@github-actions github-actions Bot added merge-conflict The PR conflicts with the target branch. and removed merge-conflict The PR conflicts with the target branch. labels Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@ZocoLini
ZocoLini force-pushed the feat/resolve-uncertain-broadcasts branch from 95bca69 to 82938e6 Compare November 26, 2026 18:47
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Nov 26, 2026
@manki-review

manki-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

This pull request is a draft, so Manki does not review it automatically. Marking it ready for review starts automatic reviews. Until then, someone with write access to this repository can tick a box below: Review this draft reviews the current commit once, Deeper review does so with more effort, and Review every push reviews it now and again after each push.

A coin the network has not settled, in a block or with an InstantSend lock,
may never exist, and neither would anything built on it. Every build now
spends only final coins, and when the waiting ones would fund it, it fails
with `BuilderError::FundsAwaitingFinality`. `require_final_inputs` is gone.

The trusted self-send rule is removed with it: the change of our own mempool
transaction waits in the unconfirmed bucket like any other mempool output, and
`WalletCoreBalance::spendable` is the confirmed balance only.

BREAKING CHANGE: `TransactionBuilder::require_final_inputs` and
`Utxo::is_trusted` are removed, builds no longer spend unconfirmed coins, and
`spendable()` excludes unconfirmed funds.

Part of #1185
@ZocoLini
ZocoLini force-pushed the feat/resolve-uncertain-broadcasts branch from 82938e6 to 0fd4770 Compare November 26, 2026 19:08
@ZocoLini
ZocoLini marked this pull request as ready for review December 3, 2026 00:17
@manki-review

manki-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

✅ Review complete in 11m 6s

Planner (8s)
    refactor · 555 lines · 2 agents
    judge effort: high

Review (security · full): 24 findings
    ✅ Claude Opus 5.5 · high: 5 findings (2m 17s)
    ✅ GPT 6.2 Sol · high: 13 findings (3m 46s)
    ✅ Comparisons, related checks, claim checks and fix checks: 19 of 19 done, 6 findings (2m 0s)
    ✅ Second reads: 1 of 1 done (1m 14s)

Judge (4m 53s)
    graded 24 findings: 10 kept · 7 dropped · 7 merged
    dropped, as the finders filed them: 4 blockers · 2 warnings · 1 suggestion
    refuter: 2 checked · 2 unsettled
    origin checks: 3 checked
    sweeps: 1 of 1 done (9s)

Posted: 5 findings
    1 blocker · 4 suggestions
    not posted: 3 over the review.notes limit · 1 no realistic trigger
    not finished checking: 1 possible problem

Review metadata

Config:

  • Models: reviewer=claude-opus-5-5, judge=claude-opus-5-5
  • Triage: trivial=false, subtle=true, paired=true (planner, security-sensitive paths)
  • Team: Claude Opus 5.5 · high, GPT 6.2 Sol · high
  • Memory: enabled (central)

Account limits:

  • Claude subscription: weekly 73% (resets 2026-12-04 01:00 UTC)
  • ChatGPT subscription: weekly 1% (resets 2026-12-09 07:04 UTC)

Judge decisions:

  • Kept: "Removing Utxo::is_trusted makes account data stored with bincode fail to load" (blocker): "blocker. Utxo derives serde with no custom codec (key-wallet/src/utxo.rs:17), and the diff drops the field after is_locked (utxo.rs:39). ManagedCoreFundsAccount serializes utxos: BTreeMap<OutPoint, Utxo> (managed_core_funds_account.rs:61), and the crate round-trips accounts through bincode::serde (wallet_checker.rs:4402-4403). Bincode is positional, so the old 9-field bytes are read against an 8-field struct. The extra bool becomes the start of the next map entry or field, and decoding fails or yields wrong coins. key-wallet/AGENTS.md requires that a change to a serialized type keep existing data decodable. The PR declares the API removal of is_trusted but adds no decoding path for stored bytes.
    Refutation unsettled: The diff does remove is_trusted from the serde-derived Utxo. But in this repository the only bincode-serde round-trips of an account are in test modules. The platform consumer stores UTXOs as SQLite columns and rebuilds them with is_trusted: false, so it never decodes a stored bincode Utxo. dash-evo-tool does not use is_trusted at all. The crate's own docs already say consumers that save snapshots with bincode-serde need a versioned migration whenever a field changes. Finally, the deco... Rule checked: A serde-derived struct encoded with bincode-serde, which is not self-describing, is read field by field in order, so bytes written with an extra trailing field no longer match the struct.
    Pair refutation unsettled: The PR removes the trailing Serde field from Utxo, and funds accounts serialize UTXOs inside a map. The cited bincode test only reloads bytes written by the same version; it does not establish what the new decoder returns for a persisted account containing the old field. Rule checked: Removing a field from a positional encoding can make a decoder read the removed field's bytes as part of the next value."
  • Kept: "spendable() now counts only final coins, but is_spendable, spendable_utxos and get_spendable_utxos still count mempool coins" (suggestion): "note. The PR rewrites the is_spendable doc (utxo.rs:79-80) to say that a builder additionally requires final UTXOs, so keeping is_spendable maturity- and lock-only is a documented choice. Two meanings of "spendable" now coexist. That invites misuse, so it is worth asking whether a finality-aware predicate should back spendable_utxos and get_spendable_utxos. The dash-evo-tool fee estimate this affects is a consumer behaviour change covered by the declared breaking change to spendable() and final-only builds."
  • Not listed, over the review.notes limit: "A drain (SelectionStrategy::All) now leaves mempool coins behind without any error" (suggestion): "note. The filter at transaction_builder.rs:570-571 now applies to SelectionStrategy::All too. A drain over final coins succeeds and leaves waiting coins in the account. That matches the PR's stated rule that only final coins fund a build, so it is an intended choice. The All doc at coin_selection.rs:113 still says it selects every spendable UTXO to empty an account, and is_spendable still counts mempool coins, so the doc misleads. It is worth asking whether a drain with waiting coins should report them."
  • Dropped: "Platform and dash-evo-tool stop compiling: they call require_final_inputs and read or construct Utxo::is_trusted" (ignore): "ignore. The PR declares the break: its title carries !, and its Breaking changes section lists the removal of TransactionBuilder::require_final_inputs and Utxo::is_trusted. The consumer call sites cited are the migration that declaration announces."
  • Not listed, over the review.notes limit: "with_waiting_coins copies the whole builder on every build, including builds that succeed" (suggestion): "note. Line 466 now clones the inputs, outputs, payload and funding sets on every build, and uses the copy only on a funding error. For wallet-sized input sets the cost is negligible, so this is a structure improvement."
  • Dropped: "A stale seeded UTXO can bypass the wallet's finality check" (ignore): "ignore. add_inputs (transaction_builder.rs:251) takes caller-supplied Utxo values with their flags as given, and the PR does not change it or fund_from. A caller that passes a copy marked confirmed controls that flag. The finality filter judging the candidate it was handed is the existing contract of seeded inputs, not something this PR introduces."
  • Kept: "The finality trial skips failures that a different input selection could resolve" (suggestion): "warning. The PR makes the trial apply to every build (lines 466 and 482), but line 474 retries only InsufficientFunds, CoinSelection and TooManyInputs. Line 496 returns TransactionTooLarge (line 628) and NoChangeAddress (line 748) directly. A build whose final coins fail that way, while a selection including waiting coins would succeed, reports the wrong cause. Funded builds normally set a change address, and the input cap is checked before the size cap, so the trigger is narrow."
  • Not listed, it names no trigger that happens in realistic use: "The finality error can hide a payload error that waiting will not fix" (warning): "warning. The trial sets payload_finalizer: None (line 535), and the finalizer runs only after a successful assemble_unsigned (lines 830-835 and 886-889). A build whose finalizer would reject the result is told to wait, then fails differently once the coins settle. That needs a caller-supplied finalizer that fails on a build short of final funds, which normal use does not produce, so no realistic trigger is named."
  • Dropped: "Optimal consolidation can spend billions of iterations on a small candidate pool" (ignore): "ignore. coin_selection.rs is not changed by this PR, and nothing in the diff changes how the consolidation search runs."
  • Dropped: "Unchecked amount totals can panic or wrap during a public build" (ignore): "ignore. The sums at transaction_builder.rs:563-565, 637 and 843, and those in coin_selection.rs, are unchanged lines. The PR neither adds nor exposes them."
  • Dropped: "A caller-supplied coinbase height can overflow the maturity check" (ignore): "ignore. is_mature at utxo.rs:91 is unchanged, and the PR does not alter its callers' inputs."
  • Not listed, over the review.notes limit: "The locked-coin test passes without running the finality trial" (suggestion): "note. The assertion at locked_outpoints_tests.rs:905 accepts any CoinSelection error. A trial that never runs also yields that error, so the test does not show that the waiting-coins trial skips locked coins. A companion build that first gets FundsAwaitingFinality would close that gap."
  • Dropped: "The restore and confirmation tests bypass the public wallet setup" (ignore): "ignore. The direct utxos.insert setup in restore_utxos_tests.rs and the record removal in wallet_checker.rs predate this PR. The diff only deletes is_trusted lines from them and adds no hand-built state, so the PR does not break the rule."
  • Not finished: "A loaded wallet may retain its legacy confirmed balance until the next refresh" (warning): "warning. spendable() now returns the cached confirmed bucket (balance.rs:54), and an old snapshot's bucket may include trusted mempool change. Builds read per-UTXO flags, so only the reported balance is off, and only until the next update_balance. Whether a load path refreshes the cache first is outside the code shown.
    Refutation unsettled: The base update_balance put trusted mempool change into the cached confirmed bucket, and serde restores that cache as is. But nothing in this repo deserializes a ManagedWalletInfo snapshot, and the one consumer load path read (platform rehydrate) calls update_balance before use. So no path is shown where a stale cache reaches callers, and the error would only last until the next refresh. Rule checked: A serde-derived struct restores a cached field exactly as stored; a cached total computed under old bucketing rules stays wrong until code recomputes it.
  • Premise "No load path of ManagedWalletInfo calls update_balance before balance() or spendable() is returned to callers" unsettled. The consumer load path read here, platform's SQLite rehydrate, calls wallet_info.update_balance() after restoring UTXOs, so the totals are recomputed on load. In this repo, insert_wallet stores the info without refreshing it but deserializes nothing, and import_wallet_from_bytes builds fresh info with from_wallet.
  • Premise "This trigger happens in realistic use: when a wallet saved with mempool self-send change is loaded after upgrading and its balance is read before the next transaction or block" unsettled. Old snapshots could hold trusted change in confirmed, because base update_balance counted is_trusted there. But no caller is shown that loads a serde snapshot of ManagedWalletInfo and reads balance() before any refresh, and the consumer load path read here recomputes it.
    Pair refutation unsettled: The old balance calculation counted trusted mempool change as confirmed, and direct deserialization can expose the saved balance without recalculating it. The SQLite restore path recalculates before returning, and the direct-deserialization test does not establish that a populated legacy wallet is loaded and read before a refresh. Rule checked: Loading a serialized cache does not recompute it when the rules for classifying its contents change.
  • Premise "No load path of ManagedWalletInfo calls update_balance before balance() or spendable() is returned to callers" unsettled. Platform's persisted-state loader calls update_balance on ManagedWalletInfo before returning successfully.
  • Premise "This trigger happens in realistic use: when a wallet saved with mempool self-send change is loaded after upgrading and its balance is read before the next transaction or block" unsettled. The old calculation could put mempool change in the saved confirmed bucket, but the direct round-trip test uses an account-less wallet and does not show a populated legacy snapshot being loaded and read before refresh."
  • Kept: "Change from our own mempool transaction no longer counts as spendable, unlike Dash Core's CachedTxIsTrusted" (suggestion): "note. The divergence from CachedTxIsTrusted is deliberate. The PR description removes the trusted self-send rule, the renamed test test_self_send_change_in_mempool_stays_unconfirmed asserts it, and the update_balance doc states it. A sentence on why an SPV wallet differs from Core would help readers."
  • Dropped: "Abandoning a transaction drops the coins it spent from the balance, while Dash Core makes them spendable again at once" (ignore): "ignore. apply_abandon and its unsettled_spends.remove at managed_core_funds_account.rs:556 are not in this diff. The PR changes only an unrelated doc sentence near the abandon code and does not change how abandoned spends are handled."
  • Kept: "Comment says an InstantSend lock is permanent, but a ChainLock on a conflicting block removes it" (suggestion): "note. The PR rewrites the comment at managed_core_funds_account.rs:342 and keeps the claim that a lock is permanent for a txid. Dash Core removes a lock when a ChainLocked conflicting spend wins (dashpay/dash:src/validation.cpp:2958-2960). The latch still holds because that transaction is never reprocessed, so only the stated reason is wrong."

Timing:

  • Parse: 8.3s
  • Review agents: 364.7s
  • Judge: 292.9s
  • Total: 665.9s

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Dec 3, 2026
manki-review[bot]
manki-review Bot previously requested changes Dec 3, 2026

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Changes requested: 1 blocker, plus 3 suggestions in threads.

What blocks: Account and wallet data saved with bincode before this change no longer decodes. Utxo loses its is_trusted byte, so every UTXO after the first is read from shifted bytes, and an application that stores wallets this way gets a load error or corrupted coins after upgrading.


1 suggestion · not blocking
✨ The finality trial skips failures that a different input selection could resolve
Suggestion, not blocking · Correctness · Moderate · key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs:496

Why: A payment with no change address returns NoChangeAddress when the final coins require change, even when a waiting coin would fund an exact match. The same early return hides waiting funds when they would reduce an asset lock below the size cap or change which input supplies a valid change address.

return Err(e);
}
Err(e) => return Err(e),
};

How to fix it
Separate configuration errors from failures that depend on the selected inputs. Retry the latter with waiting candidates and return FundsAwaitingFinality only when that selection produces a valid transaction.

Checked in the code
Retries only InsufficientFunds, CoinSelection and TooManyInputs

Err(
e @ (BuilderError::InsufficientFunds {
..
}
| BuilderError::CoinSelection(_)

Returns TransactionTooLarge using the selected input count

if size > MAX_STANDARD_ASSET_LOCK_SIZE {
return Err(BuilderError::TransactionTooLarge {
size,
max: MAX_STANDARD_ASSET_LOCK_SIZE,
});

Checks the network of the first selected input when routing change

};
if self.change_addr.as_ref().is_some_and(|change_addr| {
!addresses_share_network(&first_input.address, change_addr)
}) {
return Err(BuilderError::InvalidData(

  • Create an issue for this

3 more suggestions are not listed.


Checked and left out: 1 finding

Not finished checking · 1 possible problem

  • A loaded wallet may retain its legacy confirmed balance until the next refresh · key-wallet/src/wallet/balance.rs:54
    The base update_balance put trusted mempool change into the cached confirmed bucket, and serde restores that cache as is. But nothing in this repo deserializes a ManagedWalletInfo snapshot, and the one consumer load path read (platform rehydrate) calls update_balance before use.

The progress comment has the full log under "Judge decisions", in its "Review metadata" fold.

About this review
  • Reviewed 689a563, round 1
  • 555 changed lines read in 11m 6s
  • Found by claude-opus-5-5 and gpt-6.2-sol, judged by claude-opus-5-5
  • Tokens: 9.1M in (7.8M from cache) · 117k out · about $9.06 at API prices
  • Runner: self-hosted · started after 11s · peak memory 4.2 GiB of 30.0 GiB
  • How Manki reviews

Comment thread key-wallet/src/utxo.rs Resolved
Comment thread key-wallet/src/utxo.rs Resolved
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Bots are done — your move: address manki-review[bot] requested changes, then post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. merge-conflict The PR conflicts with the target branch. and removed waiting-bots Waiting for the review bots to report on this head labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

…-broadcasts

# Conflicts:
#	key-wallet/src/tests/restore_utxos_tests.rs
#	key-wallet/src/transaction_checking/wallet_checker.rs
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@manki-review

manki-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Review superseded by the new commit 479c0bd. No verdict was posted for 97c2577.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@manki-review

manki-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Review superseded by the new commit 0ea0afe. No verdict was posted for 479c0bd.

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@manki-review

manki-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

✅ Review complete in 10m 9s

Planner (6s)
    fix · 566 lines · 2 agents
    judge effort: high

Review (security · full): 19 findings
    ✅ Claude Opus 5.5 · high: 4 findings (2m 0s)
    ✅ GPT 6.2 Sol · high: 11 findings (3m 33s)
    ✅ Comparisons, related checks, claim checks and fix checks: 19 of 19 done, 4 findings (1m 30s)

Judge (5m 39s)
    before the judge: 1 possible problem carried over from the last round, 3 dropped as repeats of earlier resolved findings
    graded 17 findings: 8 kept · 3 dropped · 6 merged
    dropped, as the finders filed them: 2 warnings · 1 suggestion
    refuter: 4 checked · 2 confirmed · 2 unsettled
    origin checks: 3 checked · 1 older than this PR
    verdict reader: read the diff (27s)

Posted: 4 findings
    2 warnings · 2 suggestions
    not posted: 3 older than this PR · 1 on code an earlier round reviewed

Review metadata

Config:

  • Models: reviewer=claude-opus-5-5, judge=claude-opus-5-5
  • Triage: trivial=false, subtle=true, paired=true (planner, security-sensitive paths)
  • Team: Claude Opus 5.5 · high, GPT 6.2 Sol · high
  • Memory: enabled (central)

Account limits:

  • Claude subscription: weekly 98% (resets 2026-12-04 01:00 UTC)
  • ChatGPT subscription: weekly 1% (resets 2026-12-10 07:41 UTC)

Judge decisions:

  • Dropped: "Removing require_final_inputs and Utxo::is_trusted breaks the build of dashpay/platform and dash-evo-tool" (ignore): "ignore. The PR declares this break. The title carries !, and the description's Breaking changes section names both TransactionBuilder::require_final_inputs removed and Utxo::is_trusted removed. The consumer call sites in wallet_drain.rs:138, payments.rs:361 and snapshot.rs:314, and the is_trusted reads and literals, fall within that declaration. computed_core_balance drops || utxo.is_trusted as part of the same field removal, so the break is no wider than declared."
  • Not listed, on code an earlier round reviewed: "Every build duplicates caller-sized data before checking limits" (suggestion): "note. assemble_unsigned now always calls with_waiting_coins at transaction_builder.rs:466, which clones inputs, outputs, special_payload and funding (lines 525-537), even when the build succeeds. The copy is linear in data the caller already holds in memory, so it at most doubles an allocation the caller made itself. It is no exhaustion the caller could not already cause, and no one would notice it for a wallet's candidate set. Building the trial only after a funding error would avoid it."
  • Kept: "A seeded copy can hide a funding account's current finality" (warning): "warning. fund_from skips the account's copy of any outpoint already seeded (transaction_builder.rs:206, 225), so the seeded copy's flags decide finality. Before this PR the finality filter ran only when require_final_inputs was set. It now runs on every build (line 570-571), so every build with a stale non-final seed loses a coin the account knows is final. The defect needs a caller that seeds stale copies alongside funding. The consumer call sites shown use either add_inputs or add_funding, not both, so that premise stays a doubt.
    Refutation confirmed: fund_from never offers the funding account's current copy of an outpoint that was already seeded (lines 206 and 225). prepare then drops any input whose own flags are not final (line 571) and never checks the account's copy. A seed cloned before the InstantSend lock arrived is therefore dropped, and assemble_unsigned reports FundsAwaitingFinality. The platform FFI clones account UTXOs into the builder in one call and funds from the same account in a later finalize call, so this can happen in nor... Rule checked: In fund_from, an outpoint the builder already holds is skipped, so a copy seeded through add_inputs keeps whatever is_confirmed/is_instantlocked flags it was cloned with. prepare now filters on those flags in every build, not only when require_final_inputs was set.
  • Premise "A caller in this repository or a consumer passes add_inputs a Utxo for an outpoint that a funding account added with add_funding also holds, with finality flags older than the account's copy" confirmed. The platform FFI seeds the builder through add_inputs with clones of the account's own Utxos, in a call separate from the finalize step that later adds the same account. The seeded flags are whatever they were at clone time, so they can be older than the account's copy.
  • Premise "With such a seeded copy, prepare drops the coin at transaction_builder.rs:571 and the build returns BuilderError::FundsAwaitingFinality although the funding account's copy is InstantSend-locked or confirmed" confirmed. fund_from skips the account's copy of any outpoint already present. prepare then filters on the seeded copy's flags only, and when funds fall short the waiting trial makes assemble_unsigned return FundsAwaitingFinality.
    Pair refutation unsettled: The builder keeps the pre-seeded copy and can misreport a final coin as awaiting finality. The tests combine seeding and funding for the same outpoint, but I did not find a caller or test that seeds an older finality snapshot before attaching an account that now holds the coin as final. Rule checked: An owned UTXO snapshot does not inherit later changes to the account's copy, so deduplicating by outpoint without refreshing the retained copy can leave stale finality flags.
  • Premise "A caller in this repository or a consumer passes add_inputs a Utxo for an outpoint that a funding account added with add_funding also holds, with finality flags older than the account's copy" unsettled. The overlap test seeds an identical copy, and the seed-first collateral test changes the collateral-lock flag rather than finality; neither establishes a caller passing an older finality snapshot.
  • Premise "With such a seeded copy, prepare drops the coin at transaction_builder.rs:571 and the build returns BuilderError::FundsAwaitingFinality although the funding account's copy is InstantSend-locked or confirmed" confirmed. Funding skips the account's final copy and the first pass drops the stale seed; if that unlocked, unreserved seed is what makes the retry fundable, the build returns FundsAwaitingFinality."
  • Dropped: "Conflict handling does not preserve InstantSend precedence across a reorg" (ignore): "ignore. Every line the failure rests on, truncate_above (managed_core_funds_account.rs:600, 605) and drop_conflicted_transactions (734, 771), is unchanged by this PR. The only change at the cited spot is the comment at line 341, which describes take_in_output latching the lock on reprocessing. The diff shows this PR neither causes nor exposes the precedence behaviour."
  • Not listed, on code this PR did not change: "A conflict sweep discards recoverable inputs the winner did not spend" (warning): "warning. In drop_conflicted_transactions the loser's saved coins in unsettled_spends are discarded at managed_core_funds_account.rs:797. Only the spent marks of the extra inputs are released (815-816), while truncate_above restores the same saved coins (609). So a loser that pooled several coins, replaced by a winner spending only some, leaves the extras out of the wallet until a rescan finds them. The test at wallet_checker.rs:2514 documents that a finalized funding transaction is never recovered. The code shown does not settle whether anything besides a rescan brings the coins back. This PR changes only a doc comment here, so the defect is pre-existing.
    Refutation unsettled: Recording the losing spend moves each spent coin from utxos into unsettled_spends[loser] (lines 467-473). On a final conflicting arrival, drop_conflicted_transactions throws that copy away at line 797. It then only clears the spent marks of the inputs the winner did not spend (815-816) and never re-inserts those coins. truncate_above, by contrast, puts the same saved coins back (609, 638). The balance is computed only from utxos (1239), so the extra coins drop out of it. Rule checked: Once a coin is removed from utxos when its spend is recorded, it can only come back from the copy saved in unsettled_spends (which truncate_above uses), from a re-delivered funding transaction, or from restore_utxos; dropping the saved copy leaves the balance without it.
  • Premise "After drop_conflicted_transactions frees an extra input of a loser, no code path other than a rescan re-inserts that coin into the account's utxos" unsettled. Inside key-wallet, only a re-delivered funding transaction puts the coin back, and that does not work once the funding transaction is finalized (869, 997). However, restore_utxos at mod.rs:534 re-inserts any coin a consumer's persisted store supplies. The sweep reports released_outpoints so such a mirror can mark them spendable, and I did not check whether the consumer's reload does this.
  • Premise "The freed extra input is missing from utxos and from the balance update_balance computes until a rescan re-delivers its funding transaction" confirmed. The coin left utxos when the loser was recorded (467), its saved copy is dropped (797), and nothing in the sweep re-inserts it (815-816 only release marks). update_balance sums only utxos (1239), so the coin is missing from the balance until it is delivered again.
    Pair refutation unsettled: Recording the loser saves its full input coins, but the conflict sweep discards them and only clears the spent mark for an input the winner did not use. Replaying a ChainLocked funding transaction does not restore an output its record already owned. Rule checked: Clearing an outpoint's spent mark does not reinsert its UTXO, and balance calculation counts only UTXOs that are present.
  • Premise "After drop_conflicted_transactions frees an extra input of a loser, no code path other than a rescan re-inserts that coin into the account's utxos" disproved. Although the sweep only clears the mark, a caller with a saved copy can use the public restore_utxos API to reinsert the freed coin directly, without replaying its funding transaction.
  • Premise "The freed extra input is missing from utxos and from the balance update_balance computes until a rescan re-delivers its funding transaction" disproved. The coin is missing immediately after the sweep, but direct restoration followed by a balance refresh counts it without a rescan; ordinary replay of already-owned ChainLocked funding does not restore it."
  • Not listed, on code this PR did not change: "Public wallet APIs overflow when summing coin or output values" (suggestion): "warning. The sums at transaction_builder.rs:563, 565 and 635 and coin_selection.rs:233 and 340 are unchecked, and line 637 adds total_output + selection.estimated_fee without a check. A caller of the public builder can pass values whose sum exceeds u64::MAX, which panics with overflow checks on or wraps otherwise. Real coins are bounded by the Dash supply, far below u64::MAX, so only crafted values reach it and the trigger is rare. The PR lists checked fee arithmetic as not covered yet. That deferral does not change the cell. These lines are unchanged by this PR.
    Refutation unsettled: The sums at transaction_builder.rs:563/565/635/637 are unchecked. But inputs and balances come from on-chain coins, which are capped at MAX_MONEY (2.1e15 duffs, about 8,800 times below u64::MAX). Output amounts come only from callers, and none in the repo passes a value anywhere near u64::MAX. So no observable failure in normal use is shown. Rule checked: In Rust, + on u64 and Iterator::sum panic on overflow when overflow checks are on (debug builds) and wrap when they are off (release default).
  • Premise "This trigger happens in realistic use: the sequence of events the description names" disproved. Overflow needs values summing past u64::MAX. Coin values come from the chain and are capped at MAX_MONEY (21M DASH = 2.1e15 duffs). The only output amounts that reach add_output are passed straight through from callers by funded_builder or are small test constants. No caller, stored data or input path in the repo supplies amounts near 1.8e19, so normal use does not produce the sequence.
    Pair refutation unsettled: The builder stores caller-supplied amounts unchanged and sums them before coin selection. The balance test supplies deliberately oversized values, but it does not show that a real build or wallet balance reaches the overflow. Rule checked: In Rust, unchecked u64 addition, including iterator sums, panics on overflow when overflow checks are enabled and wraps when they are disabled.
  • Premise "This trigger happens in realistic use: the sequence of events the description names" unsettled. The wallet forwards output amounts after checking only the address network, so the path does not rule out overflow, but the code read does not show a realistic caller supplying an overflowing total."
  • Not listed, on code this PR did not change: "UTXO maturity and confirmation arithmetic can overflow" (suggestion): "warning. A coinbase Utxo built through the public Utxo::new with a height within 100 of u32::MAX makes self.height + 100 in the maturity check overflow, so a wrapped result can let an immature coin pass. No real block height comes near u32::MAX, so only a crafted value triggers it. The arithmetic is unchanged by this PR."
  • Dropped: "The restore test seeds account state behind the public API" (ignore): "ignore. The quoted rule is a requirement. In restore_utxos_tests.rs this PR only deletes the misplaced.is_trusted = true line and its assertion and edits the doc. The hand-set is_locked and is_instantlocked and the direct inserts were already there, so this PR adds no hand-built state and does not break the rule."
  • Kept: "restore_utxos still promises to preserve the removed trust flag" (suggestion): "note. This PR removes the trust latch in take_in_output (managed_core_funds_account.rs:348-349 now keep only is_instantlocked and is_locked), which makes a doc that promises trust is kept untrue. The cited doc sits in mod.rs, which this PR leaves unchanged and which is not shown, so whether it says this is left to ruleUnseen. The contradicted tool evidence only says the file is outside the diff, which does not refute a stale comment the change made untrue."
  • Kept: "Change from the wallet's own unconfirmed sends can no longer be spent, unlike Dash Core" (suggestion): "note. This matches the round 1 finding on the divergence from CachedTxIsTrusted, graded on the improvement row, and the code at that spot is unchanged since. The PR description says the trusted self-send rule is removed on purpose. The code does what it says: transaction_builder.rs:571 keeps only final coins and update_balance buckets mempool change as unconfirmed. Whether waiting for a lock or block before a second send suits users is a design question to put to the author."
  • Kept: "A loaded wallet may retain its legacy confirmed balance until the next refresh" (warning): "warning. spendable() now returns the cached confirmed bucket (balance.rs:54). An earlier version put trusted mempool change into that bucket. If a stored cache is loaded and read before update_balance runs, spendable() overstates the funds a build can use. The code shown does not settle whether every load path refreshes the cache, so that is a doubt. If confirmed it is still a warning by test 3: builds read each coin's own flags at transaction_builder.rs:571, so no transaction spends on the stale figure, and the number is right again at the next update_balance.
    Refutation confirmed: The stale-cache path is real. ManagedWalletInfo derives Deserialize with balance not skipped, and balance() returns the field as it is. The base version of update_balance put trusted mempool change into confirmed, so after loading an old JSON snapshot, spendable() can show more than the coins' own flags allow. But that is my reading of the code, not a demonstrated failure: the next update_balance puts the figure right, and transaction builds read each coin's own flags. So this is... Rule checked: In serde, a derived Deserialize restores every field that is not #[serde(skip)] exactly as it was stored and runs no code afterwards, so a cached field keeps its stored value until something recomputes it.
  • Premise "A load or deserialization path of ManagedWalletInfo restores the cached balance written by an earlier version and exposes it through spendable() before calling update_balance" confirmed. Loading a snapshot written by an older version is a documented use: field comments say serde(default) exists so such JSON snapshots still load, and tests do this load. The derived Deserialize restores the stored balance without calling update_balance, and balance() returns it as it is. In the base, update_balance counted trusted mempool change as confirmed, so such a snapshot carries an inflated confirmed figure into spendable().
    Pair refutation confirmed: Direct deserialization restores the public wallet balance cache, and neither balance() nor spendable() refreshes it. The amount can remain wrong across repeated reads until a separate update recomputes it. Rule checked: Deserializing a cached field restores its stored value; it does not recompute the value under new rules.
  • Premise "A load or deserialization path of ManagedWalletInfo restores the cached balance written by an earlier version and exposes it through spendable() before calling update_balance" confirmed. The direct Serde load restores the cached balance and exposes it before the caller explicitly refreshes it."

Timing:

  • Parse: 5.4s
  • Review agents: 264.3s
  • Judge: 338.8s
  • Total: 608.6s

Last reviewed 0ea0afe · head 0ea0afe · up to date

  • Pause automatic reviews
  • Review again
  • Deeper review

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ 2 warnings to address. Fix each one, reply in its thread with a reason Manki accepts, or tick Create an issue for this to track it for later. Manki approves once every warning is handled.

Caution

Claude subscription has used 98% of its weekly limit, past the 90% mark. It resets 2026-12-04 01:00 UTC.

Once a limit is used up, reviews on that account stop until it resets.


1 suggestion · not blocking
✨ restore_utxos still promises to preserve the removed trust flag
Suggestion, not blocking · Documentation · Quick fix · key-wallet/src/wallet/managed_wallet_info/mod.rs:465

Why: The public restore documentation says replacement coins keep their trust, but Utxo no longer carries that state.

/// way as when it processes the funding transaction, except that claims
/// are not consulted. The restored UTXO
/// keeps the InstantSend lock and trust of any copy it replaces or takes
/// out. Its coin lock follows the wallet's lock set
/// ([`locked_outpoints`](Self::locked_outpoints)), whatever flag it or

How to fix it
Describe only the InstantSend and wallet coin-lock behavior that restore preserves.

Checked in the code
On the flagged line: Says a restored coin keeps the InstantSend lock and trust of any copy it replaces or takes out

Preserves is_instantlocked and line 349 preserves is_locked

if !copies.is_empty() {
output.is_instantlocked |= copies.iter().any(|copy| copy.is_instantlocked);
output.is_locked = copies.iter().any(|copy| copy.is_locked);
}
self.claim_guarded_outputs.remove(&outpoint);
self.utxos.insert(outpoint, output);

  • Create an issue for this

Findings dismissed by the PR author @ZocoLini (maintain role):

About this review
  • Reviewed 0ea0afe, round 2
  • 566 changed lines read in 10m 9s
  • Found by claude-opus-5-5 and gpt-6.2-sol, judged by claude-opus-5-5
  • Tokens: 9.3M in (7.6M from cache) · 128k out · about $10.49 at API prices
  • Runner: self-hosted · started after 8s · peak memory 4.3 GiB of 30.0 GiB
  • How Manki reviews

// Only final coins fund a build: a coin the network has not settled
// may never exist, and with it anything built on it.
if !self.allow_waiting_inputs {
self.inputs.retain(|utxo| utxo.is_confirmed || utxo.is_instantlocked);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Warning · Correctness · Moderate

A seeded copy can hide a funding account's current finality

An earlier round already reviewed these lines and missed this. It is in this PR's own code, so it still holds the approval.

What goes wrong: A caller can seed a coin from a snapshot taken before its InstantSend lock, then attach the funding account after it learns the lock. If the snapshot is seeded first, the account skips its current copy and the builder reports FundsAwaitingFinality for an already-final coin. Conversely, a stale copy marked final is not checked against a waiting copy held by the funding account.

How to fix it and 17 places read · confirmed with tools

How to fix it
Resolve each outpoint to one candidate before selection, using the funding account's coin state whenever it holds that outpoint. Apply this to seeded inputs added on either side of the funding call and to reservation-only funding without offering unseeded coins.

Checked in the code
On the commented line: Trusts the candidate's is_confirmed || is_instantlocked flags

Computes present from already seeded inputs

// pre-seeded outpoint was silently dropped instead of duplicated.
let present: HashSet<OutPoint> = self.inputs.iter().map(|utxo| utxo.outpoint).collect();
let mut candidates: Vec<Utxo> = Vec::new();
// Every unreserved UTXO this account owns that ends up in the candidate
// pool — including one pre-seeded by `add_inputs` — so that if selection

Skips the funding account's copy when present.contains(&utxo.outpoint)

owned.insert(utxo.outpoint);
if present.contains(&utxo.outpoint) {
continue;
}
if contribute_candidates {

Appends later seeds with self.inputs.extend(inputs)

pub fn add_inputs(mut self, inputs: impl IntoIterator<Item = Utxo>) -> Self {
self.inputs.extend(inputs);
self
}

In a related repository: dashpay/platform:packages/rs-platform-wallet-ffi/src/core_wallet/transaction_builder.rs:988, dashpay/platform:packages/rs-platform-wallet-ffi/src/core_wallet/transaction_builder.rs:991, dashpay/platform:packages/rs-platform-wallet-ffi/src/core_wallet/transaction_builder.rs:998, dashpay/platform:packages/rs-platform-wallet/src/wallet/core/transaction.rs:639, dashpay/platform:packages/rs-platform-wallet/src/wallet/core/transaction.rs:703, dashpay/platform:packages/rs-platform-wallet/src/wallet/core/transaction.rs:704, dashpay/platform:packages/rs-platform-wallet/src/wallet/core/transaction.rs:706, dashpay/platform:packages/rs-platform-wallet/src/wallet/core/transaction.rs:724, dashpay/platform:packages/rs-platform-wallet/src/wallet/core/transaction.rs:726

Double-checked
Manki tried to disprove this by reading the code and could not. fund_from never offers the funding account's current copy of an outpoint that was already seeded (lines 206 and 225). prepare then drops any input whose own fl…

Second check, on another model
Not settled. The builder keeps the pre-seeded copy and can misreport a final coin as awaiting finality. The tests combine seeding and funding for the same outpoint, but I d… See key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs lines 225, 525, 531, 571, 596, 482, and 489.

  • Create an issue for this

/// Get the spendable balance, the confirmed one.
pub fn spendable(&self) -> u64 {
self.confirmed + self.unconfirmed
self.confirmed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Warning · Correctness · Quick fix

A loaded wallet may retain its legacy confirmed balance until the next refresh

An earlier round already reviewed these lines and missed this. It is in this PR's own code, so it still holds the approval.

What goes wrong: The new spendable() getter trusts the cached confirmed bucket, which old snapshots could include trusted mempool change in.

How this was checked: 13 places read, confirmed with tools

Checked in the code

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ManagedWalletInfo {
/// Network this wallet info is associated with
pub network: Network,

/// Cached wallet core balance - should be updated when accounts change
pub balance: WalletCoreBalance,
/// Transactions that have received an InstantSend lock.
#[cfg_attr(feature = "serde", serde(skip))]
pub(crate) instant_send_locks: HashSet<Txid>,

let json = serde_json::to_string(&info).expect("serialize");
let mut restored: ManagedWalletInfo = serde_json::from_str(&json).expect("deserialize");
assert_eq!(restored.locked_outpoints(), info.locked_outpoints());
restored.update_last_processed_height(TIP);
let spendable: Vec<OutPoint> =
restored.get_spendable_utxos().into_iter().map(|utxo| utxo.outpoint).collect();
assert_eq!(spendable, vec![spare.outpoint]);

Double-checked
Manki tried to disprove this by reading the code and could not. The stale-cache path is real. ManagedWalletInfo derives Deserialize with balance not skipped, and balance() returns the field as it is. The base versio… See key-wallet/src/wallet/managed_wallet_info/mod.rs lines 117 and 157, and key-wallet/src/tests/locked_outpoints_tests.rs:981.

Second check, on another model
Double-checked. Direct deserialization restores the public wallet balance cache, and neither balance() nor spendable() refreshes it. The amount can remain wrong across repeate…

  • Create an issue for this

// downgrade it.
copies.extend(self.utxos.get(&outpoint).cloned());
if !copies.is_empty() {
output.is_instantlocked |= copies.iter().any(|copy| copy.is_instantlocked);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✨ Suggestion, not blocking · Correctness · Moderate

Change from the wallet's own unconfirmed sends can no longer be spent, unlike Dash Core

Why: This change drops is_trusted and collect_final_parents, so only is_confirmed || is_instantlocked lets a coin fund a build or count as confirmed balance. A user who sends twice in a row before the first send is InstantSend-locked now gets FundsAwaitingFinality on the second send, and the change from the first send shows as unconfirmed. If a light client never sees the InstantSend lock, this lasts until the next block, about 2.5 minutes. Dash Core trusts a mempool transaction when every input spends one of its own trusted outputs, and with the default m_spend_zero_conf_change = true it selects that change and counts it as trusted balance.

How to fix it, 6 places read, and 4 other checks

How to fix it
Keep a trusted flag on Utxo. Set it from the wallet-wide parent check, as collect_final_parents did, matching CachedTxIsTrusted. Accept is_trusted next to is_confirmed || is_instantlocked in the builder's input filter and in update_balance.

Checked in the code
On the commented line: Only is_instantlocked is carried forward now. The is_trusted latch was removed, and a grep for is_trusted|collect_final_parents under key-wallet/src fi…

self.inputs.retain(|utxo| utxo.is_confirmed || utxo.is_instantlocked); drops own unconfirmed change from coin selection.

if !self.allow_waiting_inputs {
self.inputs.retain(|utxo| utxo.is_confirmed || utxo.is_instantlocked);
}
let is_asset_lock =

else if utxo.is_confirmed || utxo.is_instantlocked { confirmed += value; } else { unconfirmed += value; }

immature += value;
} else if utxo.is_confirmed || utxo.is_instantlocked {
confirmed += value;
} else {
unconfirmed += value;

  • dashpay/dash:src/wallet/receive.cpp:264 if (!wallet.m_spend_zero_conf_change || !CachedTxIsFromMe(wallet, wtx, ISMINE_ALL)) return false;, then lines 270-284…
  • dashpay/dash:src/wallet/wallet.h:170 static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true;
  • dashpay/dash:src/wallet/spend.cpp:241 bool safeTx = CachedTxIsTrusted(wallet, wtx, trusted_parents); gates coin selection on trust, not on confirmation.
  • dashpay/dash:src/wallet/receive.cpp:309 trusted transactions go to m_mine_trusted balance.

In a related repository: dashpay/dash:src/wallet/receive.cpp:264, dashpay/dash:src/wallet/spend.cpp:241, dashpay/dash:src/wallet/wallet.h:170

  • Create an issue for this
  • Dismiss this finding

@manki-review
manki-review Bot dismissed their stale review December 3, 2026 21:01

Superseded by new review

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Dec 3, 2026

This branch has not been deployed

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

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant