rpcserver: include new proto fields in ListInvoices rpc

This commit is contained in:
Wilmer Paulino 2018-09-10 18:21:13 -07:00
parent 8e151ffd3f
commit 012d4f5c8c
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -2888,6 +2888,7 @@ func (r *rpcServer) ListInvoices(ctx context.Context,
IndexOffset: req.IndexOffset, IndexOffset: req.IndexOffset,
NumMaxInvoices: req.NumMaxInvoices, NumMaxInvoices: req.NumMaxInvoices,
PendingOnly: req.PendingOnly, PendingOnly: req.PendingOnly,
Reversed: req.Reversed,
} }
invoiceSlice, err := r.server.chanDB.QueryInvoices(q) invoiceSlice, err := r.server.chanDB.QueryInvoices(q)
if err != nil { if err != nil {
@ -2898,10 +2899,11 @@ func (r *rpcServer) ListInvoices(ctx context.Context,
// into it's proto representation. // into it's proto representation.
resp := &lnrpc.ListInvoiceResponse{ resp := &lnrpc.ListInvoiceResponse{
Invoices: make([]*lnrpc.Invoice, len(invoiceSlice.Invoices)), Invoices: make([]*lnrpc.Invoice, len(invoiceSlice.Invoices)),
FirstIndexOffset: invoiceSlice.FirstIndexOffset,
LastIndexOffset: invoiceSlice.LastIndexOffset, LastIndexOffset: invoiceSlice.LastIndexOffset,
} }
for i, invoice := range invoiceSlice.Invoices { for i, invoice := range invoiceSlice.Invoices {
resp.Invoices[i], err = createRPCInvoice(invoice) resp.Invoices[i], err = createRPCInvoice(&invoice)
if err != nil { if err != nil {
return nil, err return nil, err
} }