Skip to content

Commit 6c3513c

Browse files
authored
p2p: reduce the scope of variable dialPubkey (ethereum#24385)
dialPubkey isn't used anywhere else after dialDest.Load, so it should be safe to restrict its scope to the if clause.
1 parent 51e7968 commit 6c3513c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: p2p/server.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,8 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
943943
}
944944

945945
// If dialing, figure out the remote public key.
946-
var dialPubkey *ecdsa.PublicKey
947946
if dialDest != nil {
948-
dialPubkey = new(ecdsa.PublicKey)
947+
dialPubkey := new(ecdsa.PublicKey)
949948
if err := dialDest.Load((*enode.Secp256k1)(dialPubkey)); err != nil {
950949
err = errors.New("dial destination doesn't have a secp256k1 public key")
951950
srv.log.Trace("Setting up connection failed", "addr", c.fd.RemoteAddr(), "conn", c.flags, "err", err)

0 commit comments

Comments
 (0)