Skip to content

Commit 2164910

Browse files
committed
p2p: verify protocol handshake node ID
1 parent 7d39fd6 commit 2164910

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎p2p/handshake.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func setupInboundConn(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake) (
8989
if err != nil {
9090
return nil, err
9191
}
92+
if rhs.ID != secrets.RemoteID {
93+
return nil, errors.New("node ID in protocol handshake does not match encryption handshake")
94+
}
9295
// TODO: validate that handshake node ID matches
9396
if err := writeProtocolHandshake(rw, our); err != nil {
9497
return nil, fmt.Errorf("protocol write error: %v", err)

0 commit comments

Comments
 (0)