File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,25 @@ import (
1010 "github.com/btcsuite/btcd/chaincfg"
1111 "github.com/btcsuite/btcd/txscript"
1212
13+ "github.com/sideprotocol/side/crypto/adaptor"
1314 "github.com/sideprotocol/side/crypto/hash"
1415 "github.com/sideprotocol/side/x/dlc/types"
1516)
1617
18+ // HashLoanSecret hashes the given secret
19+ // Assume that the secret is a valid hex string
1720func HashLoanSecret (secret string ) string {
18- // Todo later
19- return secret
21+ secretBytes , _ := hex .DecodeString (secret )
22+
23+ return hex .EncodeToString (hash .Sha256 (secretBytes ))
2024}
2125
26+ // AdaptorPoint gets the corresponding adaptor point from the given secret
27+ // Assume that the secret is a valid hex string
2228func AdaptorPoint (secret string ) string {
23- return secret
29+ secretBytes , _ := hex .DecodeString (secret )
30+
31+ return hex .EncodeToString (adaptor .SecretToPubKey (secretBytes ))
2432}
2533
2634func GetTaprootAddress (script []byte ) (* btcutil.AddressTaproot , error ) {
You can’t perform that action at this time.
0 commit comments