lnd/fuzz/zpay32/decode.go
Oliver Gugger 0b4e03f5fc
multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00

23 lines
465 B
Go

//go:build gofuzz
// +build gofuzz
package zpay32fuzz
import (
"github.com/btcsuite/btcd/chaincfg"
"github.com/lightningnetwork/lnd/zpay32"
)
// Fuzz_decode is used by go-fuzz.
func Fuzz_decode(data []byte) int {
inv, err := zpay32.Decode(string(data), &chaincfg.TestNet3Params)
if err != nil {
return 1
}
// Call these functions as a sanity check to make sure the invoice
// is well-formed.
_ = inv.MinFinalCLTVExpiry()
_ = inv.Expiry()
return 1
}