From 31cc9b0d5f5f336ea1084ee5bf4d831bd7a25ca7 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Mon, 24 Feb 2025 12:23:25 +0100 Subject: [PATCH] crypto: add comment to FromECDSAPub (#31241) closes https://github.com/ethereum/go-ethereum/issues/26240 --- crypto/crypto.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/crypto.go b/crypto/crypto.go index ee259d3f6e..d25b286cdc 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -184,6 +184,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) { return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil } +// FromECDSAPub converts a secp256k1 public key to bytes. +// Note: it does not use the curve from pub, instead it always +// encodes using secp256k1. func FromECDSAPub(pub *ecdsa.PublicKey) []byte { if pub == nil || pub.X == nil || pub.Y == nil { return nil