aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorGregory Sanders <[email protected]>2016-12-02 15:29:20 -0500
committerGregory Sanders <[email protected]>2016-12-13 09:41:04 -0500
commit0b2294a980319cbffa8612ce993e0ecaa26fa509 (patch)
tree82322585413c329bb052fd10715251d2935dec37 /src/txmempool.cpp
parentMerge #9183: Final Preparation for main.cpp Split (diff)
downloaddiscoin-0b2294a980319cbffa8612ce993e0ecaa26fa509.tar.xz
discoin-0b2294a980319cbffa8612ce993e0ecaa26fa509.zip
SelectCoinsMinConf: Prefer coins with fewer ancestors
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 417a88cbe..f87713006 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -1142,3 +1142,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);
+ if (exists(txid) && std::max(mapTx.find(txid)->GetCountWithAncestors(), mapTx.find(txid)->GetCountWithDescendants()) >= chainLimit)
+ return false;
+ return true;
+}