Upgrade to protocol 19

This commit is contained in:
nicksavers 2014-05-30 22:37:47 +02:00
parent f74841ac74
commit aadb7b0608
7 changed files with 27 additions and 30 deletions

View File

@ -85,7 +85,7 @@ public class AccountState {
byte[] balance = RLP.encodeBigInteger(this.balance);
byte[] stateRoot = RLP.encodeElement(this.stateRoot);
byte[] codeHash = RLP.encodeElement(this.codeHash);
this.rlpEncoded = RLP.encodeList(balance, nonce, stateRoot, codeHash);
this.rlpEncoded = RLP.encodeList(nonce, balance, stateRoot, codeHash);
}
return rlpEncoded;
}

View File

@ -23,7 +23,7 @@ public class StaticMessages {
static {
byte[] peerIdBytes = HashUtil.randomPeerId();
HELLO_MESSAGE = new HelloMessage((byte) 0x11, (byte) 0x00,
HELLO_MESSAGE = new HelloMessage((byte) 0x13, (byte) 0x00,
"EthereumJ [v0.5.1] by RomanJ", (byte) 0b00000111,
(short) 30303, peerIdBytes);
}

View File

@ -55,7 +55,7 @@ public class EthereumPeerTasterHandler extends ChannelInboundHandlerAdapter {
// to not interrupt active peer
byte[] peerIdBytes = HashUtil.randomPeerId();
HelloMessage helloMessage = new HelloMessage((byte)0x11, (byte)0x00, "EthereumJ [v0.5.1] by RomanJ ",
HelloMessage helloMessage = new HelloMessage((byte)0x13, (byte)0x00, "EthereumJ [v0.5.1] by RomanJ ",
(byte)0b00000001, (short)30303, peerIdBytes);
byte[] helloLength =ByteUtil.calcPacketLength(helloMessage.getPayload());

View File

@ -4,40 +4,35 @@ server.acceptConnections = false
# one default access point to start
# discover the network e.g. ip: [54.201.28.117] port: [30303]
# Peer Server Zero: peer discovery
peer.discovery.ip = 54.201.28.117
peer.discovery.port = 30303
# Peer Server Zero: peer discovery
#peer.discovery.ip = 54.201.28.117
#peer.discovery.port = 30303
# Peer Server One: peer discovery
#peer.discovery.ip = 54.204.10.41
#peer.discovery.port = 30303
# Some dude in Canada
#peer.discovery.ip = 131.104.247.135
#peer.discovery.port = 30303
# Nick
#peer.discovery.ip = 82.217.72.169
#peer.discovery.port = 30303
# ZeroGox
#peer.discovery.ip = 54.204.10.41
#peer.discovery.port = 30303
# RomanJ
# peer.discovery.ip = 54.211.14.10
# peer.discovery.port = 40404
# active peer ip and port
# that is the peer through
# we get the chain: [54.201.28.117] port: [30303]
peer.active.ip = 151.64.223.120
peer.active.port = 30304
# ZeroGox
peer.active.ip = 54.204.10.41
peer.active.port = 30303
# Some dude in Canada
#peer.active.ip = 131.104.247.135
#peer.active.port = 30303
# Nick
#peer.active.ip = 82.217.72.169
#peer.active.port = 30303
# RomanJ
# peer.active.ip = 54.211.14.10
# peer.active.port = 40404
#peer.active.ip = 151.64.223.120
#peer.active.port = 30304
# specify if the mechanism
# to discover more and more

View File

@ -11,7 +11,7 @@ public class AccountStateTest {
@Test
public void testGetEncoded() {
String expected = "f83e9a01000000000000000000000000000000000000000000000000008080a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
String expected = "f83e809a010000000000000000000000000000000000000000000000000080a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
AccountState acct = new AccountState(BigInteger.ZERO, BigInteger.valueOf(2).pow(200));
assertEquals(expected, Hex.toHexString(acct.getEncoded()));
}

View File

@ -14,7 +14,7 @@ import static org.junit.Assert.*;
public class BlockTest {
// https://ethereum.etherpad.mozilla.org/12
private String CPP_PoC5_GENESIS_HEX_RLP_ENCODED = "f8abf8a7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a012582945fc5ad12c3e7b67c4fc37a68fc0d52d995bb7f7291ff41a2739a7ca1680834000008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0";
private String CPP_PoC5_GENESIS_HEX_RLP_ENCODED = "f8abf8a7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a023b503734ff34ddb7bd5e478f1645680ec778ab3f90007cb1c854653693e5adc80834000008080830f4240808080a004994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829c0c0";
private String CPP_PoC5_GENESIS_HEX_HASH = Hex.toHexString(StaticMessages.GENESIS_HASH);
@Test /* got from go guy */
@ -50,6 +50,8 @@ public class BlockTest {
*/
Block genesis = new Genesis();
assertEquals(CPP_PoC5_GENESIS_HEX_RLP_ENCODED, Hex.toHexString(genesis.getEncoded()));
// Not really a good test because this compares Genesis.getHash() to itself
assertEquals(CPP_PoC5_GENESIS_HEX_HASH, Hex.toHexString(genesis.getHash()));
}

View File

@ -47,7 +47,7 @@ public class StateTest {
AccountState acct6 = new AccountState(BigInteger.ZERO, BigInteger.valueOf(2).pow(200));
trie.update(Hex.decode("cd2a3d9f938e13cd947ec05abc7fe734df8dd826"), acct6.getEncoded());
assertEquals("12582945fc5ad12c3e7b67c4fc37a68fc0d52d995bb7f7291ff41a2739a7ca16", Hex.toHexString(trie.getRootHash()));
assertEquals("23b503734ff34ddb7bd5e478f1645680ec778ab3f90007cb1c854653693e5adc", Hex.toHexString(trie.getRootHash()));
}
}