Skip to content

Commit 80a5a51

Browse files
authored
Merge pull request #6022 from onflow/leo/v0.33-get-block-fix
Backport v0.33 fix get block API
2 parents 8b59990 + 4a2c143 commit 80a5a51

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

fvm/environment/block_info.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ func (info *blockInfo) GetBlockAtHeight(
145145
// Check if the requested block height is within the range of the current
146146
// block height and the extra blocks in the root sealing segment.
147147
if height+uint64(flow.ExtraBlocksInRootSealingSegment) < info.blockHeader.Height {
148-
// TODO replace with:
149-
// return runtime.Block{}, false, nil
150-
return runtime.Block{}, false, errors.NewBlockHeightOutOfRangeError(height)
148+
return runtime.Block{}, false, nil
151149
}
152150

153151
header, err := info.blocks.ByHeightFrom(height, info.blockHeader)

fvm/environment/block_info_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ func TestBlockInfo(t *testing.T) {
4747
require.Equal(t, lowestHeader.Height, b.Height)
4848

4949
// verify that the block at the height before the lowest accepted height does not exist
50-
// TODO: enable the test case
51-
// _, exists, err = bi.GetBlockAtHeight(lowestAcceptedHeight - 1)
52-
// require.NoError(t, err)
53-
// require.False(t, exists)
50+
_, exists, err = bi.GetBlockAtHeight(lowestAcceptedHeight - 1)
51+
require.NoError(t, err)
52+
require.False(t, exists)
5453
}
5554

5655
type mockBlocks struct {

0 commit comments

Comments
 (0)