p2p: remove useless parameter (#19433)

This commit is contained in:
ANOTHEL 2019-04-10 17:49:02 +09:00 committed by Péter Szilágyi
parent e4cb7b80d5
commit 3fa76298e4
2 changed files with 3 additions and 4 deletions

View File

@ -128,7 +128,7 @@ func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err
// as the error so it can be tracked elsewhere. // as the error so it can be tracked elsewhere.
werr := make(chan error, 1) werr := make(chan error, 1)
go func() { werr <- Send(t.rw, handshakeMsg, our) }() go func() { werr <- Send(t.rw, handshakeMsg, our) }()
if their, err = readProtocolHandshake(t.rw, our); err != nil { if their, err = readProtocolHandshake(t.rw); err != nil {
<-werr // make sure the write terminates too <-werr // make sure the write terminates too
return nil, err return nil, err
} }
@ -141,7 +141,7 @@ func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err
return their, nil return their, nil
} }
func readProtocolHandshake(rw MsgReader, our *protoHandshake) (*protoHandshake, error) { func readProtocolHandshake(rw MsgReader) (*protoHandshake, error) {
msg, err := rw.ReadMsg() msg, err := rw.ReadMsg()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -222,7 +222,6 @@ func TestProtocolHandshake(t *testing.T) {
} }
func TestProtocolHandshakeErrors(t *testing.T) { func TestProtocolHandshakeErrors(t *testing.T) {
our := &protoHandshake{Version: 3, Caps: []Cap{{"foo", 2}, {"bar", 3}}, Name: "quux"}
tests := []struct { tests := []struct {
code uint64 code uint64
msg interface{} msg interface{}
@ -258,7 +257,7 @@ func TestProtocolHandshakeErrors(t *testing.T) {
for i, test := range tests { for i, test := range tests {
p1, p2 := MsgPipe() p1, p2 := MsgPipe()
go Send(p1, test.code, test.msg) go Send(p1, test.code, test.msg)
_, err := readProtocolHandshake(p2, our) _, err := readProtocolHandshake(p2)
if !reflect.DeepEqual(err, test.err) { if !reflect.DeepEqual(err, test.err) {
t.Errorf("test %d: error mismatch: got %q, want %q", i, err, test.err) t.Errorf("test %d: error mismatch: got %q, want %q", i, err, test.err)
} }