wallet: skip APS when no partial spend exists #34405

pull 8144225309 wants to merge 1 commits into bitcoin:master from 8144225309:aps-skip-no-partial-spend changing 3 files +64 −15
  1. 8144225309 commented at 4:36 am on January 26, 2026: none

    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.


    Supersedes #34362 which was corrupted by a shallow clone force-push.

  2. DrahtBot added the label Wallet on Jan 26, 2026
  3. DrahtBot commented at 4:37 am on January 26, 2026: 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/34405.

    Reviews

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

  4. 8144225309 force-pushed on Jan 26, 2026
  5. 8144225309 force-pushed on Jan 26, 2026
  6. 8144225309 force-pushed on Jan 26, 2026
  7. wallet: skip APS when no partial spend exists
    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 expect APS to be skipped
    when no partial spend exists. Add new test that creates a partial spend
    scenario so the full APS tracepoint flow is verified.
    
    Fixes #25150
    53de94fb82
  8. 8144225309 force-pushed on Jan 26, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-27 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me