From 8639d5c044f1e4db228222b9b3e5939f619027d4 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 7 Jan 2025 09:53:18 +0100 Subject: [PATCH] core/txpool: don't track blobtxs, don't track invalid txs --- core/txpool/tracker/tx_tracker.go | 10 +++++++++- core/txpool/txpool.go | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/txpool/tracker/tx_tracker.go b/core/txpool/tracker/tx_tracker.go index 34a06c4f1b..53aa09ccdc 100644 --- a/core/txpool/tracker/tx_tracker.go +++ b/core/txpool/tracker/tx_tracker.go @@ -70,21 +70,29 @@ func New(journalPath string, journalTime time.Duration, chainConfig *params.Chai } // Track adds a transaction to the tracked set. +// Note: blob-type transactions are ignored. func (tracker *TxTracker) Track(tx *types.Transaction) { tracker.TrackAll([]*types.Transaction{tx}) } // TrackAll adds a list of transactions to the tracked set. +// Note: blob-type transactions are ignored. func (tracker *TxTracker) TrackAll(txs []*types.Transaction) { tracker.mu.Lock() defer tracker.mu.Unlock() for _, tx := range txs { + if tx.Type() == types.BlobTxType { + continue + } // If we're already tracking it, it's a no-op if _, ok := tracker.all[tx.Hash()]; ok { continue } tracker.all[tx.Hash()] = tx - addr, _ := types.Sender(tracker.signer, tx) + addr, err := types.Sender(tracker.signer, tx) + if err != nil { // Ignore this tx + continue + } if tracker.byAddr[addr] == nil { tracker.byAddr[addr] = legacypool.NewSortedMap() } diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index e5d9db8296..26c0b1b4a6 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -352,7 +352,6 @@ func (p *TxPool) Add(txs []*types.Transaction, sync bool) []error { // back the errors into the original sort order. errsets := make([][]error, len(p.subpools)) for i := 0; i < len(p.subpools); i++ { - // Note: local is explicitly set to false here. errsets[i] = p.subpools[i].Add(txsets[i], sync) } errs := make([]error, len(txs))