From 1cb42c59c5bd88b7de5cd40cea3b02c15a620225 Mon Sep 17 00:00:00 2001 From: "allen.wu" Date: Tue, 25 Aug 2026 15:20:36 +0800 Subject: [PATCH] fix: stop retry newL2BlockV2 when this block is already known --- node/core/executor.go | 4 +++- node/types/retryable_client.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/node/core/executor.go b/node/core/executor.go index 0c581973e..a271906a9 100644 --- a/node/core/executor.go +++ b/node/core/executor.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "math/big" + "strings" syncos "sync" "github.com/morph-l2/go-ethereum/accounts/abi/bind" @@ -475,7 +476,8 @@ func (e *Executor) ApplyBlockV2(block *l2node.BlockV2) (applied bool, err error) } } - if _, err := e.l2Client.NewL2BlockV2(context.Background(), execBlock); err != nil { + if _, err := e.l2Client.NewL2BlockV2(context.Background(), execBlock); err != nil && + !strings.Contains(err.Error(), types.BlockAlreadyKnownError) { e.logger.Error("failed to apply block v2", "number", execBlock.Number, "hash", execBlock.Hash.Hex(), diff --git a/node/types/retryable_client.go b/node/types/retryable_client.go index ffe9f7f3f..0f0e69a71 100644 --- a/node/types/retryable_client.go +++ b/node/types/retryable_client.go @@ -36,6 +36,7 @@ const ( // always fail and only delay error surfacing to the consensus layer. BlockHashMismatchError = "block hash mismatch" InvalidNextL1MsgIndexError = "invalid block.NextL1MsgIndex" + BlockAlreadyKnownError = "block already known" // Geth connection retry settings GethRetryAttempts = 60 // max retry attempts @@ -296,7 +297,8 @@ func retryableError(err error) bool { !strings.Contains(msg, WrongBlockNumberError) && !strings.Contains(msg, ParentNotFoundError) && !strings.Contains(msg, BlockHashMismatchError) && - !strings.Contains(msg, InvalidNextL1MsgIndexError) + !strings.Contains(msg, InvalidNextL1MsgIndexError) && + !strings.Contains(msg, BlockAlreadyKnownError) } // ============================================================================