Skip to content

Commit

Permalink
pnet: wrap underlying error when reading nonce fails (#2975)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt authored Oct 25, 2024
1 parent 83d458c commit 362e583
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/net/pnet/psk_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pnet
import (
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"net"

Expand Down Expand Up @@ -33,7 +34,7 @@ func (c *pskConn) Read(out []byte) (int, error) {
nonce := make([]byte, 24)
_, err := io.ReadFull(c.Conn, nonce)
if err != nil {
return 0, errShortNonce
return 0, fmt.Errorf("%w: %w", errShortNonce, err)
}
c.readS20 = salsa20.New(c.psk, nonce)
}
Expand Down

0 comments on commit 362e583

Please sign in to comment.