Skip to content

Commit 99ad6fd

Browse files
authored
Merge pull request zcash#6964 from daira/mining-test-comment-offbyone
Miner tests: correct a comment, and add another similar comment where it applies
2 parents 7fbb055 + 7505afc commit 99ad6fd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/miner_tests.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff 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));

0 commit comments

Comments
 (0)