From 0571c89d1147b1b02d36a0fd925e6c9bb7eb5532 Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Fri, 6 Dec 2024 21:34:21 -0800 Subject: [PATCH] fix(execution): ignore duplicate tx errors in pool Skip "already known" errors when submitting transactions to Reth's tx pool since these are not actual failures and the tx is already where it needs to be. --- execution.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/execution.go b/execution.go index 402e4eb..4f62028 100644 --- a/execution.go +++ b/execution.go @@ -1,7 +1,6 @@ package execution import ( - "bytes" "context" "encoding/hex" "errors" @@ -238,15 +237,14 @@ func (c *EngineAPIExecutionClient) ExecuteTxs(ctx context.Context, txs []executi } } - // encode - txsPayload := make([][]byte, len(txs)) - for i, tx := range ethTxs { - buf := bytes.Buffer{} - err := tx.EncodeRLP(&buf) + for _, tx := range ethTxs { + err := c.ethClient.SendTransaction(ctx, tx) if err != nil { - return execution_types.Hash{}, 0, fmt.Errorf("failed to RLP encode tx: %w", err) + // ignore "already known" errors as they're not actual failures + if !strings.Contains(err.Error(), "already known") { + return execution_types.Hash{}, 0, fmt.Errorf("failed to send transaction: %w", err) + } } - txsPayload[i] = buf.Bytes() } // update forkchoice