diff --git a/internal/storage/postgres/rollback.go b/internal/storage/postgres/rollback.go index 33c5eeb..2a5bcac 100644 --- a/internal/storage/postgres/rollback.go +++ b/internal/storage/postgres/rollback.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "strings" + "time" models "github.com/dipdup-io/starknet-indexer/internal/storage" "github.com/dipdup-net/indexer-sdk/pkg/storage" @@ -212,6 +213,7 @@ func (rm RollbackManager) rollbackTokenBalances(ctx context.Context, height uint end = false ) + maxRollbackTime := time.Now().AddDate(1, -1, 0) updates := make(map[string]*models.TokenBalance, 0) for !end { transfers, err := rm.transfers.Filter(ctx, @@ -220,6 +222,9 @@ func (rm RollbackManager) rollbackTokenBalances(ctx context.Context, height uint Height: models.IntegerFilter{ Gt: height, }, + Time: models.TimeFilter{ + Gt: uint64(maxRollbackTime.Unix()), + }, }, }, models.WithLimitFilter(limit),