rpcserver: return err when paying 0 amt invoice and amt is not specified

This commit is contained in:
Wilmer Paulino 2018-06-11 16:25:34 -07:00
parent 2e838abb3f
commit f27e0baf7c
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -1890,6 +1890,12 @@ 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 {
return payIntent, errors.New("amount must be " +
"specified when paying a zero amount " +
"invoice")
}
payIntent.msat = lnwire.NewMSatFromSatoshis(
btcutil.Amount(rpcPayReq.Amt),
)