diff options
author | Gregory Sanders <gsanders87@gmail.com> | 2016-12-02 15:45:43 -0500 |
---|---|---|
committer | BtcDrak <btcdrak@gmail.com> | 2016-12-20 10:10:19 +0000 |
commit | f00066ac513774ba7fcad9e2054b209ffb2c23e8 (patch) | |
tree | 1b50160489d737ea72f9c51b6378742f86d96304 /src | |
parent | bdd6d4c97df2052fe160f12ac507ec5946f91a07 (diff) | |
download | bitcoin-f00066ac513774ba7fcad9e2054b209ffb2c23e8.tar.xz |
CreateTransaction: Don't return success with too-many-ancestor txn
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1a33744ce9..7bcb9aaf11 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2452,6 +2452,21 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt } } + if (GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS)) { + // Lastly, ensure this tx will pass the mempool's chain limits + LockPoints lp; + CTxMemPoolEntry entry(txNew, 0, 0, 0, 0, false, 0, false, 0, lp); + CTxMemPool::setEntries setAncestors; + size_t nLimitAncestors = GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT); + size_t nLimitAncestorSize = GetArg("-limitancestorsize", DEFAULT_ANCESTOR_SIZE_LIMIT)*1000; + size_t nLimitDescendants = GetArg("-limitdescendantcount", DEFAULT_DESCENDANT_LIMIT); + size_t nLimitDescendantSize = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT)*1000; + std::string errString; + if (!mempool.CalculateMemPoolAncestors(entry, setAncestors, nLimitAncestors, nLimitAncestorSize, nLimitDescendants, nLimitDescendantSize, errString)) { + strFailReason = _("Transaction has too long of a mempool chain"); + return false; + } + } return true; } |