Skip to content

Commit

Permalink
fix: checkpoint query
Browse files Browse the repository at this point in the history
Signed-off-by: Clément Salaün <[email protected]>
  • Loading branch information
altitude committed Feb 5, 2024
1 parent b5907d6 commit b37dff6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/storage/sqlstorage/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ func (s *Store) buildTransactionsQuery(flavor Flavor, p ledger.TransactionsQuery
if !endTime.IsZero() {
sb.Where(sb.L("timestamp", endTime.UTC()))
sub := sqlbuilder.NewSelectBuilder()
sb.Where(sb.In("id", sub.Select("txid").From(s.schema.Table("accounts_checkpoints")).Where(sub.L("last_tx_at", endTime.UTC()))))
sb.Where(
sb.In(
"id",
sub.Select("txid").
From(s.schema.Table("accounts_checkpoints")).
Where(sub.LE("last_tx_at", endTime.UTC())).
OrderBy("last_tx_at").Desc(),
),
)
t.EndTime = endTime
}

Expand Down

0 comments on commit b37dff6

Please sign in to comment.