diff --git a/ethereumj-core/pom.xml b/ethereumj-core/pom.xml index 4cb0af4a..f176a123 100644 --- a/ethereumj-core/pom.xml +++ b/ethereumj-core/pom.xml @@ -4,7 +4,7 @@ org.ethereum ethereumj jar - 0.5.1 + 0.5.3 EthereumJ http://www.ethereumj.org @@ -194,6 +194,29 @@ + + com.google.code.maven-replacer-plugin + replacer + 1.5.3 + + + prepare-package + + replace + + + + + target/classes/system.properties + + + PROJECT.VERSION + ${project.version} + + + + + org.apache.maven.plugins maven-source-plugin 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 c9125087..437bbb69 100644 --- a/ethereumj-core/src/main/java/org/ethereum/config/SystemProperties.java +++ b/ethereumj-core/src/main/java/org/ethereum/config/SystemProperties.java @@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory; */ public class SystemProperties { - private static Logger logger = LoggerFactory.getLogger(SystemProperties.class); + private static Logger logger = LoggerFactory.getLogger(SystemProperties.class); private static int DEFAULT_TX_APPROVE_TIMEOUT = 10; private static String DEFAULT_DISCOVERY_PEER_LIST = "54.201.28.117:30303"; @@ -35,6 +35,8 @@ public class SystemProperties { private static int DEFAULT_TRACE_STARTBLOCK = -1; private static byte DEFAULT_MAX_BLOCKS_ASK = 10; private static int DEFAULT_MAX_BLOCKS_QUEUED = 300; + private static String DEFAULT_PROJECT_VERSION = ""; + private static String DEFAULT_HELLO_PHRASE = "RJ"; public static SystemProperties CONFIG = new SystemProperties(); @@ -183,6 +185,16 @@ public class SystemProperties { return Integer.parseInt(prop.getProperty("max.blocks.queued")); } + public String projectVersion() { + if(prop.isEmpty()) return DEFAULT_PROJECT_VERSION; + return prop.getProperty("project.version"); + } + + public String helloPhrase() { + if(prop.isEmpty()) return DEFAULT_HELLO_PHRASE; + return prop.getProperty("hello.phrase"); + } + public static void main(String args[]) { SystemProperties systemProperties = new SystemProperties(); diff --git a/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java b/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java index 5ef3d042..86ced0ed 100644 --- a/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java +++ b/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java @@ -1,5 +1,6 @@ package org.ethereum.gui; +import org.ethereum.config.SystemProperties; import org.ethereum.manager.WorldManager; import org.ethereum.util.Utils; import org.slf4j.Logger; @@ -36,8 +37,10 @@ public class ToolBar extends JFrame { public ToolBar() throws HeadlessException { + String version = SystemProperties.CONFIG.projectVersion(); + introLogger.info(""); - introLogger.info("|Ξ| EthereumJ [v0.5.1] by RomanJ"); + introLogger.info("|Ξ| EthereumJ [v" + version + "] by RomanJ"); introLogger.info("|Ξ| Code by Roman Mandeleil, (c) 2014."); introLogger.info("|Ξ| Contribution: Nick Savers "); introLogger.info("|Ξ| Based on a design by Vitalik Buterin."); 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 d149e918..8e52db5f 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.config.SystemProperties; import org.ethereum.crypto.HashUtil; import org.spongycastle.util.encoders.Hex; @@ -33,8 +34,16 @@ public class StaticMessages { public static HelloMessage generateHelloMessage() { byte[] peerIdBytes = HashUtil.randomPeerId(); + String version = SystemProperties.CONFIG.projectVersion(); + String system = System.getProperty("os.name"); + if (System.getProperty("java.vm.vendor").contains("Android")) system = "Android"; + + String phrase = SystemProperties.CONFIG.helloPhrase(); + + String helloAnnouncement = String.format("Ethereum(J)/v%s/Release/%s/%s ", version, system, phrase); + return new HelloMessage((byte) 0x17, (byte) 0x00, - "EthereumJ [v0.5.1] by RomanJ", Byte.parseByte("00000111", 2), + helloAnnouncement, Byte.parseByte("00000111", 2), (short) 30303, peerIdBytes); } } diff --git a/ethereumj-core/src/main/resources/system.properties b/ethereumj-core/src/main/resources/system.properties index 87f47526..d583a96a 100644 --- a/ethereumj-core/src/main/resources/system.properties +++ b/ethereumj-core/src/main/resources/system.properties @@ -5,7 +5,8 @@ server.acceptConnections = false # List of the peers to start # the search of the online peers # values: [ip:port, ip:port, ip:port ...] -peer.discovery.ip.list = 185.43.109.23:30303,\ +peer.discovery.ip.list = 185.43.109.23:30303, \ + 54.211.14.10:30303, \ 213.100.248.181:30303, \ 54.72.69.180:30303, \ 54.201.28.117:30303, \ @@ -24,12 +25,12 @@ peer.discovery.ip.list = 185.43.109.23:30303,\ #peer.active.port = 30303 # RomanJ -#peer.active.ip = 54.211.14.10 -#peer.active.port = 30303 +peer.active.ip = 54.211.14.10 +peer.active.port = 30303 # PoC-5 testnet -peer.active.ip = 185.43.109.23 -peer.active.port = 30303 +#peer.active.ip = 185.43.109.23 +#peer.active.port = 30303 #peer.active.ip = 54.72.69.180 #peer.active.port = 30303 @@ -128,3 +129,11 @@ max.blocks.ask = 100 # until the execution is set by this param # recommended value: [100.300] max.blocks.queued = 300 + + +# project version auto copied during build phase +project.version = PROJECT.VERSION + +# hello phrase will be included in +# the hello message of the peer +hello.phrase = RJ \ No newline at end of file