diff --git a/core/src/main/java/com/google/bitcoin/core/VersionMessage.java b/core/src/main/java/com/google/bitcoin/core/VersionMessage.java index 688dd24d..d2a06181 100644 --- a/core/src/main/java/com/google/bitcoin/core/VersionMessage.java +++ b/core/src/main/java/com/google/bitcoin/core/VersionMessage.java @@ -72,6 +72,11 @@ public class VersionMessage extends Message { */ public boolean relayTxesBeforeFilter; + /** The version of this library release, as a string. */ + public static final String BITCOINJ_VERSION = "0.7-SNAPSHOT"; + /** The value that is prepended to the subVer field of this application. */ + public static final String LIBRARY_SUBVER = "/BitCoinJ:" + BITCOINJ_VERSION + "/"; + public VersionMessage(NetworkParameters params, byte[] msg) throws ProtocolException { super(params, msg, 0); } @@ -101,7 +106,7 @@ public class VersionMessage extends Message { } catch (UnknownHostException e) { throw new RuntimeException(e); // Cannot happen (illegal IP length). } - subVer = "/BitCoinJ:0.7-SNAPSHOT/"; + subVer = LIBRARY_SUBVER; bestHeight = newBestHeight; this.relayTxesBeforeFilter = relayTxesBeforeFilter; diff --git a/core/src/test/java/com/google/bitcoin/core/VersionMessageTest.java b/core/src/test/java/com/google/bitcoin/core/VersionMessageTest.java index 7154cb5d..10d9994a 100644 --- a/core/src/test/java/com/google/bitcoin/core/VersionMessageTest.java +++ b/core/src/test/java/com/google/bitcoin/core/VersionMessageTest.java @@ -1,10 +1,10 @@ package com.google.bitcoin.core; -import static org.junit.Assert.assertTrue; - import org.junit.Test; import org.spongycastle.util.encoders.Hex; +import static org.junit.Assert.assertTrue; + public class VersionMessageTest { @Test // Test that we can decode version messages which miss data which some old nodes may not include