mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-19 05:33:44 +01:00
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:
parent
185f880e78
commit
212ac5b95f
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user