Skip to content

Commit

Permalink
rpcserver: include encoded payment requesting ListInvoices response
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Jan 13, 2017
1 parent d79530e commit 0bfdcde
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,13 +1245,20 @@ func (r *rpcServer) ListInvoices(ctx context.Context,

invoices := make([]*lnrpc.Invoice, len(dbInvoices))
for i, dbInvoice := range dbInvoices {
invoiceAmount := dbInvoice.Terms.Value
paymentPreimge := dbInvoice.Terms.PaymentPreimage[:]
invoice := &lnrpc.Invoice{
Memo: string(dbInvoice.Memo[:]),
Receipt: dbInvoice.Receipt[:],
RPreimage: dbInvoice.Terms.PaymentPreimage[:],
Value: int64(dbInvoice.Terms.Value),
RPreimage: paymentPreimge,
Value: int64(invoiceAmount),
Settled: dbInvoice.Terms.Settled,
CreationDate: dbInvoice.CreationDate.Unix(),
PaymentRequest: zpay32.Encode(&zpay32.PaymentRequest{
Destination: r.server.identityPriv.PubKey(),
PaymentHash: fastsha256.Sum256(paymentPreimge),
Amount: invoiceAmount,
}),
}

invoices[i] = invoice
Expand Down

0 comments on commit 0bfdcde

Please sign in to comment.