Skip to content

Commit

Permalink
fix index underflow in GetWithdrawalRequestsByFilter / GetConsolidati…
Browse files Browse the repository at this point in the history
…onRequestsByFilter
  • Loading branch information
pk910 committed Oct 16, 2024
1 parent 60a1bf1 commit 64038db
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions services/chainservice_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,12 @@ func (bs *ChainService) GetWithdrawalRequestsByFilter(filter *dbtypes.Withdrawal
}

// load older objects from db
dbPage := pageIdx - cachedPages
var dbPage uint64
if pageIdx > cachedPages {
dbPage = pageIdx - cachedPages
} else {
dbPage = 0
}
dbCacheOffset := uint64(pageSize) - (cachedMatchesLen % uint64(pageSize))

var dbObjects []*dbtypes.WithdrawalRequest
Expand Down Expand Up @@ -571,7 +576,12 @@ func (bs *ChainService) GetConsolidationRequestsByFilter(filter *dbtypes.Consoli
}

// load older objects from db
dbPage := pageIdx - cachedPages
var dbPage uint64
if pageIdx > cachedPages {
dbPage = pageIdx - cachedPages
} else {
dbPage = 0
}
dbCacheOffset := uint64(pageSize) - (cachedMatchesLen % uint64(pageSize))

var dbObjects []*dbtypes.ConsolidationRequest
Expand Down

0 comments on commit 64038db

Please sign in to comment.