channeldb: add test case for index offset greater than index

In our current invoice pagination logic, we would not return any
invoices if our offset index was more than 1 off our last index and we
were paginating backwards. This commit adds a test case for this
behaviour before fixing it in the next commit.
This commit is contained in:
carla 2020-06-10 12:34:27 +02:00
parent c8d11285f3
commit f4933c67fd
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -1007,6 +1007,18 @@ func TestQueryInvoices(t *testing.T) {
// still pending.
expected: pendingInvoices[len(pendingInvoices)-15:],
},
// Fetch all invoices paginating backwards, with an index offset
// that is beyond our last offset. We currently do not return
// anything if our index is greater than our last index.
{
query: InvoiceQuery{
IndexOffset: numInvoices * 2,
PendingOnly: false,
Reversed: true,
NumMaxInvoices: numInvoices,
},
expected: nil,
},
}
for i, testCase := range testCases {