Skip to content

Commit 2d9e11b

Browse files
committed
fix error handling
1 parent 369d736 commit 2d9e11b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

engine/access/state_stream/backend/backend.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,11 @@ func (b *StateStreamBackend) getExecutionData(ctx context.Context, height uint64
161161
if height == b.sporkRootBlockHeight {
162162
sporkRootBlockID, err := b.headers.BlockIDByHeight(b.sporkRootBlockHeight)
163163
if err != nil {
164-
if !errors.Is(err, storage.ErrNotFound) {
165-
return nil, fmt.Errorf("could not get block ID for root block height %d: %w", b.sporkRootBlockHeight, err)
166-
}
167164
// the spork root block will not exist locally if the node was bootstrapped with a newer
168-
// root block. In this case, just use a placeholder. This blockID is only used when serving
169-
// data for the root block, which will never happen if it does not exist locally.
170-
sporkRootBlockID = flow.ZeroID
165+
// root block. However, the logic that calls this method should have already checked that
166+
// the height is within the range of available data. Reaching this point means there is a
167+
// bug in the logic or the node is in an inconsistent state.
168+
return nil, fmt.Errorf("could not get block ID for root block height %d: %w", b.sporkRootBlockHeight, err)
171169
}
172170

173171
return &execution_data.BlockExecutionDataEntity{

0 commit comments

Comments
 (0)