Expand Genesis block test

This commit is contained in:
nicksavers 2014-05-21 17:12:30 +02:00
parent e05da31238
commit 1399a4425a
1 changed files with 5 additions and 4 deletions

View File

@ -14,7 +14,6 @@ import static org.junit.Assert.*;
public class BlockTest {
// https://ethereum.etherpad.mozilla.org/12
private String CPP_PoC5_GENESIS_STATE_ROOT_HEX_HASH = "12582945fc5ad12c3e7b67c4fc37a68fc0d52d995bb7f7291ff41a2739a7ca16";
private String CPP_PoC5_GENESIS_HEX_RLP_ENCODED = "f8abf8a7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a012582945fc5ad12c3e7b67c4fc37a68fc0d52d995bb7f7291ff41a2739a7ca1680834000008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0";
private String CPP_PoC5_GENESIS_HEX_HASH = Hex.toHexString(StaticMessages.GENESIS_HASH);
@ -22,9 +21,11 @@ public class BlockTest {
public void testGenesisFromRLP(){
// from RLP encoding
byte[] genesisBytes = Hex.decode(CPP_PoC5_GENESIS_HEX_RLP_ENCODED);
Block genesis = new Block(genesisBytes);
assertEquals(CPP_PoC5_GENESIS_HEX_HASH, Hex.toHexString(genesis.getHash()));
assertEquals(CPP_PoC5_GENESIS_STATE_ROOT_HEX_HASH, Hex.toHexString(genesis.getStateRoot()));
Block genesisFromRLP = new Block(genesisBytes);
Genesis genesis = new Genesis();
assertEquals(Hex.toHexString(genesis.getHash()), Hex.toHexString(genesisFromRLP.getHash()));
assertEquals(Hex.toHexString(genesis.getParentHash()), Hex.toHexString(genesisFromRLP.getParentHash()));
assertEquals(Hex.toHexString(genesis.getStateRoot()), Hex.toHexString(genesisFromRLP.getStateRoot()));
}
@Test