@@ -2469,9 +2469,9 @@ bool CWallet::OutputEligibleForSpending(const COutput& output, const CoinEligibi
2469
2469
if (output.nDepth < (output.tx ->IsFromMe (ISMINE_ALL) ? eligibility_filter.conf_mine : eligibility_filter.conf_theirs ))
2470
2470
return false ;
2471
2471
2472
- int64_t ancestors, descendants;
2472
+ size_t ancestors, descendants;
2473
2473
mempool.GetTransactionAncestry (output.tx ->GetHash (), ancestors, descendants);
2474
- if (ancestors >= eligibility_filter.max_ancestors || descendants >= eligibility_filter.max_descendants ) {
2474
+ if (ancestors > eligibility_filter.max_ancestors || descendants > eligibility_filter.max_descendants ) {
2475
2475
return false ;
2476
2476
}
2477
2477
@@ -2585,7 +2585,7 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2585
2585
++it;
2586
2586
}
2587
2587
2588
- size_t nMaxChainLength = std::min (gArgs .GetArg (" -limitancestorcount" , DEFAULT_ANCESTOR_LIMIT), gArgs .GetArg (" -limitdescendantcount" , DEFAULT_DESCENDANT_LIMIT));
2588
+ size_t nMaxChainLength = ( size_t ) std::max< int64_t >( 1 , std:: min (gArgs .GetArg (" -limitancestorcount" , DEFAULT_ANCESTOR_LIMIT), gArgs .GetArg (" -limitdescendantcount" , DEFAULT_DESCENDANT_LIMIT) ));
2589
2589
bool fRejectLongChains = gArgs .GetBoolArg (" -walletrejectlongchains" , DEFAULT_WALLET_REJECT_LONG_CHAINS);
2590
2590
2591
2591
bool res = nTargetValue <= nValueFromPresetInputs ||
@@ -2594,7 +2594,7 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2594
2594
(m_spend_zero_conf_change && SelectCoinsMinConf (nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter (0 , 1 , 2 ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2595
2595
(m_spend_zero_conf_change && SelectCoinsMinConf (nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter (0 , 1 , std::min ((size_t )4 , nMaxChainLength/3 )), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2596
2596
(m_spend_zero_conf_change && SelectCoinsMinConf (nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter (0 , 1 , nMaxChainLength/2 ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2597
- (m_spend_zero_conf_change && SelectCoinsMinConf (nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter (0 , 1 , nMaxChainLength), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2597
+ (m_spend_zero_conf_change && SelectCoinsMinConf (nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter (0 , 1 , nMaxChainLength- 1 ), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used)) ||
2598
2598
(m_spend_zero_conf_change && !fRejectLongChains && SelectCoinsMinConf (nTargetValue - nValueFromPresetInputs, CoinEligibilityFilter (0 , 1 , std::numeric_limits<uint64_t >::max ()), vCoins, setCoinsRet, nValueRet, coin_selection_params, bnb_used));
2599
2599
2600
2600
// because SelectCoinsMinConf clears the setCoinsRet, we now add the possible inputs to the coinset
0 commit comments