mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 20:11:23 +00:00
Peer: Drop Bitcoin Cash peers early, based on service bit 5.
They will fail the difficulty check anyway.
This commit is contained in:
@@ -564,6 +564,13 @@ public class Peer extends PeerSocketHandler {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if ((vPeerVersionMessage.localServices
|
||||
& VersionMessage.NODE_BITCOIN_CASH) == VersionMessage.NODE_BITCOIN_CASH) {
|
||||
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);
|
||||
|
@@ -41,6 +41,8 @@ public class VersionMessage extends Message {
|
||||
public static final int NODE_NETWORK = 1 << 0;
|
||||
/** A service bit 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;
|
||||
|
||||
/**
|
||||
* The version number of the protocol spoken.
|
||||
|
Reference in New Issue
Block a user