Skip to content

Commit 008a57d

Browse files
authored
rollup: do not add reorganized txs to mempool (ethereum#92)
* rollup: do not add reorganized txs to mempool * txpool: fix build * txpool: hide behind usingovm
1 parent 7099c4c commit 008a57d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

core/tx_pool.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"math"
2323
"math/big"
24+
"os"
2425
"sort"
2526
"sync"
2627
"time"
@@ -1168,10 +1169,14 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
11681169
pool.pendingNonces = newTxNoncer(statedb)
11691170
pool.currentMaxGas = newHead.GasLimit
11701171

1171-
// Inject any transactions discarded due to reorgs
1172-
log.Debug("Reinjecting stale transactions", "count", len(reinject))
1173-
senderCacher.recover(pool.signer, reinject)
1174-
pool.addTxsLocked(reinject, false)
1172+
// OVM Change. Do not reinject reorganized transactions
1173+
// into the mempool.
1174+
if os.Getenv("USING_OVM") != "true" {
1175+
// Inject any transactions discarded due to reorgs
1176+
log.Debug("Reinjecting stale transactions", "count", len(reinject))
1177+
senderCacher.recover(pool.signer, reinject)
1178+
pool.addTxsLocked(reinject, false)
1179+
}
11751180

11761181
// Update all fork indicator by next pending block number.
11771182
next := new(big.Int).Add(newHead.Number, big.NewInt(1))

rollup/sync_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ func (s *SyncService) maybeReorg(index uint64, tx *types.Transaction) error {
998998
// due to nonces coming from the god key. Do an equality check using
999999
// `to`, `data`, `l1TxOrigin` and `gasLimit`
10001000
if !isCtcTxEqual(tx, prev) {
1001-
log.Info("Different transaction detected, reorganizing", "new", tx.Hash().Hex(), "previous", prev.Hash().Hex())
1001+
log.Info("Different transaction detected, reorganizing", "new", tx.Hash().Hex(), "previous", prev.Hash().Hex(), "index", index)
10021002
// Set the sync status to true. This will grab a lock around
10031003
// the mempool such that transactions will no longer be able to come
10041004
// via RPC.

0 commit comments

Comments
 (0)