github.com/decred/dcrlnd@v0.7.6/channeldb/migration21/util.go (about) 1 package migration21 2 3 import ( 4 "encoding/hex" 5 6 "github.com/decred/dcrd/dcrec/secp256k1/v4" 7 ) 8 9 func mustDecodeHex(s string) []byte { 10 b, err := hex.DecodeString(s) 11 if err != nil { 12 panic(err) 13 } 14 return b 15 } 16 17 func mustDecodeModNScalar(s string) *secp256k1.ModNScalar { 18 b := mustDecodeHex(s) 19 res := new(secp256k1.ModNScalar) 20 if res.SetByteSlice(b) { 21 panic("modNScalar overflowed") 22 } 23 return res 24 }