From 21649100b1ed64c9bd73c547360dd6db9b5218fb Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 4 Mar 2015 12:02:08 +0100 Subject: [PATCH] p2p: verify protocol handshake node ID --- p2p/handshake.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p2p/handshake.go b/p2p/handshake.go index a56de968d..3ad25bae4 100644 --- a/p2p/handshake.go +++ b/p2p/handshake.go @@ -89,6 +89,9 @@ func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) ( if err != nil { return nil, err } + if rhs.ID != secrets.RemoteID { + return nil, errors.New("node ID in protocol handshake does not match encryption handshake") + } // TODO: validate that handshake node ID matches if err := writeProtocolHandshake(rw, our); err != nil { return nil, fmt.Errorf("protocol write error: %v", err)