lnrpc: add IsAmp to Invoice
This commit is contained in:
6 files changed
+926
-896
No files matched your search
@@ -463,6 +463,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "byte",
|
"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."
|
"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)
|
rpcHtlcs = append(rpcHtlcs, &rpcHtlc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAmp := invoice.Terms.Features.HasFeature(lnwire.AMPOptional)
|
||||||
|
|
||||||
rpcInvoice := &lnrpc.Invoice{
|
rpcInvoice := &lnrpc.Invoice{
|
||||||
Memo: string(invoice.Memo),
|
Memo: string(invoice.Memo),
|
||||||
RHash: rHash,
|
RHash: rHash,
|
||||||
@@ -170,8 +172,9 @@ func CreateRPCInvoice(invoice *channeldb.Invoice,
|
|||||||
State: state,
|
State: state,
|
||||||
Htlcs: rpcHtlcs,
|
Htlcs: rpcHtlcs,
|
||||||
Features: CreateRPCFeatures(invoice.Terms.Features),
|
Features: CreateRPCFeatures(invoice.Terms.Features),
|
||||||
IsKeysend: len(invoice.PaymentRequest) == 0,
|
IsKeysend: len(invoice.PaymentRequest) == 0 && !isAmp,
|
||||||
PaymentAddr: invoice.Terms.PaymentAddr[:],
|
PaymentAddr: invoice.Terms.PaymentAddr[:],
|
||||||
|
IsAmp: isAmp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if preimage != nil {
|
if preimage != nil {
|
||||||
|
|||||||
+906
-895
File diff suppressed because it is too large.
Load diff
@@ -3003,6 +3003,11 @@ message Invoice {
|
|||||||
for added end-to-end security.
|
for added end-to-end security.
|
||||||
*/
|
*/
|
||||||
bytes payment_addr = 26;
|
bytes payment_addr = 26;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Signals whether or not this is an AMP invoice.
|
||||||
|
*/
|
||||||
|
bool is_amp = 27;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum InvoiceHTLCState {
|
enum InvoiceHTLCState {
|
||||||
|
|||||||
@@ -4387,6 +4387,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "byte",
|
"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."
|
"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,
|
CltvExpiry: invoice.CltvExpiry,
|
||||||
Private: invoice.Private,
|
Private: invoice.Private,
|
||||||
RouteHints: routeHints,
|
RouteHints: routeHints,
|
||||||
|
Amp: invoice.IsAmp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if invoice.RPreimage != nil {
|
if invoice.RPreimage != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user