@ -613,6 +613,7 @@ BOOST_AUTO_TEST_CASE(ApproximateBestSubset)
// Tests that with the ideal conditions, the coin selector will always be able to find a solution that can pay the target value
// Tests that with the ideal conditions, the coin selector will always be able to find a solution that can pay the target value
BOOST_AUTO_TEST_CASE ( SelectCoins_test )
BOOST_AUTO_TEST_CASE ( SelectCoins_test )
{
{
LOCK ( testWallet . cs_wallet ) ;
testWallet . SetupLegacyScriptPubKeyMan ( ) ;
testWallet . SetupLegacyScriptPubKeyMan ( ) ;
// Random generator stuff
// Random generator stuff
@ -638,18 +639,14 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
CAmount target = rand . randrange ( balance - 1000 ) + 1000 ;
CAmount target = rand . randrange ( balance - 1000 ) + 1000 ;
// Perform selection
// Perform selection
CoinSelectionParams coin_selection_params_knapsack ( /* change_output_size= */ 34 ,
CoinSelectionParams cs_params ( /* change_output_size= */ 34 ,
/* change_spend_size= */ 148 , /* effective_feerate= */ CFeeRate ( 0 ) ,
/* change_spend_size= */ 148 , /* effective_feerate= */ CFeeRate ( 0 ) ,
/* long_term_feerate= */ CFeeRate ( 0 ) , /* discard_feerate= */ CFeeRate ( 0 ) ,
/* long_term_feerate= */ CFeeRate ( 0 ) , /* discard_feerate= */ CFeeRate ( 0 ) ,
/* tx_no_inputs_size= */ 0 , /* avoid_partial= */ false ) ;
/* tx_no_inputs_size= */ 0 , /* avoid_partial= */ false ) ;
CoinSelectionParams coin_selection_params_bnb ( /* change_output_size= */ 34 ,
/* change_spend_size= */ 148 , /* effective_feerate= */ CFeeRate ( 0 ) ,
/* long_term_feerate= */ CFeeRate ( 0 ) , /* discard_feerate= */ CFeeRate ( 0 ) ,
/* tx_no_inputs_size= */ 0 , /* avoid_partial= */ false ) ;
CoinSet out_set ;
CoinSet out_set ;
CAmount out_value = 0 ;
CAmount out_value = 0 ;
BOOST_CHECK( testWallet . SelectCoinsMinConf ( target , filter_standard , vCoins , out_set , out_value , coin_selection_params_bnb ) | |
CCoinControl cc ;
testWallet . SelectCoinsMinConf ( target , filter_standard , vCoins , out_set , out_value , coin_selection_params_knapsack ) ) ;
BOOST_CHECK ( testWallet . SelectCoins ( vCoins , target , out_set , out_value , cc , cs_params ) ) ;
BOOST_CHECK_GE ( out_value , target ) ;
BOOST_CHECK_GE ( out_value , target ) ;
}
}
}
}