@@ -2,7 +2,6 @@ package types
22
33import (
44 "encoding/hex"
5- "fmt"
65
76 "github.com/decred/dcrd/dcrec/secp256k1/v4"
87
@@ -173,14 +172,13 @@ func GetPkScriptFromAddress(address string) ([]byte, error) {
173172}
174173
175174// GetPkScriptFromPubKey gets the pk script from the given taproot pubkey
176- // Assume that the given pubkey is 32 bytes w/o 0x prefix
177175func GetPkScriptFromPubKey (pubKeyHex string ) ([]byte , error ) {
178- pubKey , err := hex .DecodeString (fmt . Sprintf ( "02%s" , pubKeyHex ) )
176+ pubKey , err := hex .DecodeString (pubKeyHex )
179177 if err != nil {
180178 return nil , err
181179 }
182180
183- parsedPubKey , err := secp256k1 .ParsePubKey (pubKey )
181+ parsedPubKey , err := schnorr .ParsePubKey (pubKey )
184182 if err != nil {
185183 return nil , err
186184 }
@@ -192,12 +190,12 @@ func GetPkScriptFromPubKey(pubKeyHex string) ([]byte, error) {
192190
193191// GetNUMSPoint gets the NUMS point
194192func GetNUMSPoint () * btcec.PublicKey {
195- pointBytes , err := hex .DecodeString (fmt . Sprintf ( "02%s" , NUMS_POINT ) )
193+ pointBytes , err := hex .DecodeString (NUMS_POINT )
196194 if err != nil {
197195 panic (err )
198196 }
199197
200- point , err := btcec .ParsePubKey (pointBytes )
198+ point , err := schnorr .ParsePubKey (pointBytes )
201199 if err != nil {
202200 panic (err )
203201 }
0 commit comments