Skip to content

Commit c5a936f

Browse files
refactor: return types.State{} instead of state for err != nil case (#1735)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview Closes: #1734 <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling in state updates to ensure a clean state is returned in error scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 81e92f0 commit c5a936f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

state/executor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func (e *BlockExecutor) updateState(state types.State, block *types.Block, final
299299
if finalizeBlockResponse.ConsensusParamUpdates != nil {
300300
nextParamsProto, appVersion, err := e.updateConsensusParams(height, types.ConsensusParamsFromProto(state.ConsensusParams), finalizeBlockResponse.ConsensusParamUpdates)
301301
if err != nil {
302-
return state, err
302+
return types.State{}, err
303303
}
304304
// Change results from this height but only applies to the next height.
305305
state.LastHeightConsensusParamsChanged = height + 1

0 commit comments

Comments
 (0)