Skip to content

Commit

Permalink
re-enable the get block fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed May 10, 2024
1 parent 0626ba1 commit 9941b3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 1 addition & 3 deletions fvm/environment/block_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ 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 {
// TODO replace with:
// return runtime.Block{}, false, nil
return runtime.Block{}, false, errors.NewBlockHeightOutOfRangeError(height)
return runtime.Block{}, false, nil
}

header, err := info.blocks.ByHeightFrom(height, info.blockHeader)
Expand Down
7 changes: 3 additions & 4 deletions fvm/environment/block_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ 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
// TODO: enable the test case
// _, exists, err = bi.GetBlockAtHeight(lowestAcceptedHeight - 1)
// require.NoError(t, err)
// require.False(t, exists)
_, exists, err = bi.GetBlockAtHeight(lowestAcceptedHeight - 1)
require.NoError(t, err)
require.False(t, exists)
}

type mockBlocks struct {
Expand Down

0 comments on commit 9941b3e

Please sign in to comment.