*/
public void processStatus(StatusMessage msg, ChannelHandlerContext ctx) throws InterruptedException {
this.handshakeStatusMessage = msg;
if (peerDiscoveryMode) {
msgQueue.sendMessage(new DisconnectMessage(ReasonCode.REQUESTED));
killTimers();
ctx.close().sync();
ctx.disconnect().sync();
return;
}
if (!Arrays.equals(msg.getGenesisHash(), Blockchain.GENESIS_HASH)
|| msg.getProtocolVersion() != EthHandler.VERSION) {
logger.info("Removing EthHandler for {} due to protocol incompatibility", ctx.channel().remoteAddress());
// msgQueue.sendMessage(new DisconnectMessage(ReasonCode.INCOMPATIBLE_NETWORK));
ctx.pipeline().remove(this); // Peer is not compatible for the 'eth' sub-protocol
} else if (msg.getNetworkId() != EthHandler.NETWORK_ID)
msgQueue.sendMessage(new DisconnectMessage(ReasonCode.INCOMPATIBLE_NETWORK));
else {
BlockQueue chainQueue = blockchain.getQueue();
BigInteger peerTotalDifficulty = new BigInteger(1, msg.getTotalDifficulty());
BigInteger highestKnownTotalDifficulty = blockchain.getTotalDifficulty();
if ( highestKnownTotalDifficulty == null ||