Skip to content

Commit

Permalink
Merge pull request #2 from erigontech/AlexeyAkhunov-patch-1
Browse files Browse the repository at this point in the history
Fix in zero-allocation recover
  • Loading branch information
yperbasis authored Jul 17, 2024
2 parents 52ae753 + eb6793c commit 0bdfac1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion secp256.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func RecoverPubkeyWithContext(context *Context, msg []byte, sig []byte, pkbuf []

var pubkey []byte
if total := len(pkbuf) + 65; cap(pkbuf) >= total {
pubkey = pkbuf[:65] // Reuse the space in pkbuf, is it has enough capacity
pubkey = pkbuf[:total] // Reuse the space in pkbuf, is it has enough capacity
} else {
pubkey = make([]byte, total)
copy(pubkey, pkbuf)
Expand Down

0 comments on commit 0bdfac1

Please sign in to comment.