diff --git a/services/horizon/internal/actions/helpers.go b/services/horizon/internal/actions/helpers.go index 885613d342..2575b13251 100644 --- a/services/horizon/internal/actions/helpers.go +++ b/services/horizon/internal/actions/helpers.go @@ -47,8 +47,6 @@ const ( DisableCursorValidation Opt = iota // DefaultTOID sets a default cursor value in GetPageQuery based on the ledger state DefaultTOID Opt = iota - - defaultLedgerCursorBuffer = 100 ) // HeaderWriter is an interface for setting HTTP response headers @@ -228,14 +226,6 @@ func GetPageQuery(ledgerState *ledger.State, r *http.Request, opts ...Opt) (db2. pageQuery.Cursor = toid.AfterLedger( ordered.Max(0, ledgerState.CurrentStatus().HistoryElder-1), ).String() - } else if pageQuery.Order == db2.OrderDescending { - pageQuery.Cursor = toid.AfterLedger( - // add an extra amount to the latest ledger in case the - // ledger state is out of date - ledgerState.CurrentStatus().HistoryLatest + defaultLedgerCursorBuffer, - ).String() - } else { - return db2.PageQuery{}, problem.BadRequest } } diff --git a/services/horizon/internal/actions/helpers_test.go b/services/horizon/internal/actions/helpers_test.go index 70fe3e03ce..05e840577e 100644 --- a/services/horizon/internal/actions/helpers_test.go +++ b/services/horizon/internal/actions/helpers_test.go @@ -311,7 +311,7 @@ func TestGetPageQueryCursorDefaultTOID(t *testing.T) { pq, err = GetPageQuery(ledgerState, descReq, DefaultTOID) assert.NoError(t, err) - assert.Equal(t, toid.AfterLedger(7000+defaultLedgerCursorBuffer).String(), pq.Cursor) + assert.Equal(t, "", pq.Cursor) assert.Equal(t, uint64(2), pq.Limit) assert.Equal(t, "desc", pq.Order) @@ -324,7 +324,7 @@ func TestGetPageQueryCursorDefaultTOID(t *testing.T) { pq, err = GetPageQuery(ledgerState, descReq) assert.NoError(t, err) assert.Empty(t, pq.Cursor) - assert.Equal(t, uint64(2), pq.Limit) + assert.Equal(t, "", pq.Cursor) assert.Equal(t, "desc", pq.Order) ledgerState.SetHorizonStatus(ledger.HorizonStatus{ @@ -342,7 +342,7 @@ func TestGetPageQueryCursorDefaultTOID(t *testing.T) { pq, err = GetPageQuery(ledgerState, descReq, DefaultTOID) assert.NoError(t, err) - assert.Equal(t, toid.AfterLedger(7000+defaultLedgerCursorBuffer).String(), pq.Cursor) + assert.Equal(t, "", pq.Cursor) assert.Equal(t, uint64(2), pq.Limit) assert.Equal(t, "desc", pq.Order)