Skip to content

Commit

Permalink
Merge pull request #9269 from hieblmi/sendpayment-fix-negative-feelimit
Browse files Browse the repository at this point in the history
routerrpc: fix sendpayment_v2 negative fee limit
  • Loading branch information
guggero authored Nov 15, 2024
2 parents 0876173 + de451d7 commit e6efa2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/release-notes/release-notes-0.19.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
does not contain a payment address.

* [Fixed a bug](https://github.com/lightningnetwork/lnd/pull/9033) where we
would not signal an error when trying to bump an non-anchor channel but
would not signal an error when trying to bump a non-anchor channel but
instead report a successful cpfp registration although no fee bumping is
possible for non-anchor channels anyways.

* [Fixed a bug](https://github.com/lightningnetwork/lnd/pull/9269) where a
negative fee limit for `SendPaymentV2` would lead to omitting the fee limit
check.

* [Use the required route blinding
feature-bit](https://github.com/lightningnetwork/lnd/pull/9143) for invoices
containing blinded paths.
Expand Down Expand Up @@ -196,6 +200,7 @@ The underlying functionality between those two options remain the same.
* CharlieZKSmith
* Elle Mouton
* George Tsagkarelis
* hieblmi
* Oliver Gugger
* Pins
* Viktor Tigerström
Expand Down
7 changes: 7 additions & 0 deletions lnrpc/marshall_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ var (
ErrSatMsatMutualExclusive = errors.New(
"sat and msat arguments are mutually exclusive",
)

// ErrNegativeAmt is returned when a negative amount is specified.
ErrNegativeAmt = errors.New("amount cannot be negative")
)

// CalculateFeeLimit returns the fee limit in millisatoshis. If a percentage
Expand Down Expand Up @@ -56,6 +59,10 @@ func UnmarshallAmt(amtSat, amtMsat int64) (lnwire.MilliSatoshi, error) {
return 0, ErrSatMsatMutualExclusive
}

if amtSat < 0 || amtMsat < 0 {
return 0, ErrNegativeAmt
}

if amtSat != 0 {
return lnwire.NewMSatFromSatoshis(btcutil.Amount(amtSat)), nil
}
Expand Down

0 comments on commit e6efa2e

Please sign in to comment.