Skip to content

Commit 3d2a4cb

Browse files
authored
core: remove unused peek function in insertIterator (#33155)
1 parent d8f9801 commit 3d2a4cb

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

core/blockchain_insert.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,28 +131,6 @@ func (it *insertIterator) next() (*types.Block, error) {
131131
return it.chain[it.index], it.validator.ValidateBody(it.chain[it.index])
132132
}
133133

134-
// peek returns the next block in the iterator, along with any potential validation
135-
// error for that block, but does **not** advance the iterator.
136-
//
137-
// Both header and body validation errors (nil too) is cached into the iterator
138-
// to avoid duplicating work on the following next() call.
139-
// nolint:unused
140-
func (it *insertIterator) peek() (*types.Block, error) {
141-
// If we reached the end of the chain, abort
142-
if it.index+1 >= len(it.chain) {
143-
return nil, nil
144-
}
145-
// Wait for verification result if not yet done
146-
if len(it.errors) <= it.index+1 {
147-
it.errors = append(it.errors, <-it.results)
148-
}
149-
if it.errors[it.index+1] != nil {
150-
return it.chain[it.index+1], it.errors[it.index+1]
151-
}
152-
// Block header valid, ignore body validation since we don't have a parent anyway
153-
return it.chain[it.index+1], nil
154-
}
155-
156134
// previous returns the previous header that was being processed, or nil.
157135
func (it *insertIterator) previous() *types.Header {
158136
if it.index < 1 {

0 commit comments

Comments
 (0)