crypto: add comment to FromECDSAPub (#31241)

closes https://github.com/ethereum/go-ethereum/issues/26240
This commit is contained in:
Marius van der Wijden 2025-02-24 12:23:25 +01:00 committed by GitHub
parent a0e6381c48
commit fbe0005070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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