Remove member variable hadNoDependencies from CTxMemPoolEntry
Fee estimation can just check its own mapMemPoolTxs to determine the same information. Note that now fee estimation for block processing must happen before those transactions are removed, but this shoudl be a speedup.
This commit is contained in:
@@ -120,7 +120,6 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
|
||||
{
|
||||
CTxMemPool pool(CFeeRate(0));
|
||||
TestMemPoolEntryHelper entry;
|
||||
entry.hadNoDependencies = true;
|
||||
|
||||
/* 3rd highest fee */
|
||||
CMutableTransaction tx1 = CMutableTransaction();
|
||||
@@ -323,7 +322,6 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
|
||||
{
|
||||
CTxMemPool pool(CFeeRate(0));
|
||||
TestMemPoolEntryHelper entry;
|
||||
entry.hadNoDependencies = true;
|
||||
|
||||
/* 3rd highest fee */
|
||||
CMutableTransaction tx1 = CMutableTransaction();
|
||||
|
||||
@@ -147,12 +147,11 @@ CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction &tx, CT
|
||||
}
|
||||
|
||||
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransaction &txn, CTxMemPool *pool) {
|
||||
bool hasNoDependencies = pool ? pool->HasNoInputsOf(txn) : hadNoDependencies;
|
||||
// Hack to assume either its completely dependent on other mempool txs or not at all
|
||||
CAmount inChainValue = hasNoDependencies ? txn.GetValueOut() : 0;
|
||||
CAmount inChainValue = pool && pool->HasNoInputsOf(txn) ? txn.GetValueOut() : 0;
|
||||
|
||||
return CTxMemPoolEntry(MakeTransactionRef(txn), nFee, nTime, dPriority, nHeight,
|
||||
hasNoDependencies, inChainValue, spendsCoinbase, sigOpCost, lp);
|
||||
inChainValue, spendsCoinbase, sigOpCost, lp);
|
||||
}
|
||||
|
||||
void Shutdown(void* parg)
|
||||
|
||||
@@ -70,14 +70,13 @@ struct TestMemPoolEntryHelper
|
||||
int64_t nTime;
|
||||
double dPriority;
|
||||
unsigned int nHeight;
|
||||
bool hadNoDependencies;
|
||||
bool spendsCoinbase;
|
||||
unsigned int sigOpCost;
|
||||
LockPoints lp;
|
||||
|
||||
TestMemPoolEntryHelper() :
|
||||
nFee(0), nTime(0), dPriority(0.0), nHeight(1),
|
||||
hadNoDependencies(false), spendsCoinbase(false), sigOpCost(4) { }
|
||||
spendsCoinbase(false), sigOpCost(4) { }
|
||||
|
||||
CTxMemPoolEntry FromTx(const CMutableTransaction &tx, CTxMemPool *pool = NULL);
|
||||
CTxMemPoolEntry FromTx(const CTransaction &tx, CTxMemPool *pool = NULL);
|
||||
@@ -87,7 +86,6 @@ struct TestMemPoolEntryHelper
|
||||
TestMemPoolEntryHelper &Time(int64_t _time) { nTime = _time; return *this; }
|
||||
TestMemPoolEntryHelper &Priority(double _priority) { dPriority = _priority; return *this; }
|
||||
TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; }
|
||||
TestMemPoolEntryHelper &HadNoDependencies(bool _hnd) { hadNoDependencies = _hnd; return *this; }
|
||||
TestMemPoolEntryHelper &SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
|
||||
TestMemPoolEntryHelper &SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user