lnrpc+routerrpc+lncli: add amt and fee limit msat fields

This commit is contained in:
Joost Jager committed 2019-11-13 10:32:35 +01:00
1 parent e0a3f803d5
commit 09b3101b80
9 files changed
+931 -710

No files matched your search

+13 -6
View File
@@ -3079,15 +3079,19 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
// We override the amount to pay with the amount provided from
// the payment request.
if payReq.MilliSat == nil {
if rpcPayReq.Amt == 0 {
amt, err := lnrpc.UnmarshallAmt(
rpcPayReq.Amt, rpcPayReq.AmtMsat,
)
if err != nil {
return payIntent, err
}
if amt == 0 {
return payIntent, errors.New("amount must be " +
"specified when paying a zero amount " +
"invoice")
}
payIntent.msat = lnwire.NewMSatFromSatoshis(
btcutil.Amount(rpcPayReq.Amt),
)
payIntent.msat = amt
} else {
payIntent.msat = *payReq.MilliSat
}
@@ -3128,9 +3132,12 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
// Otherwise, If the payment request field was not specified
// (and a custom route wasn't specified), construct the payment
// from the other fields.
payIntent.msat = lnwire.NewMSatFromSatoshis(
btcutil.Amount(rpcPayReq.Amt),
payIntent.msat, err = lnrpc.UnmarshallAmt(
rpcPayReq.Amt, rpcPayReq.AmtMsat,
)
if err != nil {
return payIntent, err
}
// Calculate the fee limit that should be used for this payment.
payIntent.feeLimit = lnrpc.CalculateFeeLimit(