AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

Merge bitcoin/bitcoin#36775: test: wallet: BnB marks exhaustive search complete

Public commit record

What the developer wrote

Authored by merge-script

91/100 · Strong
Merge bitcoin/bitcoin#36775: test: wallet: BnB marks exhaustive search complete

ac2c946d3b211e90abb48357b0cb2afadbc64a38 test: BnB marks exhaustive search complete (conradgabe)

Pull request description:

`SelectCoinsBnB` marks its result as completed when it exhausts the search space before reaching `TOTAL_TRIES`. Only the incomplete case is checked in the unit tests (`bnb_exhaustion_with_solution_test`), and the `bnb_finds_min_waste` fuzz target only reads the flag to decide whether to assert optimality, so reporting false goes unnoticed.

This PR checks `GetAlgoCompleted()` in `TestBnBSuccess` for cases that finish below the attempt limit (100,000).

Kills the following mutant (https://mutanthub.space/mutants/1096):
```diff
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -233,7 +233,7 @@ util::Result<SelectionResult> SelectCoinsBnB(std::vector<OutputGroup>& utxo_pool
if (curr_selection.empty()) {
// Exhausted search space before running into attempt limit
is_done = true;
- result.SetAlgoCompleted(true);
+ result.SetAlgoCompleted(false);
break;
}
// Set `next_utxo` to one after last selected, then deselect last selected UTXO
```

ACKs for top commit:
yancyribbens:
ACK ac2c946d3b211e90abb48357b0cb2afadbc64a38
davidgumberg:
crACK https://github.com/bitcoin/bitcoin/commit/ac2c946d3b211e90abb48357b0cb2afadbc64a38
murchandamus:
ACK ac2c946d3b211e90abb48357b0cb2afadbc64a38

Tree-SHA512: f7c00f01fba900557fe26e2b7c6651ea6217508bd1f55202122e1b64ce1efa30f36ab474d24c61b29112b4e5594c7bed8d1e4787492dcd73ae61ca7592450d0e
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit only adds a new check to an existing unit test. It makes sure that when Bitcoin Core's coin-selection algorithm (called Branch-and-Bound or BnB) finishes searching all possible coin combinations, it correctly reports that the search was completed. The actual production code is unchanged; only the test is strengthened. There is no security fix or vulnerability being patched.

Recommended action

No security action needed. Treat as a normal quality/test-coverage improvement.

Security signals we found

01

No production code change

02

Pure test-coverage improvement

03

No memory safety, cryptography, consensus, or networking changes

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.