From 0626ba17b01de6da8f783076fc0fe193a0065729 Mon Sep 17 00:00:00 2001 From: "Leo Zhang (zhangchiqing)" Date: Fri, 10 May 2024 16:36:14 -0700 Subject: [PATCH] revert get block fix --- fvm/environment/block_info.go | 4 +++- fvm/environment/block_info_test.go | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fvm/environment/block_info.go b/fvm/environment/block_info.go index 29a9b5dee48..8f93703cfe0 100644 --- a/fvm/environment/block_info.go +++ b/fvm/environment/block_info.go @@ -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) diff --git a/fvm/environment/block_info_test.go b/fvm/environment/block_info_test.go index 99e15a0378f..e7bcc64ccf6 100644 --- a/fvm/environment/block_info_test.go +++ b/fvm/environment/block_info_test.go @@ -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 {