mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 16:55:13 +02:00
channeldb/invoices+test: don't return invoices on reversed query at index 1
Previously a call to QueryInvoices with reversed=true and index_offset=1 would make the cursor point to the first available invoice (num 1) that would be returned as part of the response. This is inconsistent with the othre indexes, so we instead just return an empty list in this case. A test case for this situation is also added.
This commit is contained in:
@@ -460,6 +460,27 @@ func TestQueryInvoices(t *testing.T) {
|
||||
},
|
||||
expected: invoices[10:],
|
||||
},
|
||||
// Fetch one invoice, at index 1, reversed. Since invoice#1 is
|
||||
// the very first, there won't be any left in a reverse search,
|
||||
// so we expect no invoices to be returned.
|
||||
{
|
||||
query: InvoiceQuery{
|
||||
IndexOffset: 1,
|
||||
Reversed: true,
|
||||
NumMaxInvoices: 1,
|
||||
},
|
||||
expected: nil,
|
||||
},
|
||||
// Same as above, but don't restrict the number of invoices to
|
||||
// 1.
|
||||
{
|
||||
query: InvoiceQuery{
|
||||
IndexOffset: 1,
|
||||
Reversed: true,
|
||||
NumMaxInvoices: numInvoices,
|
||||
},
|
||||
expected: nil,
|
||||
},
|
||||
// Fetch all pending invoices with a single query.
|
||||
{
|
||||
query: InvoiceQuery{
|
||||
|
Reference in New Issue
Block a user