From 4207be6e50bcfdba8e30669430163c5771fdb417 Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Tue, 23 May 2023 10:08:49 -0500 Subject: [PATCH] zpay32: remove unused method calls The fuzz tests call inv.MinFinalCLTVExpiry() and inv.Expiry() supposedly to ensure the invoice is well-formed. However, those methods can never panic or return errors and therefore provide no benefit for this purpose. --- zpay32/fuzz_test.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/zpay32/fuzz_test.go b/zpay32/fuzz_test.go index bb948c20f..f98af58d4 100644 --- a/zpay32/fuzz_test.go +++ b/zpay32/fuzz_test.go @@ -12,15 +12,7 @@ import ( func FuzzDecode(f *testing.F) { f.Fuzz(func(t *testing.T, data string) { - inv, err := Decode(data, &chaincfg.TestNet3Params) - if err != nil { - return - } - - // Call these functions as a sanity check to make sure the - // invoice is well-formed. - _ = inv.MinFinalCLTVExpiry() - _ = inv.Expiry() + _, _ = Decode(data, &chaincfg.TestNet3Params) }) } @@ -31,11 +23,6 @@ func FuzzEncode(f *testing.F) { return } - // Call these functions as a sanity check to make sure the - // invoice is well-formed. - _ = inv.MinFinalCLTVExpiry() - _ = inv.Expiry() - // Initialize the static key we will be using for this fuzz // test. testPrivKey, _ := btcec.PrivKeyFromBytes(testPrivKeyBytes)