Skip to content

Commit 643bacd

Browse files
committed
Merge bitcoin/bitcoin#33058: test: add assertions to SRD max weight test
cc33e45 test: improve assertion for SRD max weight test (yancy) Pull request description: Replace generic assertion with a result specific assertion showing the correctness of the solution found. If the max weight parameter is exceeded, the least valuable `UTXOs` are removed from the result. Therefore, only the most valued _encountered_ `UTXO's` are selected. While the smallest set would include all the most valued `UTXO's`, in the case of the test there is one high value `UTXO` that is never found before the target value is reached. Correct the test comment to be more specific about why the assertion is a good result. ACKs for top commit: murchandamus: ACK cc33e45 furszy: ACK cc33e45 Tree-SHA512: bad224063ba830c27fba1b7b80e411ac7cd6c3edcb60bade4e6e3010f3b5d360a921de742c7c20efea8fa839d7939f338270658f66bbcebedebe5c5c8a3e8f9b
2 parents eeb0b31 + cc33e45 commit 643bacd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/test/coinselector_tests.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ BOOST_AUTO_TEST_CASE(srd_tests)
12231223

12241224
{
12251225
// ################################################################################################################
1226-
// 3) Test selection when some coins surpass the max allowed weight while others not. --> must find a good solution
1226+
// 3) Test that SRD result does not exceed the max weight
12271227
// ################################################################################################################
12281228
CAmount target = 25.33L * COIN;
12291229
int max_selection_weight = 10000; // WU
@@ -1238,6 +1238,7 @@ BOOST_AUTO_TEST_CASE(srd_tests)
12381238
return available_coins;
12391239
});
12401240
BOOST_CHECK(res);
1241+
BOOST_CHECK(res->GetWeight() <= max_selection_weight);
12411242
}
12421243
}
12431244

0 commit comments

Comments
 (0)