aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-04 19:02:08 +0800
committerFelix Lange <fjl@twurst.com>2015-03-04 19:27:24 +0800
commit21649100b1ed64c9bd73c547360dd6db9b5218fb (patch)
treef3d4a2935870ba46d39b125d116d193e4257e44b /p2p
parent7d39fd66782dee01f9534bed3cbe22c97c8d610f (diff)
downloaddexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.tar
dexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.tar.gz
dexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.tar.bz2
dexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.tar.lz
dexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.tar.xz
dexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.tar.zst
dexon-21649100b1ed64c9bd73c547360dd6db9b5218fb.zip
p2p: verify protocol handshake node ID
Diffstat (limited to 'p2p')
-rw-r--r--p2p/handshake.go3
1 files changed, 3 insertions, 0 deletions
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)