BlockChainTest, ExponentialBackoffTest, BasicKeyChainTest: Use no-args Utils.setMockClock() where possible

Replace a few calls to:

Utils.setMockClock(Utils.setCurrentTimeSeconds())

with

Utils.setMockClock()

The behavior of the first is slightly different
and possibly pathological, and I believe that in
all three cases in this PR, it is the later behavior
that is intended.
This commit is contained in:
Sean Gilligan 2021-09-08 08:21:51 -07:00 committed by Andreas Schildbach
parent 185f880e78
commit 212ac5b95f
3 changed files with 3 additions and 3 deletions

View File

@ -158,7 +158,7 @@ public class BlockChainTest {
// Add a bunch of blocks in a loop until we reach a difficulty transition point. The unit test params have an
// artificially shortened period.
Block prev = UNITTEST.getGenesisBlock();
Utils.setMockClock(Utils.currentTimeSeconds());
Utils.setMockClock();
for (int height = 0; height < UNITTEST.getInterval() - 1; height++) {
Block newBlock = prev.createNextBlock(coinbaseTo, 1, Utils.currentTimeSeconds(), height);
assertTrue(chain.add(newBlock));

View File

@ -31,7 +31,7 @@ public class ExponentialBackoffTest {
@Before
public void setUp() {
Utils.setMockClock(Utils.currentTimeSeconds());
Utils.setMockClock();
params = new ExponentialBackoff.Params();
backoff = new ExponentialBackoff(params);
}

View File

@ -63,8 +63,8 @@ public class BasicKeyChainTest {
@Test
public void importKeys() {
Utils.setMockClock();
long now = Utils.currentTimeSeconds();
Utils.setMockClock(now);
final ECKey key1 = new ECKey();
Utils.rollMockClock(86400);
final ECKey key2 = new ECKey();