@@ -2387,7 +2387,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const CoinEligibil
2387
2387
effective_feerate = coin_selection_params.effective_fee ;
2388
2388
}
2389
2389
2390
- std::vector<OutputGroup> groups = GroupOutputs (coins, !coin_selection_params.m_avoid_partial_spends , eligibility_filter. max_ancestors , effective_feerate, long_term_feerate, eligibility_filter, true /* positive_only */ );
2390
+ std::vector<OutputGroup> groups = GroupOutputs (coins, !coin_selection_params.m_avoid_partial_spends , effective_feerate, long_term_feerate, eligibility_filter, true /* positive_only */ );
2391
2391
2392
2392
// Calculate cost of change
2393
2393
CAmount cost_of_change = GetDiscardRate (*this ).GetFee (coin_selection_params.change_spend_size ) + coin_selection_params.effective_fee .GetFee (coin_selection_params.change_output_size );
@@ -2397,7 +2397,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const CoinEligibil
2397
2397
bnb_used = true ;
2398
2398
return SelectCoinsBnB (groups, nTargetValue, cost_of_change, setCoinsRet, nValueRet, not_input_fees);
2399
2399
} else {
2400
- std::vector<OutputGroup> groups = GroupOutputs (coins, !coin_selection_params.m_avoid_partial_spends , eligibility_filter. max_ancestors , CFeeRate (0 ), CFeeRate (0 ), eligibility_filter, false /* positive_only */ );
2400
+ std::vector<OutputGroup> groups = GroupOutputs (coins, !coin_selection_params.m_avoid_partial_spends , CFeeRate (0 ), CFeeRate (0 ), eligibility_filter, false /* positive_only */ );
2401
2401
2402
2402
bnb_used = false ;
2403
2403
return KnapsackSolver (nTargetValue, groups, setCoinsRet, nValueRet);
@@ -2489,8 +2489,8 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2489
2489
(m_spend_zero_conf_change && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , 2 ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2490
2490
(m_spend_zero_conf_change && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , std::min ((size_t )4 , max_ancestors/3 ), std::min ((size_t )4 , max_descendants/3 )), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2491
2491
(m_spend_zero_conf_change && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , max_ancestors/2 , max_descendants/2 ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2492
- (m_spend_zero_conf_change && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , max_ancestors-1 , max_descendants-1 ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2493
- (m_spend_zero_conf_change && !fRejectLongChains && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , std::numeric_limits<uint64_t >::max ()), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used));
2492
+ (m_spend_zero_conf_change && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , max_ancestors-1 , max_descendants-1 , true /* include_partial_groups */ ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2493
+ (m_spend_zero_conf_change && !fRejectLongChains && SelectCoinsMinConf (value_to_select, CoinEligibilityFilter (0 , 1 , std::numeric_limits<uint64_t >::max (), std::numeric_limits< uint64_t >:: max (), true /* include_partial_groups */ ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used));
2494
2494
2495
2495
// because SelectCoinsMinConf clears the setCoinsRet, we now add the possible inputs to the coinset
2496
2496
util::insert (setCoinsRet, setPresetCoins);
@@ -4193,7 +4193,7 @@ bool CWalletTx::IsImmatureCoinBase() const
4193
4193
return GetBlocksToMaturity () > 0 ;
4194
4194
}
4195
4195
4196
- std::vector<OutputGroup> CWallet::GroupOutputs (const std::vector<COutput>& outputs, bool single_coin, const size_t max_ancestors, const CFeeRate& effective_feerate, const CFeeRate& long_term_feerate, const CoinEligibilityFilter& filter, bool positive_only) const {
4196
+ std::vector<OutputGroup> CWallet::GroupOutputs (const std::vector<COutput>& outputs, bool single_coin, const CFeeRate& effective_feerate, const CFeeRate& long_term_feerate, const CoinEligibilityFilter& filter, bool positive_only) const {
4197
4197
std::vector<OutputGroup> groups;
4198
4198
std::map<CTxDestination, OutputGroup> gmap;
4199
4199
std::set<CTxDestination> full_groups;
@@ -4235,9 +4235,9 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
4235
4235
if (!single_coin) {
4236
4236
for (auto & it : gmap) {
4237
4237
auto & group = it.second ;
4238
- if (full_groups.count (it.first ) > 0 ) {
4239
- // Make this unattractive as we want coin selection to avoid it if possible
4240
- group. m_ancestors = max_ancestors - 1 ;
4238
+ if (full_groups.count (it.first ) > 0 && !filter. m_include_partial_groups ) {
4239
+ // Don't include partial groups if we don't want them
4240
+ continue ;
4241
4241
}
4242
4242
// If the OutputGroup is not eligible, don't add it
4243
4243
if (positive_only && group.effective_value <= 0 ) continue ;
0 commit comments