Skip to content

Commit a273241

Browse files
committed
Merge bitcoin/bitcoin#26020: test: Change coinselection parameter location to make tests independent
b942c94 test: Change coinselection parameter location to make tests independent (yancy) Pull request description: the `subtract_fee_outputs` param is expected to be `true` for all subsequent tests. It should be defined outside of a single test so that if it's removed or changed, all subsequent tests won't fail. Currently if you remove this [test](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L304:L325) the following [test](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L327:L345) fails. This change makes the tests independent. ACKs for top commit: achow101: ACK b942c94 aureleoules: ACK b942c94. rajarshimaitra: tACK b942c94 theStack: ACK b942c94 Tree-SHA512: 461e19d15351318102ef9f96c68442365d8ca238c48ad7aefe23e8532b33b91dadf6c7840c7894574bccede6da162a55ad7a6f6a330d61a11ce804e68ddc5e9c
2 parents 139ba2b + b942c94 commit a273241

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
@@ -302,6 +302,8 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
302302
coin_selection_params_bnb.m_change_fee = coin_selection_params_bnb.m_effective_feerate.GetFee(coin_selection_params_bnb.change_output_size);
303303
coin_selection_params_bnb.m_cost_of_change = coin_selection_params_bnb.m_effective_feerate.GetFee(coin_selection_params_bnb.change_spend_size) + coin_selection_params_bnb.m_change_fee;
304304
coin_selection_params_bnb.min_viable_change = coin_selection_params_bnb.m_effective_feerate.GetFee(coin_selection_params_bnb.change_spend_size);
305+
coin_selection_params_bnb.m_subtract_fee_outputs = true;
306+
305307
{
306308
std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain.get(), "", m_args, CreateMockWalletDatabase());
307309
wallet->LoadWallet();
@@ -319,7 +321,6 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
319321
available_coins.Clear();
320322
add_coin(available_coins, *wallet, 1 * CENT, coin_selection_params_bnb.m_effective_feerate);
321323
available_coins.All().at(0).input_bytes = 40;
322-
coin_selection_params_bnb.m_subtract_fee_outputs = true;
323324
const auto result9 = SelectCoinsBnB(GroupCoins(available_coins.All()), 1 * CENT, coin_selection_params_bnb.m_cost_of_change);
324325
BOOST_CHECK(result9);
325326
BOOST_CHECK_EQUAL(result9->GetSelectedValue(), 1 * CENT);

0 commit comments

Comments
 (0)