rpcserver: include encoded payment requesting ListInvoices response
This commit is contained in:
parent
d79530e25d
commit
0bfdcde969
11
rpcserver.go
11
rpcserver.go
@ -1245,13 +1245,20 @@ 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 {
|
||||||
|
invoiceAmount := dbInvoice.Terms.Value
|
||||||
|
paymentPreimge := dbInvoice.Terms.PaymentPreimage[:]
|
||||||
invoice := &lnrpc.Invoice{
|
invoice := &lnrpc.Invoice{
|
||||||
Memo: string(dbInvoice.Memo[:]),
|
Memo: string(dbInvoice.Memo[:]),
|
||||||
Receipt: dbInvoice.Receipt[:],
|
Receipt: dbInvoice.Receipt[:],
|
||||||
RPreimage: dbInvoice.Terms.PaymentPreimage[:],
|
RPreimage: paymentPreimge,
|
||||||
Value: int64(dbInvoice.Terms.Value),
|
Value: int64(invoiceAmount),
|
||||||
Settled: dbInvoice.Terms.Settled,
|
Settled: dbInvoice.Terms.Settled,
|
||||||
CreationDate: dbInvoice.CreationDate.Unix(),
|
CreationDate: dbInvoice.CreationDate.Unix(),
|
||||||
|
PaymentRequest: zpay32.Encode(&zpay32.PaymentRequest{
|
||||||
|
Destination: r.server.identityPriv.PubKey(),
|
||||||
|
PaymentHash: fastsha256.Sum256(paymentPreimge),
|
||||||
|
Amount: invoiceAmount,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
invoices[i] = invoice
|
invoices[i] = invoice
|
||||||
|
Loading…
Reference in New Issue
Block a user