Skip to content

Commit da9d7dd

Browse files
committed
zpay32: invoice.MilliSat is uint64 which cannot be negative
1 parent 1a13f82 commit da9d7dd

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

zpay32/amountunits.go

-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ func decodeAmount(amount string) (lnwire.MilliSatoshi, error) {
127127
// encodeAmount encodes the provided millisatoshi amount using as few characters
128128
// as possible.
129129
func encodeAmount(msat lnwire.MilliSatoshi) (string, error) {
130-
if msat < 0 {
131-
return "", fmt.Errorf("amount must be positive: %v", msat)
132-
}
133-
134130
// If possible to express in BTC, that will always be the shortest
135131
// representation.
136132
if msat%mSatPerBtc == 0 {

zpay32/invoice.go

-5
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,6 @@ func validateInvoice(invoice *Invoice) error {
571571
return fmt.Errorf("net params not set")
572572
}
573573

574-
// Ensure that if there is an amount set, it is not negative.
575-
if invoice.MilliSat != nil && *invoice.MilliSat < 0 {
576-
return fmt.Errorf("negative amount: %v", *invoice.MilliSat)
577-
}
578-
579574
// The invoice must contain a payment hash.
580575
if invoice.PaymentHash == nil {
581576
return fmt.Errorf("no payment hash found")

0 commit comments

Comments
 (0)