Browse Source

Merge pull request #5533 from ErikEk/invoices-return-payment-address-addholdinvoice

invoices: return payment address and add index from addholdinvoice
master
Olaoluwa Osuntokun 3 years ago committed by GitHub
parent
commit
30a0e6c745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/lncli/invoicesrpc_active.go
  2. 5
      docs/release-notes/release-notes-0.14.0.md
  3. 35
      lnrpc/invoicesrpc/invoices.pb.go
  4. 17
      lnrpc/invoicesrpc/invoices.proto
  5. 12
      lnrpc/invoicesrpc/invoices.swagger.json
  6. 2
      lnrpc/invoicesrpc/invoices_server.go

6
cmd/lncli/invoicesrpc_active.go

@ -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
}

5
docs/release-notes/release-notes-0.14.0.md

@ -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

35
lnrpc/invoicesrpc/invoices.pb.go

@ -266,10 +266,21 @@ type AddHoldInvoiceResp struct {
unknownFields protoimpl.UnknownFields
//
//A bare-bones invoice for a payment within the Lightning Network. With the
//A bare-bones invoice for a payment within the Lightning Network. With the
//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,

17
lnrpc/invoicesrpc/invoices.proto

@ -98,11 +98,26 @@ message AddHoldInvoiceRequest {
message AddHoldInvoiceResp {
/*
A bare-bones invoice for a payment within the Lightning Network. With the
A bare-bones invoice for a payment within the Lightning Network. With the
details of the invoice, the sender has all the data necessary to send a
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 {

12
lnrpc/invoicesrpc/invoices.swagger.json

@ -226,7 +226,17 @@
"properties": {
"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."
"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."
}
}
},

2
lnrpc/invoicesrpc/invoices_server.go

@ -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…
Cancel
Save