Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/fast-actors-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Fix `eth_getBlockRange`
10 changes: 7 additions & 3 deletions l2geth/internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ import (
)

var (
errNoSequencerURL = errors.New("sequencer transaction forwarding not configured")
errStillSyncing = errors.New("sequencer still syncing, cannot accept transactions")
errNoSequencerURL = errors.New("sequencer transaction forwarding not configured")
errStillSyncing = errors.New("sequencer still syncing, cannot accept transactions")
errBlockNotIndexed = errors.New("block in range not indexed, this should never happen")
)

const (
Expand Down Expand Up @@ -780,9 +781,12 @@ func (s *PublicBlockChainAPI) GetBlockRange(ctx context.Context, startNumber rpc
// For each block in range, get block and append to array.
for number := startNumber; number <= endNumber; number++ {
block, err := s.GetBlockByNumber(ctx, number, fullTx)
if block == nil || err != nil {
if err != nil {
return nil, err
}
if block == nil {
return nil, errBlockNotIndexed
}
blocks = append(blocks, block)
}
return blocks, nil
Expand Down