invoices: store custom records in invoice database

This commit is contained in:
Joost Jager committed 2019-12-10 06:54:24 +01:00
1 parent 37258c414c
commit 5f4bd136cd
10 files changed
+725 -584

No files matched your search

+7 -3
View File
@@ -3,6 +3,8 @@ package invoices
import (
"errors"
"github.com/lightningnetwork/lnd/htlcswitch/hop"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/lnwire"
)
@@ -74,6 +76,7 @@ type invoiceUpdateCtx struct {
expiry uint32
currentHeight int32
finalCltvRejectDelta int32
customRecords hop.CustomRecordSet
}
// updateInvoice is a callback for DB.UpdateInvoice that contains the invoice
@@ -125,9 +128,10 @@ func updateInvoice(ctx *invoiceUpdateCtx, inv *channeldb.Invoice) (
// Record HTLC in the invoice database.
newHtlcs := map[channeldb.CircuitKey]*channeldb.HtlcAcceptDesc{
ctx.circuitKey: {
Amt: ctx.amtPaid,
Expiry: ctx.expiry,
AcceptHeight: ctx.currentHeight,
Amt: ctx.amtPaid,
Expiry: ctx.expiry,
AcceptHeight: ctx.currentHeight,
CustomRecords: ctx.customRecords,
},
}