mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 23:53:41 +02:00
channeldb+invoices: add ScanInvoices and integrate with InvoiceRegistry
This commit adds channeldb.ScanInvoices to scan through all invoices in the database. The new call will also replace the already existing channeldb.FetchAllInvoicesWithPaymentHash call in preparation to collect invoices we'd like to delete and watch for expiry in one scan in later commits.
This commit is contained in:
@@ -158,24 +158,14 @@ func TestInvoiceExpiryWhenAddingMultipleInvoices(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
test := newInvoiceExpiryWatcherTest(t, testTime, 5, 5)
|
||||
var invoices []channeldb.InvoiceWithPaymentHash
|
||||
invoices := make(map[lntypes.Hash]*channeldb.Invoice)
|
||||
|
||||
for hash, invoice := range test.testData.expiredInvoices {
|
||||
invoices = append(invoices,
|
||||
channeldb.InvoiceWithPaymentHash{
|
||||
Invoice: *invoice,
|
||||
PaymentHash: hash,
|
||||
},
|
||||
)
|
||||
invoices[hash] = invoice
|
||||
}
|
||||
|
||||
for hash, invoice := range test.testData.pendingInvoices {
|
||||
invoices = append(invoices,
|
||||
channeldb.InvoiceWithPaymentHash{
|
||||
Invoice: *invoice,
|
||||
PaymentHash: hash,
|
||||
},
|
||||
)
|
||||
invoices[hash] = invoice
|
||||
}
|
||||
|
||||
test.watcher.AddInvoices(invoices)
|
||||
|
Reference in New Issue
Block a user