Peer: Receiving main protocol messages before version handshake completed is a protocol violation.

This commit is contained in:
Andreas Schildbach 2016-02-26 20:49:09 +01:00
parent 709e6f7562
commit 67e1434b51

View file

@ -459,6 +459,12 @@ public class Peer extends PeerSocketHandler {
currentFilteredBlock = null;
}
// No further communication is possible until version handshake is complete.
if (!(m instanceof VersionMessage || m instanceof VersionAck
|| (versionHandshakeFuture.isDone() && !versionHandshakeFuture.isCancelled())))
throw new ProtocolException(
"Received " + m.getClass().getSimpleName() + " before version handshake is complete.");
if (m instanceof Ping) {
processPing((Ping) m);
} else if (m instanceof Pong) {