rpcserver: allow payment of invoices with zero amount
This commit is contained in:
parent
454eab720e
commit
af16654c0c
35
rpcserver.go
35
rpcserver.go
@ -1623,18 +1623,20 @@ func (r *rpcServer) SendPayment(paymentStream lnrpc.Lightning_SendPaymentServer)
|
|||||||
}
|
}
|
||||||
p.dest = payReq.Destination.SerializeCompressed()
|
p.dest = payReq.Destination.SerializeCompressed()
|
||||||
|
|
||||||
|
// If the amount was not included in the
|
||||||
|
// invoice, then we let the payee
|
||||||
|
// specify the amount of satoshis they
|
||||||
|
// wish to send. We override the amount
|
||||||
|
// to pay with the amount provided from
|
||||||
|
// the payment request.
|
||||||
if payReq.MilliSat == nil {
|
if payReq.MilliSat == nil {
|
||||||
err := fmt.Errorf("only payment" +
|
p.msat = lnwire.NewMSatFromSatoshis(
|
||||||
" requests specifying" +
|
btcutil.Amount(nextPayment.Amt),
|
||||||
" the amount are" +
|
)
|
||||||
" currently supported")
|
} else {
|
||||||
select {
|
|
||||||
case errChan <- err:
|
|
||||||
case <-reqQuit:
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
p.msat = *payReq.MilliSat
|
p.msat = *payReq.MilliSat
|
||||||
|
}
|
||||||
|
|
||||||
p.pHash = payReq.PaymentHash[:]
|
p.pHash = payReq.PaymentHash[:]
|
||||||
p.cltvDelta = uint16(payReq.MinFinalCLTVExpiry())
|
p.cltvDelta = uint16(payReq.MinFinalCLTVExpiry())
|
||||||
} else {
|
} else {
|
||||||
@ -1806,11 +1808,18 @@ func (r *rpcServer) SendPaymentSync(ctx context.Context,
|
|||||||
|
|
||||||
destPub = payReq.Destination
|
destPub = payReq.Destination
|
||||||
|
|
||||||
|
// If the amount was not included in the invoice, then we let
|
||||||
|
// the payee specify the amount of satoshis they wish to send.
|
||||||
|
// We override the amount to pay with the amount provided from
|
||||||
|
// the payment request.
|
||||||
if payReq.MilliSat == nil {
|
if payReq.MilliSat == nil {
|
||||||
return nil, fmt.Errorf("payment requests with no " +
|
amtMSat = lnwire.NewMSatFromSatoshis(
|
||||||
"amount specified not currently supported")
|
btcutil.Amount(nextPayment.Amt),
|
||||||
}
|
)
|
||||||
|
} else {
|
||||||
amtMSat = *payReq.MilliSat
|
amtMSat = *payReq.MilliSat
|
||||||
|
}
|
||||||
|
|
||||||
rHash = *payReq.PaymentHash
|
rHash = *payReq.PaymentHash
|
||||||
cltvDelta = uint16(payReq.MinFinalCLTVExpiry())
|
cltvDelta = uint16(payReq.MinFinalCLTVExpiry())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user