Skip to content

Commit 2c39844

Browse files
committed
fix(api): edge case returning less rows then requested
1 parent 807cab0 commit 2c39844

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

backend/pkg/api/data_access/vdb_withdrawals.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,6 @@ func (d *DataAccessService) GetValidatorDashboardClWithdrawals(ctx context.Conte
482482
}
483483

484484
moreDataFlag := len(responseData) > int(limit)
485-
486-
// Remove the last entry from data as it is only required for the check
487-
if moreDataFlag {
488-
responseData = responseData[:len(responseData)-1]
489-
queryResult = queryResult[:len(queryResult)-1]
490-
}
491-
492485
if currentCursor.IsReverse() {
493486
// Invert query result so response matches requested direction
494487
slices.Reverse(responseData)
@@ -551,12 +544,12 @@ func (d *DataAccessService) GetValidatorDashboardClWithdrawals(ctx context.Conte
551544
// No paging required
552545
return responseData, &t.Paging{}, nil
553546
}
547+
}
554548

555-
// Remove the last entry from data as it is only required for the check
556-
if moreDataFlag {
557-
responseData = responseData[:len(responseData)-1]
558-
queryResult = queryResult[:len(queryResult)-1]
559-
}
549+
// Remove the last entry from data as it is only required for the check
550+
if moreDataFlag {
551+
responseData = responseData[:len(responseData)-1]
552+
queryResult = queryResult[:len(queryResult)-1]
560553
}
561554

562555
paging, err := utils.GetPagingFromData(queryResult, currentCursor, moreDataFlag)

0 commit comments

Comments
 (0)