Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
make the error check for not receiving a public key more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Aug 1, 2019
1 parent 46e9e9f commit 699dbc0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (t *Transport) handshake(
select {
case remotePubKey = <-keyCh:
default:
return nil, errors.New("go-libp2p-tls BUG: expected remote pub key to be set")
}

conn, err := t.setupConn(tlsConn, remotePubKey)
Expand All @@ -118,10 +119,6 @@ func (t *Transport) handshake(
}

func (t *Transport) setupConn(tlsConn *tls.Conn, remotePubKey ci.PubKey) (sec.SecureConn, error) {
if remotePubKey == nil {
return nil, errors.New("go-libp2p-tls BUG: expected remote pub key to be set")
}

remotePeerID, err := peer.IDFromPublicKey(remotePubKey)
if err != nil {
return nil, err
Expand Down

0 comments on commit 699dbc0

Please sign in to comment.