Skip to content

Commit

Permalink
Merge pull request #5895 from onflow/leo/v0.33-revert-get-block-fix
Browse files Browse the repository at this point in the history
v0.33 revert get block fix
  • Loading branch information
zhangchiqing committed May 13, 2024
2 parents 5fd8467 + 0626ba1 commit d9bc232
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion fvm/environment/block_info.go
Expand Up @@ -145,7 +145,9 @@ func (info *blockInfo) GetBlockAtHeight(
// Check if the requested block height is within the range of the current
// block height and the extra blocks in the root sealing segment.
if height+uint64(flow.ExtraBlocksInRootSealingSegment) < info.blockHeader.Height {
return runtime.Block{}, false, nil
// TODO replace with:
// return runtime.Block{}, false, nil
return runtime.Block{}, false, errors.NewBlockHeightOutOfRangeError(height)
}

header, err := info.blocks.ByHeightFrom(height, info.blockHeader)
Expand Down
7 changes: 4 additions & 3 deletions fvm/environment/block_info_test.go
Expand Up @@ -47,9 +47,10 @@ func TestBlockInfo(t *testing.T) {
require.Equal(t, lowestHeader.Height, b.Height)

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

type mockBlocks struct {
Expand Down

0 comments on commit d9bc232

Please sign in to comment.