Skip to content

Commit

Permalink
fix(execution): ignore duplicate tx errors in pool
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jim380 committed Dec 7, 2024
1 parent cccf96c commit 0571c89
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions execution.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package execution

import (
"bytes"
"context"
"encoding/hex"
"errors"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0571c89

Please sign in to comment.