diff options
| author | Gregory Sanders <[email protected]> | 2016-12-19 09:35:23 -0500 |
|---|---|---|
| committer | Gregory Sanders <[email protected]> | 2016-12-19 20:51:34 -0500 |
| commit | cee16123f550f6baad0205f776831f39d026758b (patch) | |
| tree | 295fd9d92ba7d3cade9d16c7fb9ef16fc0dafd08 /src/txmempool.cpp | |
| parent | Test for fix of txn chaining in wallet (diff) | |
| download | discoin-cee16123f550f6baad0205f776831f39d026758b.tar.xz discoin-cee16123f550f6baad0205f776831f39d026758b.zip | |
reduce number of lookups in TransactionWithinChainLimit
Diffstat (limited to 'src/txmempool.cpp')
| -rw-r--r-- | src/txmempool.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index f87713006..f11a36fd4 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1145,7 +1145,7 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<uint256>* pvNoSpendsRe 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; + auto it = mapTx.find(txid); + return it == mapTx.end() || (it->GetCountWithAncestors() < chainLimit && + it->GetCountWithDescendants() < chainLimit); } |