From d2c64b799650e4d0f7ef7d62d7d81a3a6d98ef65 Mon Sep 17 00:00:00 2001 From: nicksavers Date: Sat, 25 Oct 2014 09:24:18 +0200 Subject: [PATCH] Fix test failures caused by switch to Adaptive Message IDs --- .../main/java/org/ethereum/net/eth/GetBlockHashesMessage.java | 2 +- .../src/test/java/org/ethereum/net/BlockHashesMessageTest.java | 2 +- .../test/java/org/ethereum/net/GetBlockHashesMessageTest.java | 2 +- .../src/test/java/org/ethereum/net/GetBlocksMessageTest.java | 2 +- .../src/test/java/org/ethereum/net/HelloMessageTest.java | 2 +- .../src/test/java/org/ethereum/net/PeersMessageTest.java | 1 - .../src/test/java/org/ethereum/net/TransactionsMessageTest.java | 2 +- 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/net/eth/GetBlockHashesMessage.java b/ethereumj-core/src/main/java/org/ethereum/net/eth/GetBlockHashesMessage.java index 7a1240ea..f8edae50 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/eth/GetBlockHashesMessage.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/eth/GetBlockHashesMessage.java @@ -40,7 +40,7 @@ public class GetBlockHashesMessage extends EthMessage { } private void parse() { - RLPList paramsList = (RLPList) RLP.decode2(encoded).get(1); + RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0); this.bestHash = paramsList.get(1).getRLPData(); byte[] maxBlocksBytes = paramsList.get(2).getRLPData(); diff --git a/ethereumj-core/src/test/java/org/ethereum/net/BlockHashesMessageTest.java b/ethereumj-core/src/test/java/org/ethereum/net/BlockHashesMessageTest.java index 6aa0e76a..45d24d6a 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/BlockHashesMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/BlockHashesMessageTest.java @@ -39,7 +39,7 @@ public class BlockHashesMessageTest { BlockHashesMessage blockHashesMessage = new BlockHashesMessage(blockHashes); System.out.println(blockHashesMessage); - String expected = "f84314a04ee6424d776b3f59affc20bc2de59e67f36e22cc07897ff8df152242c921716ba07d2fe4df0dbbc9011da2b3bf177f0c6b7e71a11c509035c5d751efa5cf9b4817"; + String expected = "f84304a04ee6424d776b3f59affc20bc2de59e67f36e22cc07897ff8df152242c921716ba07d2fe4df0dbbc9011da2b3bf177f0c6b7e71a11c509035c5d751efa5cf9b4817"; assertEquals(expected, Hex.toHexString(blockHashesMessage.getEncoded())); assertEquals(EthMessageCodes.BLOCK_HASHES, blockHashesMessage.getCommand()); diff --git a/ethereumj-core/src/test/java/org/ethereum/net/GetBlockHashesMessageTest.java b/ethereumj-core/src/test/java/org/ethereum/net/GetBlockHashesMessageTest.java index c5011b21..de324a22 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/GetBlockHashesMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/GetBlockHashesMessageTest.java @@ -32,7 +32,7 @@ public class GetBlockHashesMessageTest { GetBlockHashesMessage getBlockHashesMessage = new GetBlockHashesMessage(bestHash, 128); System.out.println(getBlockHashesMessage); - String expected = "e413a0455408387e6c5b029b0d51f7d617a4d1dc4895fa6eda09455cc2ee62c08d907e8180"; + String expected = "e403a0455408387e6c5b029b0d51f7d617a4d1dc4895fa6eda09455cc2ee62c08d907e8180"; assertEquals(expected, Hex.toHexString(getBlockHashesMessage.getEncoded())); assertEquals(EthMessageCodes.GET_BLOCK_HASHES, getBlockHashesMessage.getCommand()); diff --git a/ethereumj-core/src/test/java/org/ethereum/net/GetBlocksMessageTest.java b/ethereumj-core/src/test/java/org/ethereum/net/GetBlocksMessageTest.java index f4858a49..77707576 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/GetBlocksMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/GetBlocksMessageTest.java @@ -47,7 +47,7 @@ public class GetBlocksMessageTest { GetBlocksMessage getBlocksMessage = new GetBlocksMessage(hashList); System.out.println(getBlocksMessage); - String expected = "f8a615a0497dcbd12fa99ced7b27cda6611f64eb13ab50e20260eec5ee6b7190e7206d54a00959bdfba5e54fcc9370e86b7996fbe32a277bab65c31a0102226f83c4d3e0f2a001a333c156485880776e929e84c26c9778c1e9b4dcb5cd3bff8ad0aeff385df0a0690e13595c9e8e4fa9a621dfed6ad828a6e8e591479af6897c979a83daf73084a0b20f253d2b62609e932c13f3bca59a22913ea5b1e532d8a707976997461ec143"; + String expected = "f8a605a0497dcbd12fa99ced7b27cda6611f64eb13ab50e20260eec5ee6b7190e7206d54a00959bdfba5e54fcc9370e86b7996fbe32a277bab65c31a0102226f83c4d3e0f2a001a333c156485880776e929e84c26c9778c1e9b4dcb5cd3bff8ad0aeff385df0a0690e13595c9e8e4fa9a621dfed6ad828a6e8e591479af6897c979a83daf73084a0b20f253d2b62609e932c13f3bca59a22913ea5b1e532d8a707976997461ec143"; assertEquals(expected, Hex.toHexString(getBlocksMessage.getEncoded())); assertEquals(EthMessageCodes.GET_BLOCKS, getBlocksMessage.getCommand()); diff --git a/ethereumj-core/src/test/java/org/ethereum/net/HelloMessageTest.java b/ethereumj-core/src/test/java/org/ethereum/net/HelloMessageTest.java index 9b5422e7..b331b7da 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/HelloMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/HelloMessageTest.java @@ -91,7 +91,7 @@ public class HelloMessageTest { System.out.println(helloMessage); // rlp encoded hello message String expected = "F8778080A2457468657265756D284A292F302E362E312F6465762F5" - + "7696E646F77732F4A617661CCC58365746823C5837368680182765FB840CAB0" + + "7696E646F77732F4A617661CCC58365746824C5837368680182765FB840CAB0" + "D93EEE1F44EF1286367101F1553450E3DDCEEA45ABCAB0AC21E1EFB48A6610E" + "BE88CE7317EB09229558311BA8B7250911D7E49562C3988CA3143329DA3EA"; diff --git a/ethereumj-core/src/test/java/org/ethereum/net/PeersMessageTest.java b/ethereumj-core/src/test/java/org/ethereum/net/PeersMessageTest.java index a578184c..62e151d9 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/PeersMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/PeersMessageTest.java @@ -12,7 +12,6 @@ import org.ethereum.net.p2p.GetPeersMessage; import org.ethereum.net.p2p.P2pMessageCodes; import org.ethereum.net.p2p.Peer; import org.ethereum.net.p2p.PeersMessage; -import org.ethereum.net.peerdiscovery.PeerInfo; import org.junit.Test; import org.spongycastle.util.encoders.Hex; diff --git a/ethereumj-core/src/test/java/org/ethereum/net/TransactionsMessageTest.java b/ethereumj-core/src/test/java/org/ethereum/net/TransactionsMessageTest.java index 02bdfc2a..5cd12cb3 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/TransactionsMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/TransactionsMessageTest.java @@ -167,7 +167,7 @@ public class TransactionsMessageTest { @Test /* Transactions msg encode */ public void test_3() throws Exception { - String expected = "f87312f870808b00d3c21bcecceda10000009479b08ad8787060333663d19704909ee7b1903e588609184e72a000824255801ca00f410a70e42b2c9854a8421d32c87c370a2b9fff0a27f9f031bb4443681d73b5a018a7dc4c4f9dee9f3dc35cb96ca15859aa27e219a8e4a8547be6bd3206979858"; + String expected = "f87302f870808b00d3c21bcecceda10000009479b08ad8787060333663d19704909ee7b1903e588609184e72a000824255801ca00f410a70e42b2c9854a8421d32c87c370a2b9fff0a27f9f031bb4443681d73b5a018a7dc4c4f9dee9f3dc35cb96ca15859aa27e219a8e4a8547be6bd3206979858"; BigInteger value = new BigInteger("1000000000000000000000000");