From da9d7dd363f2d31650cb8c8caee4ddf4d220e7f7 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Thu, 9 Apr 2020 19:14:01 +0200 Subject: [PATCH] zpay32: invoice.MilliSat is uint64 which cannot be negative --- zpay32/amountunits.go | 4 ---- zpay32/invoice.go | 5 ----- 2 files changed, 9 deletions(-) diff --git a/zpay32/amountunits.go b/zpay32/amountunits.go index c13f1a13..f53f3ff0 100644 --- a/zpay32/amountunits.go +++ b/zpay32/amountunits.go @@ -127,10 +127,6 @@ func decodeAmount(amount string) (lnwire.MilliSatoshi, error) { // encodeAmount encodes the provided millisatoshi amount using as few characters // as possible. func encodeAmount(msat lnwire.MilliSatoshi) (string, error) { - if msat < 0 { - return "", fmt.Errorf("amount must be positive: %v", msat) - } - // If possible to express in BTC, that will always be the shortest // representation. if msat%mSatPerBtc == 0 { diff --git a/zpay32/invoice.go b/zpay32/invoice.go index 691c0169..1c183231 100644 --- a/zpay32/invoice.go +++ b/zpay32/invoice.go @@ -571,11 +571,6 @@ func validateInvoice(invoice *Invoice) error { return fmt.Errorf("net params not set") } - // Ensure that if there is an amount set, it is not negative. - if invoice.MilliSat != nil && *invoice.MilliSat < 0 { - return fmt.Errorf("negative amount: %v", *invoice.MilliSat) - } - // The invoice must contain a payment hash. if invoice.PaymentHash == nil { return fmt.Errorf("no payment hash found")