Skip to content

Commit

Permalink
optimize finalized reader to use block id index
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Dec 21, 2023
1 parent 3d8d907 commit 8436f8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/finalizedreader/finalizedreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ func (r *FinalizedReader) FinalizedBlockIDAtHeight(height uint64) (flow.Identifi
return flow.ZeroID, fmt.Errorf("height not finalized (%v): %w", height, storage.ErrNotFound)
}

header, err := r.headers.ByHeight(height)
finalizedID, err := r.headers.BlockIDByHeight(height)
if err != nil {
return flow.ZeroID, err
}

return header.ID(), nil
return finalizedID, nil
}

// BlockFinalized implements the protocol.Consumer interface, which allows FinalizedReader
Expand Down

0 comments on commit 8436f8a

Please sign in to comment.