@ -150,16 +150,18 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashes
UpdateForDescendants ( it , mapMemPoolDescendantsToUpdate , setAlreadyIncluded ) ;
}
}
bool CTxMemPool : : CalculateAncestorsAndCheckLimits ( const CTxMemPoolEntry & entry ,
bool CTxMemPool : : CalculateAncestorsAndCheckLimits ( size_t entry_size ,
size_t entry_count ,
setEntries & setAncestors ,
CTxMemPoolEntry : : Parents & staged_ancestors ,
CTxMemPoolEntry : : Parents & staged_ancestors ,
uint64_t limitAncestorCount ,
uint64_t limitAncestorSize ,
uint64_t limitDescendantCount ,
uint64_t limitDescendantSize ,
std : : string & errString ) const
{
size_t totalSizeWithAncestors = entry . GetTxSize ( ) ;
size_t totalSizeWithAncestors = entry _size ;
while ( ! staged_ancestors . empty ( ) ) {
const CTxMemPoolEntry & stage = staged_ancestors . begin ( ) - > get ( ) ;
@ -169,10 +171,10 @@ bool CTxMemPool::CalculateAncestorsAndCheckLimits(const CTxMemPoolEntry& entry,
staged_ancestors . erase ( stage ) ;
totalSizeWithAncestors + = stageit - > GetTxSize ( ) ;
if ( stageit - > GetSizeWithDescendants ( ) + entry . GetTxSize ( ) > limitDescendantSize ) {
if ( stageit - > GetSizeWithDescendants ( ) + entry _size > limitDescendantSize ) {
errString = strprintf ( " exceeds descendant size limit for tx %s [limit: %u] " , stageit - > GetTx ( ) . GetHash ( ) . ToString ( ) , limitDescendantSize ) ;
return false ;
} else if ( stageit - > GetCountWithDescendants ( ) + 1 > limitDescendantCount ) {
} else if ( stageit - > GetCountWithDescendants ( ) + entry_count > limitDescendantCount ) {
errString = strprintf ( " too many descendants for tx %s [limit: %u] " , stageit - > GetTx ( ) . GetHash ( ) . ToString ( ) , limitDescendantCount ) ;
return false ;
} else if ( totalSizeWithAncestors > limitAncestorSize ) {
@ -188,7 +190,7 @@ bool CTxMemPool::CalculateAncestorsAndCheckLimits(const CTxMemPoolEntry& entry,
if ( setAncestors . count ( parent_it ) = = 0 ) {
staged_ancestors . insert ( parent ) ;
}
if ( staged_ancestors . size ( ) + setAncestors . size ( ) + 1 > limitAncestorCount ) {
if ( staged_ancestors . size ( ) + setAncestors . size ( ) + entry_count > limitAncestorCount ) {
errString = strprintf ( " too many unconfirmed ancestors [limit: %u] " , limitAncestorCount ) ;
return false ;
}
@ -231,7 +233,8 @@ bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry,
staged_ancestors = it - > GetMemPoolParentsConst ( ) ;
}
return CalculateAncestorsAndCheckLimits ( entry , setAncestors , staged_ancestors ,
return CalculateAncestorsAndCheckLimits ( entry . GetTxSize ( ) , /* entry_count */ 1 ,
setAncestors , staged_ancestors ,
limitAncestorCount , limitAncestorSize ,
limitDescendantCount , limitDescendantSize , errString ) ;
}