mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 07:12:17 +00:00
Use current time as unit test chain genesis block time. Resolves a weird issue where the unit tests suddenly broke as the previous unit test genesis time was equal to testnet genesis time.
This commit is contained in:
parent
38aabdfa24
commit
8162aa0ed1
@ -200,8 +200,9 @@ public class NetworkParameters implements Serializable {
|
|||||||
NetworkParameters n = new NetworkParameters();
|
NetworkParameters n = new NetworkParameters();
|
||||||
n = createTestNet(n);
|
n = createTestNet(n);
|
||||||
n.proofOfWorkLimit = new BigInteger("00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16);
|
n.proofOfWorkLimit = new BigInteger("00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16);
|
||||||
n.genesisBlock.setNonce(2); // Make this pass the difficulty test
|
n.genesisBlock.setTime(System.currentTimeMillis() / 1000);
|
||||||
n.genesisBlock.setDifficultyTarget(Block.EASIEST_DIFFICULTY_TARGET);
|
n.genesisBlock.setDifficultyTarget(Block.EASIEST_DIFFICULTY_TARGET);
|
||||||
|
n.genesisBlock.solve();
|
||||||
n.interval = 10;
|
n.interval = 10;
|
||||||
n.targetTimespan = 200000000; // 6 years. Just a very big number.
|
n.targetTimespan = 200000000; // 6 years. Just a very big number.
|
||||||
n.setSpendableCoinbaseDepth(5);
|
n.setSpendableCoinbaseDepth(5);
|
||||||
|
@ -164,7 +164,7 @@ public class BlockChainTest {
|
|||||||
}
|
}
|
||||||
// Now add another block that has no difficulty adjustment, it should be rejected.
|
// Now add another block that has no difficulty adjustment, it should be rejected.
|
||||||
try {
|
try {
|
||||||
chain.add(prev.createNextBlock(coinbaseTo));
|
chain.add(prev.createNextBlock(coinbaseTo, Block.fakeClock));
|
||||||
fail();
|
fail();
|
||||||
} catch (VerificationException e) {
|
} catch (VerificationException e) {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user