Commit aae3935c authored by Ethen Pociask's avatar Ethen Pociask

[indexer.bridge_offset_fix] Added code comments to header_traversal.go

parent dac8f106
......@@ -49,7 +49,7 @@ func (f *HeaderTraversal) NextFinalizedHeaders(maxSize uint64) ([]types.Header,
if f.lastHeader != nil {
cmp := f.lastHeader.Number.Cmp(endHeight)
if cmp == 0 {
if cmp == 0 { // We're synced to head and there are no new headers
return nil, nil
} else if cmp > 0 {
return nil, ErrHeaderTraversalAheadOfProvider
......@@ -61,6 +61,7 @@ func (f *HeaderTraversal) NextFinalizedHeaders(maxSize uint64) ([]types.Header,
nextHeight = new(big.Int).Add(f.lastHeader.Number, bigint.One)
}
// endHeight = (nextHeight - endHeight) <= maxSize
endHeight = bigint.Clamp(nextHeight, endHeight, maxSize)
headers, err := f.ethClient.BlockHeadersByRange(nextHeight, endHeight)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment