Skip to content

Commit a867a0d

Browse files
authored
rollup: fix cache eviction logic (ethereum#98)
1 parent 7320d02 commit a867a0d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

rollup/sync_service.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
218218
eth1NetworkId: cfg.Eth1NetworkId,
219219
ctcDeployHeight: cfg.CanonicalTransactionChainDeployHeight,
220220
db: db,
221-
clearTransactionsAfter: (5760 * 15), // 15 days worth of blocks
221+
clearTransactionsAfter: (5760 * 18), // 18 days worth of blocks
222222
clearTransactionsTicker: time.NewTicker(time.Hour),
223223
sequencerIngestTicker: time.NewTicker(15 * time.Second),
224224
txCache: NewTransactionCache(),
@@ -556,10 +556,9 @@ func (s *SyncService) ClearTransactionLoop() {
556556
continue
557557
}
558558
currentHeight := tip.Number.Uint64()
559-
560559
count := 0
561560
s.txCache.Range(func(index uint64, rtx *RollupTransaction) {
562-
if rtx.blockHeight+s.clearTransactionsAfter > currentHeight {
561+
if rtx.executed && rtx.blockHeight+s.clearTransactionsAfter <= currentHeight {
563562
log.Debug("Clearing transaction from transaction cache", "hash", rtx.tx.Hash(), "index", index)
564563
s.txCache.Delete(index)
565564
count++

0 commit comments

Comments
 (0)