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 GitHub
parent 4b6af8f2c1
commit e9ed354822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2961,8 +2961,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++)
{
@ -2982,7 +2980,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;