diff --git a/ethereumj-core/src/main/java/org/ethereum/config/SystemProperties.java b/ethereumj-core/src/main/java/org/ethereum/config/SystemProperties.java index 590e71aa..68a2f843 100644 --- a/ethereumj-core/src/main/java/org/ethereum/config/SystemProperties.java +++ b/ethereumj-core/src/main/java/org/ethereum/config/SystemProperties.java @@ -21,7 +21,7 @@ public class SystemProperties { private static Logger logger = LoggerFactory.getLogger(SystemProperties.class); private static int DEFAULT_TX_APPROVE_TIMEOUT = 10; - private static int DEFAULT_PROTOCOL_VERSION = 33; + private static byte DEFAULT_PROTOCOL_VERSION = 33; private static String DEFAULT_DISCOVERY_PEER_LIST = "poc-6.ethdev.com:30303"; private static String DEFAULT_ACTIVE_PEER_IP = "poc-6.ethdev.com"; private static int DEFAULT_ACTIVE_PORT = 30303; @@ -82,9 +82,9 @@ public class SystemProperties { } } - public int protocolVersion() { + public byte protocolVersion() { if (prop.isEmpty()) return DEFAULT_PROTOCOL_VERSION; - return Integer.parseInt(prop.getProperty("protocol.version")); + return Byte.parseByte(prop.getProperty("protocol.version")); } public boolean peerDiscovery() { 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 0fa4dacb..f1be40fa 100644 --- a/ethereumj-core/src/test/java/org/ethereum/net/PeersMessageTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/net/PeersMessageTest.java @@ -8,10 +8,10 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import org.ethereum.net.client.Peer; import org.ethereum.net.message.Command; import org.ethereum.net.message.GetPeersMessage; import org.ethereum.net.message.PeersMessage; +import org.ethereum.net.peerdiscovery.PeerData; import org.junit.Test; import org.spongycastle.util.encoders.Hex; @@ -51,8 +51,8 @@ public class PeersMessageTest { assertEquals(2, peersMessage.getPeers().size()); - Iterator it = peersMessage.getPeers().iterator(); it.next(); - Peer peer = it.next(); + Iterator it = peersMessage.getPeers().iterator(); it.next(); + PeerData peer = it.next(); assertEquals(Command.PEERS, peersMessage.getCommand()); assertEquals("/81.99.225.18", peer.getAddress().toString()); @@ -63,9 +63,9 @@ public class PeersMessageTest { @Test /* PeersMessage 2 from constructor */ public void testPeers_2() throws UnknownHostException { - Set peers = new HashSet<>(); - peers.add(new Peer(InetAddress.getByName("82.217.72.169"), 30303, "585764a3c49a3838c69ad0855abfeb5672f71b072af62082b5679961781100814b8de88a8fbc1da7c73791f88159d73b5d2a13a5579535d603e045c3db5cbb75")); - peers.add(new Peer(InetAddress.getByName("192.168.1.193"), 30303, "")); + Set peers = new HashSet<>(); + peers.add(new PeerData(InetAddress.getByName("82.217.72.169"), 30303, "585764a3c49a3838c69ad0855abfeb5672f71b072af62082b5679961781100814b8de88a8fbc1da7c73791f88159d73b5d2a13a5579535d603e045c3db5cbb75")); + peers.add(new PeerData(InetAddress.getByName("192.168.1.193"), 30303, "")); PeersMessage peersMessage = new PeersMessage(peers); System.out.println(peersMessage.toString());