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:
parent
c8d11285f3
commit
f4933c67fd
@ -1007,6 +1007,18 @@ func TestQueryInvoices(t *testing.T) {
|
|||||||
// still pending.
|
// still pending.
|
||||||
expected: pendingInvoices[len(pendingInvoices)-15:],
|
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 {
|
for i, testCase := range testCases {
|
||||||
|
Loading…
Reference in New Issue
Block a user