From 0bfdcde96959754952e756340250f454350921e5 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 12 Jan 2017 18:52:31 -0800 Subject: [PATCH] rpcserver: include encoded payment requesting ListInvoices response --- rpcserver.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 3a755698..56b5877c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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