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

View File

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