Commit 2ac47850 authored by T Dev. D's avatar T Dev. D 😎
Browse files

don't follow incompatible chain

parent 13a2c80f
......@@ -564,6 +564,15 @@ public class Peer extends PeerSocketHandler {
close();
return;
}
if (((vPeerVersionMessage.localServices
& VersionMessage.NODE_BITCOIN_CASH) == VersionMessage.NODE_BITCOIN_CASH) ||
((vPeerVersionMessage.localServices
& VersionMessage.NODE_SEGWIT2X) == VersionMessage.NODE_SEGWIT2X)) {
log.info("{}: Peer follows an incompatible block chain.", this);
// Shut down the channel gracefully.
close();
return;
}
if (vPeerVersionMessage.bestHeight < 0)
// In this case, it's a protocol violation.
throw new ProtocolException("Peer reports invalid best height: " + vPeerVersionMessage.bestHeight);
......
......@@ -49,6 +49,10 @@ public class VersionMessage extends Message {
public static final int NODE_NETWORK = 1 << 0;
/** A flag that denotes whether the peer supports the getutxos message or not. */
public static final int NODE_GETUTXOS = 1 << 1;
/** A service bit used by Bitcoin-ABC to announce Bitcoin Cash nodes. */
public static final int NODE_BITCOIN_CASH = 1 << 5;
/** A service bit used by BTC1 to announce Segwit2x nodes. */
public static final int NODE_SEGWIT2X = 1 << 7;
/** Indicates that a node can be asked for blocks and transactions including witness data. */
public static final int NODE_WITNESS = 1 << 3;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment