|
|
@ -160,7 +160,7 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashes |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents /* = true */) |
|
|
|
bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents /* = true */) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
setEntries parentHashes; |
|
|
|
setEntries parentHashes; |
|
|
|
const CTransaction &tx = entry.GetTx(); |
|
|
|
const CTransaction &tx = entry.GetTx(); |
|
|
@ -666,10 +666,27 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
assert(setParentCheck == GetMemPoolParents(it)); |
|
|
|
assert(setParentCheck == GetMemPoolParents(it)); |
|
|
|
// Also check to make sure ancestor size/sigops are >= sum with immediate
|
|
|
|
// Verify ancestor state is correct.
|
|
|
|
// parents.
|
|
|
|
setEntries setAncestors; |
|
|
|
assert(it->GetSizeWithAncestors() >= parentSizes + it->GetTxSize()); |
|
|
|
uint64_t nNoLimit = std::numeric_limits<uint64_t>::max(); |
|
|
|
assert(it->GetSigOpCountWithAncestors() >= parentSigOpCount + it->GetSigOpCount()); |
|
|
|
std::string dummy; |
|
|
|
|
|
|
|
CalculateMemPoolAncestors(*it, setAncestors, nNoLimit, nNoLimit, nNoLimit, nNoLimit, dummy); |
|
|
|
|
|
|
|
uint64_t nCountCheck = setAncestors.size() + 1; |
|
|
|
|
|
|
|
uint64_t nSizeCheck = it->GetTxSize(); |
|
|
|
|
|
|
|
CAmount nFeesCheck = it->GetModifiedFee(); |
|
|
|
|
|
|
|
unsigned int nSigOpCheck = it->GetSigOpCount(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_FOREACH(txiter ancestorIt, setAncestors) { |
|
|
|
|
|
|
|
nSizeCheck += ancestorIt->GetTxSize(); |
|
|
|
|
|
|
|
nFeesCheck += ancestorIt->GetModifiedFee(); |
|
|
|
|
|
|
|
nSigOpCheck += ancestorIt->GetSigOpCount(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert(it->GetCountWithAncestors() == nCountCheck); |
|
|
|
|
|
|
|
assert(it->GetSizeWithAncestors() == nSizeCheck); |
|
|
|
|
|
|
|
assert(it->GetSigOpCountWithAncestors() == nSigOpCheck); |
|
|
|
|
|
|
|
assert(it->GetModFeesWithAncestors() == nFeesCheck); |
|
|
|
|
|
|
|
|
|
|
|
// Check children against mapNextTx
|
|
|
|
// Check children against mapNextTx
|
|
|
|
CTxMemPool::setEntries setChildrenCheck; |
|
|
|
CTxMemPool::setEntries setChildrenCheck; |
|
|
|
std::map<COutPoint, CInPoint>::const_iterator iter = mapNextTx.lower_bound(COutPoint(it->GetTx().GetHash(), 0)); |
|
|
|
std::map<COutPoint, CInPoint>::const_iterator iter = mapNextTx.lower_bound(COutPoint(it->GetTx().GetHash(), 0)); |
|
|
|