Merge pull request #5533 from ErikEk/invoices-return-payment-address-addholdinvoice
invoices: return payment address and add index from addholdinvoice
This commit is contained in:
commit
30a0e6c745
@ -248,11 +248,7 @@ func addHoldInvoice(ctx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
printJSON(struct {
|
||||
PayReq string `json:"pay_req"`
|
||||
}{
|
||||
PayReq: resp.PaymentRequest,
|
||||
})
|
||||
printRespJSON(resp)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
# Release Notes
|
||||
|
||||
## RPC Server
|
||||
|
||||
[Return payment address and add index from
|
||||
addholdinvoice call](https://github.com/lightningnetwork/lnd/pull/5533).
|
||||
|
||||
# Build System
|
||||
|
||||
[A new pre-submit check has been
|
||||
|
@ -270,6 +270,17 @@ type AddHoldInvoiceResp struct {
|
||||
//details of the invoice, the sender has all the data necessary to send a
|
||||
//payment to the recipient.
|
||||
PaymentRequest string `protobuf:"bytes,1,opt,name=payment_request,json=paymentRequest,proto3" json:"payment_request,omitempty"`
|
||||
//
|
||||
//The "add" index of this invoice. Each newly created invoice will increment
|
||||
//this index making it monotonically increasing. Callers to the
|
||||
//SubscribeInvoices call can use this to instantly get notified of all added
|
||||
//invoices with an add_index greater than this one.
|
||||
AddIndex uint64 `protobuf:"varint,2,opt,name=add_index,json=addIndex,proto3" json:"add_index,omitempty"`
|
||||
//
|
||||
//The payment address of the generated invoice. This value should be used
|
||||
//in all payments for this invoice as we require it for end to end
|
||||
//security.
|
||||
PaymentAddr []byte `protobuf:"bytes,3,opt,name=payment_addr,json=paymentAddr,proto3" json:"payment_addr,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AddHoldInvoiceResp) Reset() {
|
||||
@ -311,6 +322,20 @@ func (x *AddHoldInvoiceResp) GetPaymentRequest() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddHoldInvoiceResp) GetAddIndex() uint64 {
|
||||
if x != nil {
|
||||
return x.AddIndex
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AddHoldInvoiceResp) GetPaymentAddr() []byte {
|
||||
if x != nil {
|
||||
return x.PaymentAddr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SettleInvoiceMsg struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -477,11 +502,15 @@ var file_invoicesrpc_invoices_proto_rawDesc = []byte{
|
||||
0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x6e, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x6f,
|
||||
0x75, 0x74, 0x65, 0x48, 0x69, 0x6e, 0x74, 0x52, 0x0a, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x48, 0x69,
|
||||
0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x09,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x22, 0x3d, 0x0a,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x22, 0x7d, 0x0a,
|
||||
0x12, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x6c, 0x64, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x72,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x61,
|
||||
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2e, 0x0a, 0x10,
|
||||
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09,
|
||||
0x61, 0x64, 0x64, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52,
|
||||
0x08, 0x61, 0x64, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x79,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x0b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x22, 0x2e, 0x0a, 0x10,
|
||||
0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x4d, 0x73, 0x67,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x08, 0x70, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, 0x13, 0x0a, 0x11,
|
||||
|
@ -103,6 +103,21 @@ message AddHoldInvoiceResp {
|
||||
payment to the recipient.
|
||||
*/
|
||||
string payment_request = 1;
|
||||
|
||||
/*
|
||||
The "add" index of this invoice. Each newly created invoice will increment
|
||||
this index making it monotonically increasing. Callers to the
|
||||
SubscribeInvoices call can use this to instantly get notified of all added
|
||||
invoices with an add_index greater than this one.
|
||||
*/
|
||||
uint64 add_index = 2;
|
||||
|
||||
/*
|
||||
The payment address of the generated invoice. This value should be used
|
||||
in all payments for this invoice as we require it for end to end
|
||||
security.
|
||||
*/
|
||||
bytes payment_addr = 3;
|
||||
}
|
||||
|
||||
message SettleInvoiceMsg {
|
||||
|
@ -227,6 +227,16 @@
|
||||
"payment_request": {
|
||||
"type": "string",
|
||||
"description": "A bare-bones invoice for a payment within the Lightning Network. With the\ndetails of the invoice, the sender has all the data necessary to send a\npayment to the recipient."
|
||||
},
|
||||
"add_index": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "The \"add\" index of this invoice. Each newly created invoice will increment\nthis index making it monotonically increasing. Callers to the\nSubscribeInvoices call can use this to instantly get notified of all added\ninvoices with an add_index greater than this one."
|
||||
},
|
||||
"payment_addr": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "The payment address of the generated invoice. This value should be used\nin all payments for this invoice as we require it for end to end\nsecurity."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -354,6 +354,8 @@ func (s *Server) AddHoldInvoice(ctx context.Context,
|
||||
}
|
||||
|
||||
return &AddHoldInvoiceResp{
|
||||
AddIndex: dbInvoice.AddIndex,
|
||||
PaymentRequest: string(dbInvoice.PaymentRequest),
|
||||
PaymentAddr: dbInvoice.Terms.PaymentAddr[:],
|
||||
}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user