Skip to content

Commit

Permalink
Merge pull request #350 from j75689/fix/ledger_pubkey_copy
Browse files Browse the repository at this point in the history
fix: reading pubkey from ledger panic
  • Loading branch information
j75689 authored Jun 5, 2023
2 parents edff400 + 164d949 commit 8538f32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/ledger_secp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ func (pkl PrivKeyLedgerSecp256k1) pubkeyLedgerSecp256k1() (pub tmcrypto.PubKey,
return nil, fmt.Errorf("error fetching public key: %v", err)
}

var pk tmsecp256k1.PubKeySecp256k1

// re-serialize in the 33-byte compressed format
cmp, err := btcec.ParsePubKey(key[:])
if err != nil {
return nil, fmt.Errorf("error parsing public key: %v", err)
}

pk := make(tmsecp256k1.PubKeySecp256k1, tmsecp256k1.PubKeySize)
copy(pk[:], cmp.SerializeCompressed())

return pk, nil
Expand Down

0 comments on commit 8538f32

Please sign in to comment.