lnrpc: add IsAmp to Invoice

This commit is contained in:
Conner Fromknecht 2021-05-06 09:15:33 -07:00
parent 541041f4a8
commit 2be874f340
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
6 changed files with 926 additions and 896 deletions

@ -463,6 +463,11 @@
"type": "string",
"format": "byte",
"description": "The payment address of this invoice. This value will be used in MPP\npayments, and also for newer invoies that always require the MPP paylaod\nfor added end-to-end security."
},
"is_amp": {
"type": "boolean",
"format": "boolean",
"description": "Signals whether or not this is an AMP invoice."
}
}
},

@ -147,6 +147,8 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
rpcHtlcs = append(rpcHtlcs, &rpcHtlc)
}
isAmp := invoice.Terms.Features.HasFeature(lnwire.AMPOptional)
rpcInvoice := &lnrpc.Invoice{
Memo: string(invoice.Memo),
RHash: rHash,
@ -170,8 +172,9 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
State: state,
Htlcs: rpcHtlcs,
Features: CreateRPCFeatures(invoice.Terms.Features),
IsKeysend: len(invoice.PaymentRequest) == 0,
IsKeysend: len(invoice.PaymentRequest) == 0 && !isAmp,
PaymentAddr: invoice.Terms.PaymentAddr[:],
IsAmp: isAmp,
}
if preimage != nil {

File diff suppressed because it is too large Load Diff

@ -3003,6 +3003,11 @@ message Invoice {
for added end-to-end security.
*/
bytes payment_addr = 26;
/*
Signals whether or not this is an AMP invoice.
*/
bool is_amp = 27;
}
enum InvoiceHTLCState {

@ -4387,6 +4387,11 @@
"type": "string",
"format": "byte",
"description": "The payment address of this invoice. This value will be used in MPP\npayments, and also for newer invoies that always require the MPP paylaod\nfor added end-to-end security."
},
"is_amp": {
"type": "boolean",
"format": "boolean",
"description": "Signals whether or not this is an AMP invoice."
}
}
},

@ -4824,6 +4824,7 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
CltvExpiry: invoice.CltvExpiry,
Private: invoice.Private,
RouteHints: routeHints,
Amp: invoice.IsAmp,
}
if invoice.RPreimage != nil {