mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-24 10:41:34 +02:00
Merge bitcoin/bitcoin#33058: test: add assertions to SRD max weight test
cc33e45789
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: ACKcc33e45789
furszy: ACKcc33e45789
Tree-SHA512: bad224063ba830c27fba1b7b80e411ac7cd6c3edcb60bade4e6e3010f3b5d360a921de742c7c20efea8fa839d7939f338270658f66bbcebedebe5c5c8a3e8f9b
This commit is contained in:
@@ -1223,7 +1223,7 @@ BOOST_AUTO_TEST_CASE(srd_tests)
|
|||||||
|
|
||||||
{
|
{
|
||||||
// ################################################################################################################
|
// ################################################################################################################
|
||||||
// 3) Test selection when some coins surpass the max allowed weight while others not. --> must find a good solution
|
// 3) Test that SRD result does not exceed the max weight
|
||||||
// ################################################################################################################
|
// ################################################################################################################
|
||||||
CAmount target = 25.33L * COIN;
|
CAmount target = 25.33L * COIN;
|
||||||
int max_selection_weight = 10000; // WU
|
int max_selection_weight = 10000; // WU
|
||||||
@@ -1238,6 +1238,7 @@ BOOST_AUTO_TEST_CASE(srd_tests)
|
|||||||
return available_coins;
|
return available_coins;
|
||||||
});
|
});
|
||||||
BOOST_CHECK(res);
|
BOOST_CHECK(res);
|
||||||
|
BOOST_CHECK(res->GetWeight() <= max_selection_weight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user