diff --git a/src/bench/mempool_eviction.cpp b/src/bench/mempool_eviction.cpp --- a/src/bench/mempool_eviction.cpp +++ b/src/bench/mempool_eviction.cpp @@ -12,14 +12,12 @@ static void AddTx(const CTransactionRef &tx, const Amount &nFee, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs) { int64_t nTime = 0; - double dPriority = 10.0; unsigned int nHeight = 1; bool spendsCoinbase = false; unsigned int sigOpCost = 4; LockPoints lp; pool.addUnchecked(tx->GetId(), - CTxMemPoolEntry(tx, nFee, nTime, dPriority, nHeight, - tx->GetValueOut(), spendsCoinbase, + CTxMemPoolEntry(tx, nFee, nTime, nHeight, spendsCoinbase, sigOpCost, lp)); } diff --git a/src/bench/rpc_mempool.cpp b/src/bench/rpc_mempool.cpp --- a/src/bench/rpc_mempool.cpp +++ b/src/bench/rpc_mempool.cpp @@ -15,11 +15,10 @@ static void AddTx(const CTransactionRef &tx, const Amount &fee, CTxMemPool &pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs) { LockPoints lp; - pool.addUnchecked(tx->GetId(), - CTxMemPoolEntry(tx, fee, /* time */ 0, /*priority*/ 10.0, - /* height */ 1, tx->GetValueOut(), - /* spendsCoinbase */ false, - /* sigOpCost */ 4, lp)); + pool.addUnchecked(tx->GetId(), CTxMemPoolEntry(tx, fee, /* time */ 0, + /* height */ 1, + /* spendsCoinbase */ false, + /* sigOpCost */ 4, lp)); } static void RpcMempool(benchmark::State &state) { diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp --- a/src/test/mempool_tests.cpp +++ b/src/test/mempool_tests.cpp @@ -279,32 +279,28 @@ tx1.vout.resize(1); tx1.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx1.vout[0].nValue = 10 * COIN; - pool.addUnchecked(tx1.GetId(), - entry.Fee(10000 * SATOSHI).Priority(10.0).FromTx(tx1)); + pool.addUnchecked(tx1.GetId(), entry.Fee(10000 * SATOSHI).FromTx(tx1)); /* highest fee */ CMutableTransaction tx2 = CMutableTransaction(); tx2.vout.resize(1); tx2.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx2.vout[0].nValue = 2 * COIN; - pool.addUnchecked(tx2.GetId(), - entry.Fee(20000 * SATOSHI).Priority(9.0).FromTx(tx2)); + pool.addUnchecked(tx2.GetId(), entry.Fee(20000 * SATOSHI).FromTx(tx2)); /* lowest fee */ CMutableTransaction tx3 = CMutableTransaction(); tx3.vout.resize(1); tx3.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx3.vout[0].nValue = 5 * COIN; - pool.addUnchecked(tx3.GetId(), - entry.Fee(Amount::zero()).Priority(100.0).FromTx(tx3)); + pool.addUnchecked(tx3.GetId(), entry.Fee(Amount::zero()).FromTx(tx3)); /* 2nd highest fee */ CMutableTransaction tx4 = CMutableTransaction(); tx4.vout.resize(1); tx4.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx4.vout[0].nValue = 6 * COIN; - pool.addUnchecked(tx4.GetId(), - entry.Fee(15000 * SATOSHI).Priority(1.0).FromTx(tx4)); + pool.addUnchecked(tx4.GetId(), entry.Fee(15000 * SATOSHI).FromTx(tx4)); /* equal fee rate to tx1, but newer */ CMutableTransaction tx5 = CMutableTransaction(); @@ -312,7 +308,6 @@ tx5.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx5.vout[0].nValue = 11 * COIN; entry.nTime = 1; - entry.dPriority = 10.0; pool.addUnchecked(tx5.GetId(), entry.Fee(10000 * SATOSHI).FromTx(tx5)); BOOST_CHECK_EQUAL(pool.size(), 5UL); @@ -470,16 +465,14 @@ tx1.vout.resize(1); tx1.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx1.vout[0].nValue = 10 * COIN; - pool.addUnchecked(tx1.GetId(), - entry.Fee(10000 * SATOSHI).Priority(10.0).FromTx(tx1)); + pool.addUnchecked(tx1.GetId(), entry.Fee(10000 * SATOSHI).FromTx(tx1)); /* highest fee */ CMutableTransaction tx2 = CMutableTransaction(); tx2.vout.resize(1); tx2.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx2.vout[0].nValue = 2 * COIN; - pool.addUnchecked(tx2.GetId(), - entry.Fee(20000 * SATOSHI).Priority(9.0).FromTx(tx2)); + pool.addUnchecked(tx2.GetId(), entry.Fee(20000 * SATOSHI).FromTx(tx2)); uint64_t tx2Size = CTransaction(tx2).GetTotalSize(); /* lowest fee */ @@ -487,16 +480,14 @@ tx3.vout.resize(1); tx3.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx3.vout[0].nValue = 5 * COIN; - pool.addUnchecked(tx3.GetId(), - entry.Fee(Amount::zero()).Priority(100.0).FromTx(tx3)); + pool.addUnchecked(tx3.GetId(), entry.Fee(Amount::zero()).FromTx(tx3)); /* 2nd highest fee */ CMutableTransaction tx4 = CMutableTransaction(); tx4.vout.resize(1); tx4.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx4.vout[0].nValue = 6 * COIN; - pool.addUnchecked(tx4.GetId(), - entry.Fee(15000 * SATOSHI).Priority(1.0).FromTx(tx4)); + pool.addUnchecked(tx4.GetId(), entry.Fee(15000 * SATOSHI).FromTx(tx4)); /* equal fee rate to tx1, but newer */ CMutableTransaction tx5 = CMutableTransaction(); @@ -604,7 +595,6 @@ CTxMemPool pool; LOCK2(cs_main, pool.cs); TestMemPoolEntryHelper entry; - entry.dPriority = 10.0; Amount feeIncrement = MEMPOOL_FULL_FEE_INCREMENT.GetFeePerK(); CMutableTransaction tx1 = CMutableTransaction(); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -278,7 +278,6 @@ CScript script; TestMemPoolEntryHelper entry; entry.nFee = 11 * SATOSHI; - entry.dPriority = 111.0; entry.nHeight = 11; fCheckpointsEnabled = false; diff --git a/src/test/policyestimator_tests.cpp b/src/test/policyestimator_tests.cpp --- a/src/test/policyestimator_tests.cpp +++ b/src/test/policyestimator_tests.cpp @@ -46,7 +46,6 @@ mpool.addUnchecked( txid, entry.Fee((j + 1) * DEFAULT_BLOCK_MIN_TX_FEE_PER_KB) .Time(GetTime()) - .Priority(0) .Height(blocknum) .FromTx(tx, &mpool)); CTransactionRef ptx = mpool.get(txid); @@ -82,7 +81,6 @@ mpool.addUnchecked(tx.GetId(), entry.Fee((i + 1) * DEFAULT_BLOCK_MIN_TX_FEE_PER_KB) .Time(GetTime()) - .Priority(0) .Height(blocknum) .FromTx(tx, &mpool)); } diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h --- a/src/test/test_bitcoin.h +++ b/src/test/test_bitcoin.h @@ -121,15 +121,13 @@ // Default values Amount nFee; int64_t nTime; - double dPriority; unsigned int nHeight; bool spendsCoinbase; unsigned int sigOpCost; LockPoints lp; TestMemPoolEntryHelper() - : nFee(), nTime(0), dPriority(0.0), nHeight(1), spendsCoinbase(false), - sigOpCost(4) {} + : nFee(), nTime(0), nHeight(1), spendsCoinbase(false), sigOpCost(4) {} CTxMemPoolEntry FromTx(const CMutableTransaction &tx, CTxMemPool *pool = nullptr); @@ -145,10 +143,6 @@ nTime = _time; return *this; } - TestMemPoolEntryHelper &Priority(double _priority) { - dPriority = _priority; - return *this; - } TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -203,13 +203,8 @@ CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef &tx, CTxMemPool *pool) { - // Hack to assume either it's completely dependent on other mempool txs or - // not at all. - Amount inChainValue = - pool && pool->HasNoInputsOf(*tx) ? tx->GetValueOut() : Amount::zero(); - - return CTxMemPoolEntry(tx, nFee, nTime, dPriority, nHeight, inChainValue, - spendsCoinbase, sigOpCost, lp); + return CTxMemPoolEntry(tx, nFee, nTime, nHeight, spendsCoinbase, sigOpCost, + lp); } /** diff --git a/src/txmempool.h b/src/txmempool.h --- a/src/txmempool.h +++ b/src/txmempool.h @@ -77,12 +77,8 @@ size_t nUsageSize; //!< Local time when entering the mempool int64_t nTime; - //!< Priority when entering the mempool - double entryPriority; //!< Chain height when entering the mempool unsigned int entryHeight; - //!< Sum of all txin values that are already in blockchain - Amount inChainInputValue; //!< keep track of transactions that spend a coinbase bool spendsCoinbase; //!< Total sigop plus P2SH sigops count @@ -112,8 +108,7 @@ public: CTxMemPoolEntry(const CTransactionRef &_tx, const Amount _nFee, - int64_t _nTime, double _entryPriority, - unsigned int _entryHeight, Amount _inChainInputValue, + int64_t _nTime, unsigned int _entryHeight, bool spendsCoinbase, int64_t nSigOpsCost, LockPoints lp); const CTransaction &GetTx() const { return *this->tx; } @@ -846,8 +841,8 @@ * have all inputs "available" to check signatures, and any cycles in the * dependency graph are checked directly in AcceptToMemoryPool. * It also allows you to sign a double-spend directly in - * signrawtransactionwithkey and signrawtransactionwithwallet, as long as the - * conflicting transaction is not yet confirmed. + * signrawtransactionwithkey and signrawtransactionwithwallet, + * as long as the conflicting transaction is not yet confirmed. */ class CCoinsViewMemPool : public CCoinsViewBacked { protected: diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -26,13 +26,10 @@ #include CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef &_tx, const Amount _nFee, - int64_t _nTime, double _entryPriority, - unsigned int _entryHeight, - Amount _inChainInputValue, + int64_t _nTime, unsigned int _entryHeight, bool _spendsCoinbase, int64_t _sigOpsCount, LockPoints lp) - : tx(_tx), nFee(_nFee), nTime(_nTime), entryPriority(_entryPriority), - entryHeight(_entryHeight), inChainInputValue(_inChainInputValue), + : tx(_tx), nFee(_nFee), nTime(_nTime), entryHeight(_entryHeight), spendsCoinbase(_spendsCoinbase), sigOpCount(_sigOpsCount), lockPoints(lp) { nTxSize = tx->GetTotalSize(); @@ -42,8 +39,6 @@ nCountWithDescendants = 1; nSizeWithDescendants = GetTxSize(); nModFeesWithDescendants = nFee; - Amount nValueIn = tx->GetValueOut() + nFee; - assert(inChainInputValue <= nValueIn); feeDelta = Amount::zero(); diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -671,10 +671,6 @@ double nPriorityDummy = 0; pool.ApplyDeltas(txid, nPriorityDummy, nModifiedFees); - Amount inChainInputValue; - double dPriority = - view.GetPriority(tx, chainActive.Height(), inChainInputValue); - // Keep track of transactions that spend a coinbase, which we re-scan // during reorgs to ensure COINBASE_MATURITY is still met. bool fSpendsCoinbase = false; @@ -686,8 +682,7 @@ } } - CTxMemPoolEntry entry(ptx, nFees, nAcceptTime, dPriority, - chainActive.Height(), inChainInputValue, + CTxMemPoolEntry entry(ptx, nFees, nAcceptTime, chainActive.Height(), fSpendsCoinbase, nSigOpsCount, lp); unsigned int nSize = entry.GetTxSize(); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3296,8 +3296,7 @@ DEFAULT_WALLET_REJECT_LONG_CHAINS)) { // Lastly, ensure this tx will pass the mempool's chain limits. LockPoints lp; - CTxMemPoolEntry entry(tx, Amount::zero(), 0, 0, 0, Amount::zero(), - false, 0, lp); + CTxMemPoolEntry entry(tx, Amount::zero(), 0, 0, false, 0, lp); CTxMemPool::setEntries setAncestors; size_t nLimitAncestors = gArgs.GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT);