Skip to content

Commit

Permalink
Remove extra variable in BlockSearch (cosmos#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raneet10 authored Feb 9, 2022
1 parent 566d728 commit 1a42c63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Month, DD, YYYY
- [rpc] [Implement ConsensusState/DumpConsensusState #273](https://github.com/celestiaorg/optimint/pull/273) [@tzdybal](https://github.com/tzdybal/)
- [rpc] [Implement Tx Method #272](https://github.com/celestiaorg/optimint/pull/272) [@mauriceLC92](https://github.com/mauriceLC92)
- [rpc] [Implement Commit and BlockSearch method #258](https://github.com/celestiaorg/optimint/pull/258) [@raneet10](https://github.com/Raneet10/)
- [rpc] [Remove extra variable #280](https://github.com/celestiaorg/optimint/pull/280) [@raneet10](https://github.com/Raneet10/)

### BUG FIXES

Expand Down
9 changes: 3 additions & 6 deletions rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,10 @@ func (c *Client) BlockSearch(ctx context.Context, query string, page, perPage *i
skipCount := validateSkipCount(pageVal, perPageVal)
pageSize := tmmath.MinInt(perPageVal, totalCount-skipCount)

pageResults := make([]int64, pageSize)
copy(pageResults, results[skipCount:skipCount+pageSize])

// Fetch the blocks
blocks := make([]*ctypes.ResultBlock, 0, len(pageResults))
for _, h := range pageResults {
b, err := c.node.Store.LoadBlock(uint64(h))
blocks := make([]*ctypes.ResultBlock, 0, pageSize)
for i := skipCount; i < skipCount+pageSize; i++ {
b, err := c.node.Store.LoadBlock(uint64(results[i]))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1a42c63

Please sign in to comment.