aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
Diffstat (limited to 'p2p')
-rw-r--r--p2p/rlpx.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/p2p/rlpx.go b/p2p/rlpx.go
index a320e81e7..149eda689 100644
--- a/p2p/rlpx.go
+++ b/p2p/rlpx.go
@@ -528,9 +528,9 @@ func importPublicKey(pubKey []byte) (*ecies.PublicKey, error) {
return nil, fmt.Errorf("invalid public key length %v (expect 64/65)", len(pubKey))
}
// TODO: fewer pointless conversions
- pub := crypto.ToECDSAPub(pubKey65)
- if pub.X == nil {
- return nil, fmt.Errorf("invalid public key")
+ pub, err := crypto.UnmarshalPubkey(pubKey65)
+ if err != nil {
+ return nil, err
}
return ecies.ImportECDSAPublic(pub), nil
}