From 18fee1eff81dbe232ebb0c6f7db30916ed21d0f7 Mon Sep 17 00:00:00 2001 From: romanman Date: Wed, 18 Jun 2014 10:18:30 +0100 Subject: [PATCH] Use Genesis directly --- .../main/java/org/ethereum/net/message/StaticMessages.java | 4 +++- .../src/test/java/org/ethereum/core/BlockTest.java | 5 +++-- samples/call-me-more.se | 2 +- samples/my-currency.se | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/net/message/StaticMessages.java b/ethereumj-core/src/main/java/org/ethereum/net/message/StaticMessages.java index 632af15c..fcfad3f4 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/message/StaticMessages.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/message/StaticMessages.java @@ -1,5 +1,6 @@ package org.ethereum.net.message; +import org.ethereum.core.Genesis; import org.ethereum.crypto.HashUtil; import org.spongycastle.util.encoders.Hex; @@ -16,7 +17,8 @@ public class StaticMessages { public static final byte[] GET_TRANSACTIONS = Hex.decode("2240089100000002C116"); public static final byte[] DISCONNECT_08 = Hex.decode("2240089100000003C20108"); - public static final byte[] GENESIS_HASH = Hex.decode("56fff6ab5ef6f1ef8dafb7b4571b89a9ae1ab870e54197c59ea10ba6f2c7eb60"); + public static final byte[] GENESIS_HASH = Genesis.getInstance().getHash(); + public static final byte[] MAGIC_PACKET = Hex.decode("22400891"); static { diff --git a/ethereumj-core/src/test/java/org/ethereum/core/BlockTest.java b/ethereumj-core/src/test/java/org/ethereum/core/BlockTest.java index d6c77ef4..eeb6850d 100644 --- a/ethereumj-core/src/test/java/org/ethereum/core/BlockTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/core/BlockTest.java @@ -11,10 +11,11 @@ import org.junit.Test; import static org.junit.Assert.*; public class BlockTest { - + + // https://ethereum.etherpad.mozilla.org/12 private String CPP_PoC5_GENESIS_HEX_RLP_ENCODED = "f8abf8a7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a011cc4aaa3b2f97cd6c858fcc0903b9b34b071e1798c91645f0e05e267028cb4a80834000008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0"; - private String CPP_PoC5_GENESIS_HEX_HASH = Hex.toHexString(StaticMessages.GENESIS_HASH); + private String CPP_PoC5_GENESIS_HEX_HASH = "56fff6ab5ef6f1ef8dafb7b4571b89a9ae1ab870e54197c59ea10ba6f2c7eb60"; String block_1 = "f9072df8d3a077ef4fdaf389dca53236bcf7f72698e154eab2828f86fbc4fc6c" + "d9225d285c89a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0" diff --git a/samples/call-me-more.se b/samples/call-me-more.se index eb1fa301..9308a5cb 100644 --- a/samples/call-me-more.se +++ b/samples/call-me-more.se @@ -14,6 +14,6 @@ code: contract.storage[999] = a - 1 // call to myself: - send((tx.gas / 10 * 8), contract.address, 0) + send((tx.gas/10 * 8), contract.address, 0) else: stop \ No newline at end of file diff --git a/samples/my-currency.se b/samples/my-currency.se index 8798c682..cf0c8499 100644 --- a/samples/my-currency.se +++ b/samples/my-currency.se @@ -1,7 +1,7 @@ -// the sample is good example how one can -// save program that manage his own currency + // the sample is good example how one can + // save program that manage his own currency init: