Skip to content

wallet: skip APS when no partial spend exists - #34362

Closed
8144225309 wants to merge 1 commit into
bitcoin:masterfrom
8144225309:aps-skip-no-partial-spend
Closed

8144225309 wants to merge 1 commit into
bitcoin:masterfrom
8144225309:aps-skip-no-partial-spend

Conversation

@8144225309

@8144225309 8144225309 commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #25150

APS (Avoid Partial Spends) runs a second coin selection pass to fully spend
UTXOs sharing a scriptPubKey. This currently runs unconditionally, even when
the first selection has no partial spend. Running APS unnecessarily wastes
computation and can produce a worse result when there was nothing to fix.

Detect partial spends by comparing selected vs available UTXO counts per
scriptPubKey, reusing available_coins. Skip APS if none found.

Test updated to create partial spend scenarios so tracepoints fire.

@DrahtBot

DrahtBot commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34362.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34075 (fees: Introduce Mempool Based Fee Estimation to reduce overestimation by ismaelsadeeq)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • an callback -> a callback [indefinite article incorrect before a consonant sound]
  • then then maybe -> then maybe [duplicate word]
  • "#include <d/file.capnp.proxy-types.h>"i -> "#include <d/file.capnp.proxy-types.h>" [stray "i" character after the quoted include makes the sentence malformed]
  • trying to communicating -> trying to communicate [incorrect verb form]
  • ProxySever -> ProxyServer [typo in class/name]
  • will filled with callbacks -> will be filled with callbacks [missing auxiliary verb "be"]

2026-01-26 03:42:49

APS runs a second coin selection to fully spend UTXOs sharing a
scriptPubKey. Currently runs unconditionally, even when the first
selection has no partial spend and APS cannot help.

Detect partial spends by comparing selected vs available UTXO counts
per scriptPubKey inside CreateTransactionInternal, reusing available_coins.
Add has_partial_spend to CreatedTransactionResult. Skip APS if false.

Update interface_usdt_coinselection test to create partial spend scenarios
so tracepoints fire as expected.

Fixes bitcoin#25150
@8144225309

Copy link
Copy Markdown
Contributor Author

This PR was corrupted by a shallow clone force-push. The corrected version is at #34405.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coin Selection tracepoint overreports use of APS

2 participants