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 @@ -603,8 +603,7 @@ tx1.vout.resize(1); tx1.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL; tx1.vout[0].nValue = 10 * COIN; - pool.addUnchecked(tx1.GetId(), - entry.Fee(10000 * SATOSHI).FromTx(tx1, &pool)); + pool.addUnchecked(tx1.GetId(), entry.Fee(10000 * SATOSHI).FromTx(tx1)); CMutableTransaction tx2 = CMutableTransaction(); tx2.vin.resize(1); @@ -612,8 +611,7 @@ tx2.vout.resize(1); tx2.vout[0].scriptPubKey = CScript() << OP_2 << OP_EQUAL; tx2.vout[0].nValue = 10 * COIN; - pool.addUnchecked(tx2.GetId(), - entry.Fee(5000 * SATOSHI).FromTx(tx2, &pool)); + pool.addUnchecked(tx2.GetId(), entry.Fee(5000 * SATOSHI).FromTx(tx2)); // should do nothing pool.TrimToSize(pool.DynamicMemoryUsage()); @@ -625,7 +623,7 @@ BOOST_CHECK(pool.exists(tx1.GetId())); BOOST_CHECK(!pool.exists(tx2.GetId())); - pool.addUnchecked(tx2.GetId(), entry.FromTx(tx2, &pool)); + pool.addUnchecked(tx2.GetId(), entry.FromTx(tx2)); CMutableTransaction tx3 = CMutableTransaction(); tx3.vin.resize(1); tx3.vin[0].prevout = COutPoint(tx2.GetId(), 0); @@ -633,8 +631,7 @@ tx3.vout.resize(1); tx3.vout[0].scriptPubKey = CScript() << OP_3 << OP_EQUAL; tx3.vout[0].nValue = 10 * COIN; - pool.addUnchecked(tx3.GetId(), - entry.Fee(20000 * SATOSHI).FromTx(tx3, &pool)); + pool.addUnchecked(tx3.GetId(), entry.Fee(20000 * SATOSHI).FromTx(tx3)); // tx3 should pay for tx2 (CPFP) pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4); @@ -702,14 +699,10 @@ tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL; tx7.vout[1].nValue = 10 * COIN; - pool.addUnchecked(tx4.GetId(), - entry.Fee(7000 * SATOSHI).FromTx(tx4, &pool)); - pool.addUnchecked(tx5.GetId(), - entry.Fee(1000 * SATOSHI).FromTx(tx5, &pool)); - pool.addUnchecked(tx6.GetId(), - entry.Fee(1100 * SATOSHI).FromTx(tx6, &pool)); - pool.addUnchecked(tx7.GetId(), - entry.Fee(9000 * SATOSHI).FromTx(tx7, &pool)); + pool.addUnchecked(tx4.GetId(), entry.Fee(7000 * SATOSHI).FromTx(tx4)); + pool.addUnchecked(tx5.GetId(), entry.Fee(1000 * SATOSHI).FromTx(tx5)); + pool.addUnchecked(tx6.GetId(), entry.Fee(1100 * SATOSHI).FromTx(tx6)); + pool.addUnchecked(tx7.GetId(), entry.Fee(9000 * SATOSHI).FromTx(tx7)); // we only require this to remove, at max, 2 txn, because it's not clear // what we're really optimizing for aside from that @@ -719,10 +712,8 @@ BOOST_CHECK(!pool.exists(tx7.GetId())); if (!pool.exists(tx5.GetId())) - pool.addUnchecked(tx5.GetId(), - entry.Fee(1000 * SATOSHI).FromTx(tx5, &pool)); - pool.addUnchecked(tx7.GetId(), - entry.Fee(9000 * SATOSHI).FromTx(tx7, &pool)); + pool.addUnchecked(tx5.GetId(), entry.Fee(1000 * SATOSHI).FromTx(tx5)); + pool.addUnchecked(tx7.GetId(), entry.Fee(9000 * SATOSHI).FromTx(tx7)); // should maximize mempool size by only removing 5/7 pool.TrimToSize(pool.DynamicMemoryUsage() / 2); @@ -731,10 +722,8 @@ BOOST_CHECK(pool.exists(tx6.GetId())); BOOST_CHECK(!pool.exists(tx7.GetId())); - pool.addUnchecked(tx5.GetId(), - entry.Fee(1000 * SATOSHI).FromTx(tx5, &pool)); - pool.addUnchecked(tx7.GetId(), - entry.Fee(9000 * SATOSHI).FromTx(tx7, &pool)); + pool.addUnchecked(tx5.GetId(), entry.Fee(1000 * SATOSHI).FromTx(tx5)); + pool.addUnchecked(tx7.GetId(), entry.Fee(9000 * SATOSHI).FromTx(tx7)); std::vector vtx; SetMockTime(42); 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 @@ -47,7 +47,7 @@ txid, entry.Fee((j + 1) * DEFAULT_BLOCK_MIN_TX_FEE_PER_KB) .Time(GetTime()) .Height(blocknum) - .FromTx(tx, &mpool)); + .FromTx(tx)); CTransactionRef ptx = mpool.get(txid); block.push_back(ptx); } @@ -82,7 +82,7 @@ entry.Fee((i + 1) * DEFAULT_BLOCK_MIN_TX_FEE_PER_KB) .Time(GetTime()) .Height(blocknum) - .FromTx(tx, &mpool)); + .FromTx(tx)); } // Trim to size. GetMinFee should be more than 10000 * 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 @@ -129,10 +129,8 @@ TestMemPoolEntryHelper() : nFee(), nTime(0), nHeight(1), spendsCoinbase(false), sigOpCost(4) {} - CTxMemPoolEntry FromTx(const CMutableTransaction &tx, - CTxMemPool *pool = nullptr); - CTxMemPoolEntry FromTx(const CTransactionRef &tx, - CTxMemPool *pool = nullptr); + CTxMemPoolEntry FromTx(const CMutableTransaction &tx); + CTxMemPoolEntry FromTx(const CTransactionRef &tx); // Change the default value TestMemPoolEntryHelper &Fee(Amount _fee) { 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 @@ -202,13 +202,11 @@ TestChain100Setup::~TestChain100Setup() {} -CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction &tx, - CTxMemPool *pool) { - return FromTx(MakeTransactionRef(tx), pool); +CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction &tx) { + return FromTx(MakeTransactionRef(tx)); } -CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef &tx, - CTxMemPool *pool) { +CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef &tx) { return CTxMemPoolEntry(tx, nFee, nTime, nHeight, spendsCoinbase, sigOpCost, lp); }