File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -375,8 +375,9 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
375375 auto nTime = pblocktemplate->block.nTime;
376376 delete pblocktemplate;
377377
378- // Set the clock to be just ahead of the last "mined" block, to ensure we satisfy the
379- // future timestamp soft fork rule.
378+ // Set the clock to the timestamp of the last "mined" block, to ensure we satisfy the
379+ // future timestamp soft fork rule. We use a fixed clock here because the time should
380+ // not advance from `nTime` for the calls to `CreateNewBlock`.
380381 FixedClock::SetGlobal();
381382 FixedClock::Instance()->Set(std::chrono::seconds(nTime));
382383
@@ -406,6 +407,9 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
406407 BOOST_CHECK_EQUAL(pblocktemplate->block.nTime, minTime);
407408 delete pblocktemplate;
408409
410+ // Set the clock back to the timestamp of the last "mined" block (and allow it to advance
411+ // from that point), to ensure we satisfy both the rule that it is after the MTP, and the
412+ // future timestamp soft fork rule.
409413 auto curTime = GetTime();
410414 OffsetClock::SetGlobal();
411415 OffsetClock::Instance()->Set(std::chrono::seconds(-curTime + nTime));
You can’t perform that action at this time.
0 commit comments