Skip to content

Commit 08c6be8

Browse files
Halt a node if it errors when applying a block from the sequencer (#1438)
<!-- 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. --> ## Overview Closes: #1437 <!-- 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. --> ## Checklist <!-- Please complete the checklist to ensure that the PR is ready to be reviewed. IMPORTANT: PRs should be left in Draft until the below checklist is completed. --> - [x] New and updated code has appropriate documentation - [ ] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [ ] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved error handling in the block synchronization process to ensure node stability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 7abee7c commit 08c6be8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

block/manager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,11 @@ func (m *Manager) trySyncNextBlock(ctx context.Context, daHeight uint64) error {
406406
}
407407
newState, responses, err := m.applyBlock(ctx, b)
408408
if err != nil {
409-
return fmt.Errorf("failed to ApplyBlock: %w", err)
409+
if ctx.Err() != nil {
410+
return err
411+
}
412+
// if call to applyBlock fails, we halt the node, see https://github.com/cometbft/cometbft/pull/496
413+
panic(fmt.Errorf("failed to ApplyBlock: %w", err))
410414
}
411415
err = m.store.SaveBlock(b, &b.SignedHeader.Commit)
412416
if err != nil {

0 commit comments

Comments
 (0)