Skip to content

Commit 184f42f

Browse files
authored
refactor(block): improve cancellation (#2741)
<!-- 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 Once the SaveBlockData has been saved we must update the height and the state. context.TODO() should be reverted to the real context (e.ctx) once #2274 has been implemented, this prevents context cancellation messing up state. <!-- 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> -->
1 parent a491aee commit 184f42f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

block/internal/executing/executor.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,13 @@ func (e *Executor) produceBlock() error {
381381
return fmt.Errorf("failed to save block: %w", err)
382382
}
383383

384-
if err := e.store.SetHeight(e.ctx, newHeight); err != nil {
384+
// Once the SaveBlockData has been saved we must update the height and the state.
385+
// context.TODO() should be reverted to the real context (e.ctx) once https://github.com/evstack/ev-node/issues/2274 has been implemented, this prevents context cancellation
386+
if err := e.store.SetHeight(context.TODO(), newHeight); err != nil {
385387
return fmt.Errorf("failed to update store height: %w", err)
386388
}
387389

388-
if err := e.updateState(e.ctx, newState); err != nil {
390+
if err := e.updateState(context.TODO(), newState); err != nil {
389391
return fmt.Errorf("failed to update state: %w", err)
390392
}
391393

0 commit comments

Comments
 (0)