Skip to content

Commit

Permalink
invoices: return payment address from addholdinvoice
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEk committed Jul 19, 2021
1 parent 7176a21 commit 850dee3
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 10 deletions.
6 changes: 1 addition & 5 deletions cmd/lncli/invoicesrpc_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,7 @@ func addHoldInvoice(ctx *cli.Context) error {
return err
}

printJSON(struct {
PayReq string `json:"pay_req"`
}{
PayReq: resp.PaymentRequest,
})
printRespJSON(resp)

return nil
}
5 changes: 5 additions & 0 deletions docs/release-notes/release-notes-0.14.0.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
35 changes: 32 additions & 3 deletions lnrpc/invoicesrpc/invoices.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion lnrpc/invoicesrpc/invoices.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 11 additions & 1 deletion lnrpc/invoicesrpc/invoices.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions lnrpc/invoicesrpc/invoices_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 850dee3

Please sign in to comment.