3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 23:02:15 +00:00

Refactor version constants a bit.

Resolves issue 206.
This commit is contained in:
Mike Hearn 2013-02-18 15:51:24 +01:00
parent eae775a4bf
commit 0c1d308b5b
2 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -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