lnrpc: ensure parsing of the Amp flag for payments is consistent
In this commit, we fix an inconsistent in the API related to AMP payments. When a payment request isn't specified, we require the `--amp` flag on the CLI to make an AMP payment. However, for payment requests, we don't require this flag. To fix this inconsistency, we now require the `--amp` flag to _also_ be set for payment requests.
This commit is contained in:
4 files changed
+52
-3
No files matched your search
@@ -940,6 +940,14 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
||||
|
||||
payAddr := payReq.PaymentAddr
|
||||
if payReq.Features.HasFeature(lnwire.AMPOptional) {
|
||||
// The opt-in AMP flag is required to pay an AMP
|
||||
// invoice.
|
||||
if !rpcPayReq.Amp {
|
||||
return nil, fmt.Errorf("the AMP flag (--amp " +
|
||||
"or SendPaymentRequest.Amp) must be " +
|
||||
"set to pay an AMP invoice")
|
||||
}
|
||||
|
||||
// Generate random SetID and root share.
|
||||
var setID [32]byte
|
||||
_, err = rand.Read(setID[:])
|
||||
|
||||
Reference in new issue
Block a user