mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 14:50:57 +01:00
Peer: Drop Bitcoin Cash peers early, based on service bit 5.
They will fail the difficulty check anyway.
This commit is contained in:
parent
ff970f6fad
commit
738011a2a4
2 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -49,6 +49,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.
|
||||
|
|
Loading…
Add table
Reference in a new issue