Skip to content

Commit

Permalink
Merge pull request #107 from keithsue/sufay/optimize-params-validation
Browse files Browse the repository at this point in the history
Optimize params validation
  • Loading branch information
keithsue authored Jul 9, 2024
2 parents 6bfa524 + 490546b commit 390650a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x/btcbridge/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"bytes"
"encoding/hex"

secp256k1 "github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcutil"
Expand Down Expand Up @@ -61,7 +62,12 @@ func (p Params) Validate() error {
}

if len(vault.PubKey) != 0 {
_, err := secp256k1.ParsePubKey([]byte(vault.PubKey))
pkBytes, err := hex.DecodeString(vault.PubKey)
if err != nil {
return err
}

_, err = secp256k1.ParsePubKey(pkBytes)
if err != nil {
return err
}
Expand Down

0 comments on commit 390650a

Please sign in to comment.