@ -41,6 +41,12 @@ struct CTxMemPoolModifiedEntry {
nSigOpCostWithAncestors = entry - > GetSigOpCostWithAncestors ( ) ;
nSigOpCostWithAncestors = entry - > GetSigOpCostWithAncestors ( ) ;
}
}
int64_t GetModifiedFee ( ) const { return iter - > GetModifiedFee ( ) ; }
uint64_t GetSizeWithAncestors ( ) const { return nSizeWithAncestors ; }
CAmount GetModFeesWithAncestors ( ) const { return nModFeesWithAncestors ; }
size_t GetTxSize ( ) const { return iter - > GetTxSize ( ) ; }
const CTransaction & GetTx ( ) const { return iter - > GetTx ( ) ; }
CTxMemPool : : txiter iter ;
CTxMemPool : : txiter iter ;
uint64_t nSizeWithAncestors ;
uint64_t nSizeWithAncestors ;
CAmount nModFeesWithAncestors ;
CAmount nModFeesWithAncestors ;
@ -67,21 +73,6 @@ struct modifiedentry_iter {
}
}
} ;
} ;
// This matches the calculation in CompareTxMemPoolEntryByAncestorFee,
// except operating on CTxMemPoolModifiedEntry.
// TODO: refactor to avoid duplication of this logic.
struct CompareModifiedEntry {
bool operator ( ) ( const CTxMemPoolModifiedEntry & a , const CTxMemPoolModifiedEntry & b ) const
{
double f1 = ( double ) a . nModFeesWithAncestors * b . nSizeWithAncestors ;
double f2 = ( double ) b . nModFeesWithAncestors * a . nSizeWithAncestors ;
if ( f1 = = f2 ) {
return CTxMemPool : : CompareIteratorByHash ( ) ( a . iter , b . iter ) ;
}
return f1 > f2 ;
}
} ;
// A comparator that sorts transactions based on number of ancestors.
// A comparator that sorts transactions based on number of ancestors.
// This is sufficient to sort an ancestor package in an order that is valid
// This is sufficient to sort an ancestor package in an order that is valid
// to appear in a block.
// to appear in a block.
@ -106,7 +97,7 @@ typedef boost::multi_index_container<
// Reuse same tag from CTxMemPool's similar index
// Reuse same tag from CTxMemPool's similar index
boost : : multi_index : : tag < ancestor_score > ,
boost : : multi_index : : tag < ancestor_score > ,
boost : : multi_index : : identity < CTxMemPoolModifiedEntry > ,
boost : : multi_index : : identity < CTxMemPoolModifiedEntry > ,
CompareModifiedEntry
CompareTxMemPoolEntryByAncestorFee
>
>
>
>
> indexed_modified_transaction_set ;
> indexed_modified_transaction_set ;