@@ -248,9 +248,9 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
248248
249249 // Iteration exhaustion test
250250 CAmount target = make_hard_case (17 , utxo_pool);
251- BOOST_CHECK (!SelectCoinsBnB (GroupCoins (utxo_pool), target, 0 )); // Should exhaust
251+ BOOST_CHECK (!SelectCoinsBnB (GroupCoins (utxo_pool), target, 1 )); // Should exhaust
252252 target = make_hard_case (14 , utxo_pool);
253- const auto result7 = SelectCoinsBnB (GroupCoins (utxo_pool), target, 0 ); // Should not exhaust
253+ const auto result7 = SelectCoinsBnB (GroupCoins (utxo_pool), target, 1 ); // Should not exhaust
254254 BOOST_CHECK (result7);
255255
256256 // Test same value early bailout optimization
@@ -289,15 +289,18 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
289289 // Make sure that effective value is working in AttemptSelection when BnB is used
290290 CoinSelectionParams coin_selection_params_bnb{
291291 rand,
292- /* change_output_size=*/ 0 ,
293- /* change_spend_size=*/ 0 ,
292+ /* change_output_size=*/ 31 ,
293+ /* change_spend_size=*/ 68 ,
294294 /* min_change_target=*/ 0 ,
295295 /* effective_feerate=*/ CFeeRate (3000 ),
296296 /* long_term_feerate=*/ CFeeRate (1000 ),
297297 /* discard_feerate=*/ CFeeRate (1000 ),
298298 /* tx_noinputs_size=*/ 0 ,
299299 /* avoid_partial=*/ false ,
300300 };
301+ coin_selection_params_bnb.m_change_fee = coin_selection_params_bnb.m_effective_feerate .GetFee (coin_selection_params_bnb.change_output_size );
302+ 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 ;
303+ coin_selection_params_bnb.min_viable_change = coin_selection_params_bnb.m_effective_feerate .GetFee (coin_selection_params_bnb.change_spend_size );
301304 {
302305 std::unique_ptr<CWallet> wallet = std::make_unique<CWallet>(m_node.chain .get (), " " , m_args, CreateMockWalletDatabase ());
303306 wallet->LoadWallet ();
@@ -777,6 +780,8 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
777780 /* tx_noinputs_size=*/ 0 ,
778781 /* avoid_partial=*/ false ,
779782 };
783+ cs_params.m_cost_of_change = 1 ;
784+ cs_params.min_viable_change = 1 ;
780785 CCoinControl cc;
781786 const auto result = SelectCoins (*wallet, available_coins, target, cc, cs_params);
782787 BOOST_CHECK (result);
0 commit comments