Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #553.
Branch-and-bound excludes optional UTXOs whose spending fee is at least their value, but previously passed the original, unfiltered candidates to its fallback. When no changeless selection exists, this can increase fees unnecessarily or report insufficient funds despite an economical selection being available.
For example, with a 49,000-sat target at 10 sat/vB, a 50,000-sat input covers the target and its 680-sat input fee. If the fallback first selects an older 300-sat input, the resulting 50,300 sats cannot cover the target plus 1,360 sats of input fees.
Build the fallback candidates and BnB output groups from the same filtered sequence. Required inputs remain eligible regardless of effective value; standalone coin-selection algorithms are unchanged.
Notes to the reviewers
The regression uses the real
OldestFirstCoinSelectionfallback to make selection deterministic. Both targets exceed the BnB changeless window, so the test exercises fallback rather than the existing preflight insufficient-funds path. Coverage includes negative and zero effective values, the one-satoshi positive boundary, and explicitly required negative-effective-value inputs.Confirmed the regression fails before the fix and passes afterward. No competing open PR or cross-reference for #553 was found when selecting the issue.
Validation
Formatting note: the current floating nightly (2026-09-27) rewrites existing descriptor macros with unsupported trailing commas, causing compilation failures in
src/descriptor/policy.rs. I restored those unrelated edits and ran the pre-push recipes using a temporary copy of the justfile withnightly-2026-08-01, matching the pin proposed in #537. No formatter or unrelated policy changes are included in this PR.Changelog notice
Fixed excess fees and false insufficient-funds errors when branch-and-bound falls back with optional UTXOs whose effective value is non-positive.
Before submitting