mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
sqldb: fix end date filter when querying invoices
Previously, the SQL implementation of the invoice query simply converted the start and end timestamps to time and used them in SQL queries to check for inclusivity. However, this logic failed when the start and end timestamps were equal. This commit addresses and corrects this issue.
This commit is contained in:
parent
9298133614
commit
b62db3733d
@ -925,8 +925,10 @@ func (i *SQLStore) QueryInvoices(ctx context.Context,
|
||||
}
|
||||
|
||||
if q.CreationDateEnd != 0 {
|
||||
// We need to add 1 to the end date as we're
|
||||
// checking less than the end date in SQL.
|
||||
params.CreatedBefore = sqldb.SQLTime(
|
||||
time.Unix(q.CreationDateEnd, 0).UTC(),
|
||||
time.Unix(q.CreationDateEnd+1, 0).UTC(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ WHERE (
|
||||
created_at >= $6 OR
|
||||
$6 IS NULL
|
||||
) AND (
|
||||
created_at <= $7 OR
|
||||
created_at < $7 OR
|
||||
$7 IS NULL
|
||||
) AND (
|
||||
CASE
|
||||
|
@ -76,7 +76,7 @@ WHERE (
|
||||
created_at >= sqlc.narg('created_after') OR
|
||||
sqlc.narg('created_after') IS NULL
|
||||
) AND (
|
||||
created_at <= sqlc.narg('created_before') OR
|
||||
created_at < sqlc.narg('created_before') OR
|
||||
sqlc.narg('created_before') IS NULL
|
||||
) AND (
|
||||
CASE
|
||||
|
Loading…
Reference in New Issue
Block a user