@Test public void testDecode() throws Exception { NetworkParameters params = UnitTestParams.get(); VersionMessage ver = new VersionMessage(params, Hex.decode("71110100000000000000000048e5e95000000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d0000000000000000172f426974436f696e4a3a302e372d534e415053484f542f0004000000")); assertTrue(!ver.relayTxesBeforeFilter); assertTrue(ver.bestHeight == 1024); assertTrue(ver.subVer.equals("/"+CoinDefinition.coinName+"J:0.7-SNAPSHOT/")); ver = new VersionMessage(params, Hex.decode("71110100000000000000000048e5e95000000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d0000000000000000172f426974436f696e4a3a302e372d534e415053484f542f00040000")); assertTrue(ver.relayTxesBeforeFilter); assertTrue(ver.bestHeight == 1024); assertTrue(ver.subVer.equals("/"+CoinDefinition.coinName+"J:0.7-SNAPSHOT/")); ver = new VersionMessage(params, Hex.decode("71110100000000000000000048e5e95000000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d0000000000000000172f426974436f696e4a3a302e372d534e415053484f542f")); assertTrue(ver.relayTxesBeforeFilter); assertTrue(ver.bestHeight == 0); assertTrue(ver.subVer.equals("/"+CoinDefinition.coinName+"J:0.7-SNAPSHOT/")); ver = new VersionMessage(params, Hex.decode("71110100000000000000000048e5e95000000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d0000000000000000")); assertTrue(ver.relayTxesBeforeFilter); assertTrue(ver.bestHeight == 0); assertTrue(ver.subVer.equals("")); }
@Override public boolean equals(Object o) { if (!(o instanceof VersionMessage)) return false; VersionMessage other = (VersionMessage) o; return other.bestHeight == bestHeight && other.clientVersion == clientVersion && other.localServices == localServices && other.time == time && other.subVer.equals(subVer) && other.myAddr.equals(myAddr) && other.theirAddr.equals(theirAddr) && other.relayTxesBeforeFilter == relayTxesBeforeFilter; }
VersionMessage extends Message { @Override public boolean equals(Object o) { if (!(o instanceof VersionMessage)) return false; VersionMessage other = (VersionMessage) o; return other.bestHeight == bestHeight && other.clientVersion == clientVersion && other.localServices == localServices && other.time == time && other.subVer.equals(subVer) && other.myAddr.equals(myAddr) && other.theirAddr.equals(theirAddr) && other.relayTxesBeforeFilter == relayTxesBeforeFilter; } }
VersionMessage extends Message { @Override public boolean equals(Object o) { if (!(o instanceof VersionMessage)) return false; VersionMessage other = (VersionMessage) o; return other.bestHeight == bestHeight && other.clientVersion == clientVersion && other.localServices == localServices && other.time == time && other.subVer.equals(subVer) && other.myAddr.equals(myAddr) && other.theirAddr.equals(theirAddr) && other.relayTxesBeforeFilter == relayTxesBeforeFilter; } VersionMessage(NetworkParameters params, byte[] msg);  VersionMessage(NetworkParameters params, int newBestHeight);  VersionMessage(NetworkParameters params, int newBestHeight, boolean relayTxesBeforeFilter); }
VersionMessage extends Message { @Override public boolean equals(Object o) { if (!(o instanceof VersionMessage)) return false; VersionMessage other = (VersionMessage) o; return other.bestHeight == bestHeight && other.clientVersion == clientVersion && other.localServices == localServices && other.time == time && other.subVer.equals(subVer) && other.myAddr.equals(myAddr) && other.theirAddr.equals(theirAddr) && other.relayTxesBeforeFilter == relayTxesBeforeFilter; } VersionMessage(NetworkParameters params, byte[] msg);  VersionMessage(NetworkParameters params, int newBestHeight);  VersionMessage(NetworkParameters params, int newBestHeight, boolean relayTxesBeforeFilter); @Override void parse(); @Override void bitcoinSerializeToStream(OutputStream buf); boolean hasBlockChain(); @Override boolean equals(Object o); @Override int hashCode(); String toString(); VersionMessage duplicate(); void appendToSubVer(String name, String version, @Nullable String comments); boolean isPingPongSupported(); boolean isBloomFilteringSupported(); }
VersionMessage extends Message { @Override public boolean equals(Object o) { if (!(o instanceof VersionMessage)) return false; VersionMessage other = (VersionMessage) o; return other.bestHeight == bestHeight && other.clientVersion == clientVersion && other.localServices == localServices && other.time == time && other.subVer.equals(subVer) && other.myAddr.equals(myAddr) && other.theirAddr.equals(theirAddr) && other.relayTxesBeforeFilter == relayTxesBeforeFilter; } VersionMessage(NetworkParameters params, byte[] msg);  VersionMessage(NetworkParameters params, int newBestHeight);  VersionMessage(NetworkParameters params, int newBestHeight, boolean relayTxesBeforeFilter); @Override void parse(); @Override void bitcoinSerializeToStream(OutputStream buf); boolean hasBlockChain(); @Override boolean equals(Object o); @Override int hashCode(); String toString(); VersionMessage duplicate(); void appendToSubVer(String name, String version, @Nullable String comments); boolean isPingPongSupported(); boolean isBloomFilteringSupported(); static final int NODE_NETWORK; public int clientVersion; public long localServices; public long time; public PeerAddress myAddr; public PeerAddress theirAddr; public String subVer; public long bestHeight; public boolean relayTxesBeforeFilter; static final String BITCOINJ_VERSION; static final String LIBRARY_SUBVER; }