mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
routerrpc: fix sendpayment_v2 negative fee limit
This commit is contained in:
parent
0876173c45
commit
8f8942cda9
@ -23,6 +23,9 @@ var (
|
|||||||
ErrSatMsatMutualExclusive = errors.New(
|
ErrSatMsatMutualExclusive = errors.New(
|
||||||
"sat and msat arguments are mutually exclusive",
|
"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
|
// CalculateFeeLimit returns the fee limit in millisatoshis. If a percentage
|
||||||
@ -56,6 +59,10 @@ func UnmarshallAmt(amtSat, amtMsat int64) (lnwire.MilliSatoshi, error) {
|
|||||||
return 0, ErrSatMsatMutualExclusive
|
return 0, ErrSatMsatMutualExclusive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if amtSat < 0 || amtMsat < 0 {
|
||||||
|
return 0, ErrNegativeAmt
|
||||||
|
}
|
||||||
|
|
||||||
if amtSat != 0 {
|
if amtSat != 0 {
|
||||||
return lnwire.NewMSatFromSatoshis(btcutil.Amount(amtSat)), nil
|
return lnwire.NewMSatFromSatoshis(btcutil.Amount(amtSat)), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user