mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
p2p: avoid calling os.Getenv for every handshake
This commit is contained in:
parent
151cf5359a
commit
9860e75cb4
1 changed files with 3 additions and 1 deletions
|
|
@ -262,6 +262,8 @@ func (h *encHandshake) staticSharedSecret(prv *ecdsa.PrivateKey) ([]byte, error)
|
||||||
return ecies.ImportECDSA(prv).GenerateShared(h.remotePub, sskLen, sskLen)
|
return ecies.ImportECDSA(prv).GenerateShared(h.remotePub, sskLen, sskLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var configSendEIP = os.Getenv("RLPX_EIP8") != ""
|
||||||
|
|
||||||
// initiatorEncHandshake negotiates a session token on conn.
|
// initiatorEncHandshake negotiates a session token on conn.
|
||||||
// it should be called on the dialing side of the connection.
|
// it should be called on the dialing side of the connection.
|
||||||
//
|
//
|
||||||
|
|
@ -273,7 +275,7 @@ func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID d
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
var authPacket []byte
|
var authPacket []byte
|
||||||
if os.Getenv("RLPX_EIP8") != "" {
|
if configSendEIP {
|
||||||
authPacket, err = sealEIP8(authMsg, h)
|
authPacket, err = sealEIP8(authMsg, h)
|
||||||
} else {
|
} else {
|
||||||
authPacket, err = authMsg.sealPlain(h)
|
authPacket, err = authMsg.sealPlain(h)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue