3
0
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:
Mike Hearn 2012-09-06 12:37:00 +02:00
parent 38aabdfa24
commit 8162aa0ed1
2 changed files with 3 additions and 2 deletions

View File

@ -200,8 +200,9 @@ public class NetworkParameters implements Serializable {
NetworkParameters n = new NetworkParameters();
n = createTestNet(n);
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.solve();
n.interval = 10;
n.targetTimespan = 200000000; // 6 years. Just a very big number.
n.setSpendableCoinbaseDepth(5);

View File

@ -164,7 +164,7 @@ public class BlockChainTest {
}
// Now add another block that has no difficulty adjustment, it should be rejected.
try {
chain.add(prev.createNextBlock(coinbaseTo));
chain.add(prev.createNextBlock(coinbaseTo, Block.fakeClock));
fail();
} catch (VerificationException e) {
}