Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] del redundant code #4212

Merged
merged 7 commits into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/coreservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ func (core *coreService) readState(ctx context.Context, p protocol.Protocol, hei
return d, h, err
}

func (core *coreService) getActionsFromIndex(totalActions, start, count uint64) ([]*iotexapi.ActionInfo, error) {
func (core *coreService) getActionsFromIndex(start, count uint64) ([]*iotexapi.ActionInfo, error) {
hashes, err := core.indexer.GetActionHashFromIndex(start, count)
if err != nil {
return nil, status.Error(codes.Unavailable, err.Error())
Expand Down Expand Up @@ -994,14 +994,14 @@ func (core *coreService) Actions(start uint64, count uint64) ([]*iotexapi.Action
if start >= totalActions {
return nil, status.Error(codes.InvalidArgument, "start exceeds the total actions in the block")
}
if totalActions == uint64(0) || count == 0 {
if totalActions == uint64(0) {
return []*iotexapi.ActionInfo{}, nil
}
if start+count > totalActions {
count = totalActions - start
}
if core.indexer != nil {
return core.getActionsFromIndex(totalActions, start, count)
return core.getActionsFromIndex(start, count)
}
// Finding actions in reverse order saves time for querying most recent actions
reverseStart := totalActions - (start + count)
Expand Down
Loading