Skip to content

Commit

Permalink
chore(taiko-client): rename io.EOF in iterators (#18777)
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp authored Jan 16, 2025
1 parent 8710cd8 commit c634425
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions packages/taiko-client/pkg/chain_iterator/block_batch_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io"
"math/big"
"time"

Expand All @@ -24,6 +23,7 @@ const (
)

var (
errEOF = errors.New("end of blockBatchIterator batch")
errContinue = errors.New("continue")
)

Expand Down Expand Up @@ -144,7 +144,7 @@ func (i *BlockBatchIterator) Iter() error {
break
}
if err := i.iter(); err != nil {
if errors.Is(err, io.EOF) {
if errors.Is(err, errEOF) {
log.Debug(
"Block batch iterator finished",
"start", i.startHeight,
Expand Down Expand Up @@ -212,7 +212,7 @@ func (i *BlockBatchIterator) iter() (err error) {
}

if i.current.Number.Uint64() >= destHeight {
return io.EOF
return errEOF
}

endHeight = i.current.Number.Uint64() + i.blocksReadPerEpoch
Expand All @@ -233,7 +233,7 @@ func (i *BlockBatchIterator) iter() (err error) {
}

if i.isEnd {
return io.EOF
return errEOF
}

i.current = endHeader
Expand All @@ -242,7 +242,7 @@ func (i *BlockBatchIterator) iter() (err error) {
return errContinue
}

return io.EOF
return errEOF
}

// updateCurrent updates the iterator's current cursor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package chainiterator

import (
"context"
"io"
"math/big"
"testing"
"time"
Expand Down Expand Up @@ -110,7 +109,7 @@ func (s *BlockBatchIteratorTestSuite) TestIterWithLessThanConfirmations() {
})

s.Nil(err)
s.Equal(io.EOF, iter.iter())
s.Equal(errEOF, iter.iter())
s.Equal(headHeight, lastEnd)
}

Expand Down

0 comments on commit c634425

Please sign in to comment.