@@ -116,19 +116,19 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
116116 tx.vout [0 ].nValue = 5000000000LL - 1000 ;
117117 // This tx has a low fee: 1000 satoshis
118118 uint256 hashParentTx = tx.GetHash (); // save this txid for later use
119- tx_mempool.addUnchecked (entry.Fee (1000 ).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
119+ tx_mempool.addUnchecked (entry.Fee (1000 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
120120
121121 // This tx has a medium fee: 10000 satoshis
122122 tx.vin [0 ].prevout .hash = txFirst[1 ]->GetHash ();
123123 tx.vout [0 ].nValue = 5000000000LL - 10000 ;
124124 uint256 hashMediumFeeTx = tx.GetHash ();
125- tx_mempool.addUnchecked (entry.Fee (10000 ).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
125+ tx_mempool.addUnchecked (entry.Fee (10000 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
126126
127127 // This tx has a high fee, but depends on the first transaction
128128 tx.vin [0 ].prevout .hash = hashParentTx;
129129 tx.vout [0 ].nValue = 5000000000LL - 1000 - 50000 ; // 50k satoshi fee
130130 uint256 hashHighFeeTx = tx.GetHash ();
131- tx_mempool.addUnchecked (entry.Fee (50000 ).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
131+ tx_mempool.addUnchecked (entry.Fee (50000 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (false ).FromTx (tx));
132132
133133 std::unique_ptr<CBlockTemplate> pblocktemplate = AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey);
134134 BOOST_REQUIRE_EQUAL (pblocktemplate->block .vtx .size (), 4U );
@@ -239,7 +239,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
239239 hash = tx.GetHash ();
240240 bool spendsCoinbase = i == 0 ; // only first tx spends coinbase
241241 // If we don't set the # of sig ops in the CTxMemPoolEntry, template creation fails
242- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (spendsCoinbase).FromTx (tx));
242+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (spendsCoinbase).FromTx (tx));
243243 tx.vin [0 ].prevout .hash = hash;
244244 }
245245
@@ -257,7 +257,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
257257 hash = tx.GetHash ();
258258 bool spendsCoinbase = i == 0 ; // only first tx spends coinbase
259259 // If we do set the # of sig ops in the CTxMemPoolEntry, template creation passes
260- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (spendsCoinbase).SigOpsCost (80 ).FromTx (tx));
260+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (spendsCoinbase).SigOpsCost (80 ).FromTx (tx));
261261 tx.vin [0 ].prevout .hash = hash;
262262 }
263263 BOOST_CHECK (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey));
@@ -281,7 +281,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
281281 tx.vout [0 ].nValue -= LOWFEE;
282282 hash = tx.GetHash ();
283283 bool spendsCoinbase = i == 0 ; // only first tx spends coinbase
284- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (spendsCoinbase).FromTx (tx));
284+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (spendsCoinbase).FromTx (tx));
285285 tx.vin [0 ].prevout .hash = hash;
286286 }
287287 BOOST_CHECK (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey));
@@ -293,7 +293,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
293293
294294 // orphan in tx_mempool, template creation fails
295295 hash = tx.GetHash ();
296- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).FromTx (tx));
296+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).FromTx (tx));
297297 BOOST_CHECK_EXCEPTION (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-txns-inputs-missingorspent" ));
298298 }
299299
@@ -306,15 +306,15 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
306306 tx.vin [0 ].prevout .hash = txFirst[1 ]->GetHash ();
307307 tx.vout [0 ].nValue = BLOCKSUBSIDY - HIGHFEE;
308308 hash = tx.GetHash ();
309- tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
309+ tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
310310 tx.vin [0 ].prevout .hash = hash;
311311 tx.vin .resize (2 );
312312 tx.vin [1 ].scriptSig = CScript () << OP_1;
313313 tx.vin [1 ].prevout .hash = txFirst[0 ]->GetHash ();
314314 tx.vin [1 ].prevout .n = 0 ;
315315 tx.vout [0 ].nValue = tx.vout [0 ].nValue + BLOCKSUBSIDY - HIGHERFEE; // First txn output + fresh coinbase - new txn fee
316316 hash = tx.GetHash ();
317- tx_mempool.addUnchecked (entry.Fee (HIGHERFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
317+ tx_mempool.addUnchecked (entry.Fee (HIGHERFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
318318 BOOST_CHECK (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey));
319319 }
320320
@@ -329,7 +329,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
329329 tx.vout [0 ].nValue = 0 ;
330330 hash = tx.GetHash ();
331331 // give it a fee so it'll get mined
332- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
332+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (false ).FromTx (tx));
333333 // Should throw bad-cb-multiple
334334 BOOST_CHECK_EXCEPTION (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-cb-multiple" ));
335335 }
@@ -344,10 +344,10 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
344344 tx.vout [0 ].nValue = BLOCKSUBSIDY - HIGHFEE;
345345 tx.vout [0 ].scriptPubKey = CScript () << OP_1;
346346 hash = tx.GetHash ();
347- tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
347+ tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
348348 tx.vout [0 ].scriptPubKey = CScript () << OP_2;
349349 hash = tx.GetHash ();
350- tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
350+ tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
351351 BOOST_CHECK_EXCEPTION (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" bad-txns-inputs-missingorspent" ));
352352 }
353353
@@ -390,12 +390,12 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
390390 CScript script = CScript () << OP_0;
391391 tx.vout [0 ].scriptPubKey = GetScriptForDestination (ScriptHash (script));
392392 hash = tx.GetHash ();
393- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
393+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
394394 tx.vin [0 ].prevout .hash = hash;
395395 tx.vin [0 ].scriptSig = CScript () << std::vector<unsigned char >(script.begin (), script.end ());
396396 tx.vout [0 ].nValue -= LOWFEE;
397397 hash = tx.GetHash ();
398- tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
398+ tx_mempool.addUnchecked (entry.Fee (LOWFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (false ).FromTx (tx));
399399 // Should throw block-validation-failed
400400 BOOST_CHECK_EXCEPTION (AssemblerForTest (tx_mempool).CreateNewBlock (scriptPubKey), std::runtime_error, HasReason (" block-validation-failed" ));
401401
@@ -432,7 +432,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
432432 tx.vout [0 ].scriptPubKey = CScript () << OP_1;
433433 tx.nLockTime = 0 ;
434434 hash = tx.GetHash ();
435- tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
435+ tx_mempool.addUnchecked (entry.Fee (HIGHFEE).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
436436 BOOST_CHECK (CheckFinalTxAtTip (*Assert (m_node.chainman ->ActiveChain ().Tip ()), CTransaction{tx})); // Locktime passes
437437 BOOST_CHECK (!TestSequenceLocks (CTransaction{tx}, tx_mempool)); // Sequence locks fail
438438
@@ -446,7 +446,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
446446 tx.vin [0 ].nSequence = CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG | (((m_node.chainman ->ActiveChain ().Tip ()->GetMedianTimePast ()+1 -m_node.chainman ->ActiveChain ()[1 ]->GetMedianTimePast ()) >> CTxIn::SEQUENCE_LOCKTIME_GRANULARITY) + 1 ); // txFirst[1] is the 3rd block
447447 prevheights[0 ] = baseheight + 2 ;
448448 hash = tx.GetHash ();
449- tx_mempool.addUnchecked (entry.Time (GetTime ()).FromTx (tx));
449+ tx_mempool.addUnchecked (entry.Time (Now<NodeSeconds> ()).FromTx (tx));
450450 BOOST_CHECK (CheckFinalTxAtTip (*Assert (m_node.chainman ->ActiveChain ().Tip ()), CTransaction{tx})); // Locktime passes
451451 BOOST_CHECK (!TestSequenceLocks (CTransaction{tx}, tx_mempool)); // Sequence locks fail
452452
@@ -469,7 +469,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
469469 prevheights[0 ] = baseheight + 3 ;
470470 tx.nLockTime = m_node.chainman ->ActiveChain ().Tip ()->nHeight + 1 ;
471471 hash = tx.GetHash ();
472- tx_mempool.addUnchecked (entry.Time (GetTime ()).FromTx (tx));
472+ tx_mempool.addUnchecked (entry.Time (Now<NodeSeconds> ()).FromTx (tx));
473473 BOOST_CHECK (!CheckFinalTxAtTip (*Assert (m_node.chainman ->ActiveChain ().Tip ()), CTransaction{tx})); // Locktime fails
474474 BOOST_CHECK (TestSequenceLocks (CTransaction{tx}, tx_mempool)); // Sequence locks pass
475475 BOOST_CHECK (IsFinalTx (CTransaction (tx), m_node.chainman ->ActiveChain ().Tip ()->nHeight + 2 , m_node.chainman ->ActiveChain ().Tip ()->GetMedianTimePast ())); // Locktime passes on 2nd block
@@ -480,7 +480,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
480480 prevheights.resize (1 );
481481 prevheights[0 ] = baseheight + 4 ;
482482 hash = tx.GetHash ();
483- tx_mempool.addUnchecked (entry.Time (GetTime ()).FromTx (tx));
483+ tx_mempool.addUnchecked (entry.Time (Now<NodeSeconds> ()).FromTx (tx));
484484 BOOST_CHECK (!CheckFinalTxAtTip (*Assert (m_node.chainman ->ActiveChain ().Tip ()), CTransaction{tx})); // Locktime fails
485485 BOOST_CHECK (TestSequenceLocks (CTransaction{tx}, tx_mempool)); // Sequence locks pass
486486 BOOST_CHECK (IsFinalTx (CTransaction (tx), m_node.chainman ->ActiveChain ().Tip ()->nHeight + 2 , m_node.chainman ->ActiveChain ().Tip ()->GetMedianTimePast () + 1 )); // Locktime passes 1 second later
@@ -535,28 +535,28 @@ void MinerTestingSetup::TestPrioritisedMining(const CScript& scriptPubKey, const
535535 tx.vout .resize (1 );
536536 tx.vout [0 ].nValue = 5000000000LL ; // 0 fee
537537 uint256 hashFreePrioritisedTx = tx.GetHash ();
538- tx_mempool.addUnchecked (entry.Fee (0 ).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
538+ tx_mempool.addUnchecked (entry.Fee (0 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
539539 tx_mempool.PrioritiseTransaction (hashFreePrioritisedTx, 5 * COIN);
540540
541541 tx.vin [0 ].prevout .hash = txFirst[1 ]->GetHash ();
542542 tx.vin [0 ].prevout .n = 0 ;
543543 tx.vout [0 ].nValue = 5000000000LL - 1000 ;
544544 // This tx has a low fee: 1000 satoshis
545545 uint256 hashParentTx = tx.GetHash (); // save this txid for later use
546- tx_mempool.addUnchecked (entry.Fee (1000 ).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
546+ tx_mempool.addUnchecked (entry.Fee (1000 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
547547
548548 // This tx has a medium fee: 10000 satoshis
549549 tx.vin [0 ].prevout .hash = txFirst[2 ]->GetHash ();
550550 tx.vout [0 ].nValue = 5000000000LL - 10000 ;
551551 uint256 hashMediumFeeTx = tx.GetHash ();
552- tx_mempool.addUnchecked (entry.Fee (10000 ).Time (GetTime ()).SpendsCoinbase (true ).FromTx (tx));
552+ tx_mempool.addUnchecked (entry.Fee (10000 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (true ).FromTx (tx));
553553 tx_mempool.PrioritiseTransaction (hashMediumFeeTx, -5 * COIN);
554554
555555 // This tx also has a low fee, but is prioritised
556556 tx.vin [0 ].prevout .hash = hashParentTx;
557557 tx.vout [0 ].nValue = 5000000000LL - 1000 - 1000 ; // 1000 satoshi fee
558558 uint256 hashPrioritsedChild = tx.GetHash ();
559- tx_mempool.addUnchecked (entry.Fee (1000 ).Time (GetTime ()).SpendsCoinbase (false ).FromTx (tx));
559+ tx_mempool.addUnchecked (entry.Fee (1000 ).Time (Now<NodeSeconds> ()).SpendsCoinbase (false ).FromTx (tx));
560560 tx_mempool.PrioritiseTransaction (hashPrioritsedChild, 2 * COIN);
561561
562562 // Test that transaction selection properly updates ancestor fee calculations as prioritised
0 commit comments