Skip to content

Commit

Permalink
tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Jul 20, 2024
1 parent a96c73b commit f089f48
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func (m *Monitor) rpcBlockByNumber(blockNumber uint64) (*types.Block, error) {
return nil, err //errors.New("[ Internal IPC Error ] try to get block out of times")
}

func (m *Monitor) rpcBatchBlockByNumber(from, to uint64) (result []*types.Block, err error) {
func (m *Monitor) rpcBatchBlockByNumber(from, to uint64) ([]*types.Block, error) {
batch := to - from
result = make([]*types.Block, batch)
result := make([]*types.Block, batch)
reqs := make([]rpc.BatchElem, batch)
for i := range reqs {
reqs[i] = rpc.BatchElem{
Expand All @@ -90,7 +90,9 @@ func (m *Monitor) rpcBatchBlockByNumber(from, to uint64) (result []*types.Block,
}
}

err = m.cl.BatchCall(reqs)
if err := m.cl.BatchCall(reqs); err != nil {
return nil, err
}

for i := range reqs {
if reqs[i].Error != nil {
Expand All @@ -101,7 +103,7 @@ func (m *Monitor) rpcBatchBlockByNumber(from, to uint64) (result []*types.Block,
}
}

return
return result, nil
}

func (m *Monitor) rpcBatchBlockByNumberLegacy(from, to uint64) (result []*types.Block, err error) {
Expand Down

0 comments on commit f089f48

Please sign in to comment.