channeldb/invoices: ignore error when no settles exist

This fixes a bug that would cause no backlog to be delivered at all.
This commit is contained in:
Conner Fromknecht committed 2020-05-26 17:50:45 -07:00
1 parent d32c7a4814
commit 1332575482
2 files changed
+12 -10

No files matched your search

+7
View File
@@ -11,6 +11,7 @@ import (
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/record"
"github.com/stretchr/testify/assert"
)
var (
@@ -305,6 +306,9 @@ func TestInvoiceAddTimeSeries(t *testing.T) {
t.Fatalf("unable to make test db: %v", err)
}
_, err = db.InvoicesAddedSince(0)
assert.Nil(t, err)
// We'll start off by creating 20 random invoices, and inserting them
// into the database.
const numInvoices = 20
@@ -372,6 +376,9 @@ func TestInvoiceAddTimeSeries(t *testing.T) {
}
}
_, err = db.InvoicesSettledSince(0)
assert.Nil(t, err)
var settledInvoices []Invoice
var settleIndex uint64 = 1
// We'll now only settle the latter half of each of those invoices.