aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-12-20 13:12:46 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-12-20 13:27:08 +0100
commit5a70572049d0e8a2e9228e7acf0e07d61996c33c (patch)
tree22e61f23acd63b9ed6d304f1e999c2cc26e63397 /src/txmempool.cpp
parent3097ea40d7195267bc1e525eb1707d4b8d7304a2 (diff)
parentcee16123f550f6baad0205f776831f39d026758b (diff)
downloadbitcoin-5a70572049d0e8a2e9228e7acf0e07d61996c33c.tar.xz
Merge #9262: Prefer coins that have fewer ancestors, sanity check txn before ATMP
cee1612 reduce number of lookups in TransactionWithinChainLimit (Gregory Sanders) af9bedb Test for fix of txn chaining in wallet (Gregory Sanders) 5882c09 CreateTransaction: Don't return success with too-many-ancestor txn (Gregory Sanders) 0b2294a SelectCoinsMinConf: Prefer coins with fewer ancestors (Gregory Sanders)
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 4334ebde6d..c3da69c3f0 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -1137,3 +1137,10 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<uint256>* pvNoSpendsRe
if (maxFeeRateRemoved > CFeeRate(0))
LogPrint("mempool", "Removed %u txn, rolling minimum fee bumped to %s\n", nTxnRemoved, maxFeeRateRemoved.ToString());
}
+
+bool CTxMemPool::TransactionWithinChainLimit(const uint256& txid, size_t chainLimit) const {
+ LOCK(cs);
+ auto it = mapTx.find(txid);
+ return it == mapTx.end() || (it->GetCountWithAncestors() < chainLimit &&
+ it->GetCountWithDescendants() < chainLimit);
+}