rpc: ensure new invoice fields are populated in RPC responses

This commit is contained in:
Olaoluwa Osuntokun
2018-04-24 21:03:05 -07:00
parent 2097564307
commit e4c5840472

View File

@@ -2737,6 +2737,9 @@ func createRPCInvoice(invoice *channeldb.Invoice) (*lnrpc.Invoice, error) {
CltvExpiry: cltvExpiry, CltvExpiry: cltvExpiry,
FallbackAddr: fallbackAddr, FallbackAddr: fallbackAddr,
RouteHints: routeHints, RouteHints: routeHints,
AddIndex: invoice.AddIndex,
SettleIndex: invoice.SettleIndex,
AmtPaid: int64(invoice.AmtPaid),
}, nil }, nil
} }
@@ -2833,7 +2836,7 @@ func (r *rpcServer) ListInvoices(ctx context.Context,
invoices := make([]*lnrpc.Invoice, len(dbInvoices)) invoices := make([]*lnrpc.Invoice, len(dbInvoices))
for i, dbInvoice := range dbInvoices { for i, dbInvoice := range dbInvoices {
rpcInvoice, err := createRPCInvoice(dbInvoice) rpcInvoice, err := createRPCInvoice(&dbInvoice)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -2867,6 +2870,7 @@ func (r *rpcServer) SubscribeInvoices(req *lnrpc.InvoiceSubscription,
if err := updateStream.Send(rpcInvoice); err != nil { if err := updateStream.Send(rpcInvoice); err != nil {
return err return err
} }
case <-r.quit: case <-r.quit:
return nil return nil
} }
@@ -2899,6 +2903,7 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest,
if err := updateStream.Send(detail); err != nil { if err := updateStream.Send(detail); err != nil {
return err return err
} }
case tx := <-txClient.UnconfirmedTransactions(): case tx := <-txClient.UnconfirmedTransactions():
detail := &lnrpc.Transaction{ detail := &lnrpc.Transaction{
TxHash: tx.Hash.String(), TxHash: tx.Hash.String(),
@@ -2909,6 +2914,7 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest,
if err := updateStream.Send(detail); err != nil { if err := updateStream.Send(detail); err != nil {
return err return err
} }
case <-r.quit: case <-r.quit:
return nil return nil
} }