Partially revert 3061 (#3150)

Turned out that this causes SelectCoinsMinConf to (unnecessary) lean towards selecting mempool txes which can cause "too long mempool chain" error even when there are more funds to spend.
This commit is contained in:
UdjinM6 2019-10-17 12:36:35 +03:00 committed by Alexander Block
parent c74f2cd8b2
commit 75fddde67f

View File

@ -2677,8 +2677,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
std::sort(vCoins.begin(), vCoins.end(), less_then_denom);
}
int nMaxChainLength = std::min(gArgs.GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT), gArgs.GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT));
// try to find nondenom first to prevent unneeded spending of mixed coins
for (unsigned int tryDenom = tryDenomStart; tryDenom < 2; tryDenom++)
{
@ -2698,7 +2696,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
if (output.nDepth < (pcoin->IsFromMe(ISMINE_ALL) ? nConfMine : nConfTheirs) && !fLockedByIS)
continue;
if (!mempool.TransactionWithinChainLimit(pcoin->GetHash(), fLockedByIS ? nMaxChainLength : nMaxAncestors))
if (!mempool.TransactionWithinChainLimit(pcoin->GetHash(), nMaxAncestors))
continue;
int i = output.i;