mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Merge pull request #718 from gzliudan/fix-sa4009
p2p: fix staticcheck warning SA4009: overwrite function argument before first use
This commit is contained in:
commit
94d202edc7
1 changed files with 5 additions and 5 deletions
10
p2p/rlpx.go
10
p2p/rlpx.go
|
|
@ -183,7 +183,7 @@ func (t *rlpx) doEncHandshake(prv *ecdsa.PrivateKey, dial *discover.Node) (disco
|
|||
if dial == nil {
|
||||
sec, err = receiverEncHandshake(t.fd, prv, nil)
|
||||
} else {
|
||||
sec, err = initiatorEncHandshake(t.fd, prv, dial.ID, nil)
|
||||
sec, err = initiatorEncHandshake(t.fd, prv, dial.ID)
|
||||
}
|
||||
if err != nil {
|
||||
return discover.NodeID{}, err
|
||||
|
|
@ -280,9 +280,9 @@ func (h *encHandshake) staticSharedSecret(prv *ecdsa.PrivateKey) ([]byte, error)
|
|||
// it should be called on the dialing side of the connection.
|
||||
//
|
||||
// prv is the local client's private key.
|
||||
func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID discover.NodeID, token []byte) (s secrets, err error) {
|
||||
func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID discover.NodeID) (s secrets, err error) {
|
||||
h := &encHandshake{initiator: true, remoteID: remoteID}
|
||||
authMsg, err := h.makeAuthMsg(prv, token)
|
||||
authMsg, err := h.makeAuthMsg(prv)
|
||||
if err != nil {
|
||||
return s, err
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID d
|
|||
}
|
||||
|
||||
// makeAuthMsg creates the initiator handshake message.
|
||||
func (h *encHandshake) makeAuthMsg(prv *ecdsa.PrivateKey, token []byte) (*authMsgV4, error) {
|
||||
func (h *encHandshake) makeAuthMsg(prv *ecdsa.PrivateKey) (*authMsgV4, error) {
|
||||
rpub, err := h.remoteID.Pubkey()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("bad remoteID: %v", err)
|
||||
|
|
@ -324,7 +324,7 @@ func (h *encHandshake) makeAuthMsg(prv *ecdsa.PrivateKey, token []byte) (*authMs
|
|||
}
|
||||
|
||||
// Sign known message: static-shared-secret ^ nonce
|
||||
token, err = h.staticSharedSecret(prv)
|
||||
token, err := h.staticSharedSecret(prv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue