mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-09-06 20:02:31 +00:00
reduce number of lookups in TransactionWithinChainLimit
This commit is contained in:
parent
4bf2bec18e
commit
e1ff0dbe19
@ -1137,7 +1137,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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user