diff --git a/core/txpool/tracker/journal.go b/core/txpool/locals/journal.go
similarity index 99%
rename from core/txpool/tracker/journal.go
rename to core/txpool/locals/journal.go
index a0086483799f..46fd6de346db 100644
--- a/core/txpool/tracker/journal.go
+++ b/core/txpool/locals/journal.go
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package tracker
+package locals
import (
"errors"
diff --git a/core/txpool/tracker/tx_tracker.go b/core/txpool/locals/tx_tracker.go
similarity index 95%
rename from core/txpool/tracker/tx_tracker.go
rename to core/txpool/locals/tx_tracker.go
index 53aa09ccdc1e..e8783780d7f3 100644
--- a/core/txpool/tracker/tx_tracker.go
+++ b/core/txpool/locals/tx_tracker.go
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-// Package legacypool implements the normal EVM execution transaction pool.
-package tracker
+// Package locals implements tracking for "local" transactions
+package locals
import (
"sync"
@@ -26,11 +26,15 @@ import (
"github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
+ "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
"golang.org/x/exp/slices"
)
-var recheckInterval = time.Minute
+var (
+ recheckInterval = time.Minute
+ localGauge = metrics.GetOrRegisterGauge("txpool/local", nil)
+)
// TxTracker is a struct used to track priority transactions; it will check from
// time to time if the main pool has forgotten about any of the transaction
@@ -88,11 +92,11 @@ func (tracker *TxTracker) TrackAll(txs []*types.Transaction) {
if _, ok := tracker.all[tx.Hash()]; ok {
continue
}
- tracker.all[tx.Hash()] = tx
addr, err := types.Sender(tracker.signer, tx)
if err != nil { // Ignore this tx
continue
}
+ tracker.all[tx.Hash()] = tx
if tracker.byAddr[addr] == nil {
tracker.byAddr[addr] = legacypool.NewSortedMap()
}
@@ -101,6 +105,7 @@ func (tracker *TxTracker) TrackAll(txs []*types.Transaction) {
_ = tracker.journal.insert(tx)
}
}
+ localGauge.Update(int64(len(tracker.all)))
}
// recheck checks and returns any transactions that needs to be resubmitted.
@@ -142,6 +147,7 @@ func (tracker *TxTracker) recheck(journalCheck bool) (resubmits []*types.Transac
})
}
}
+ localGauge.Update(int64(len(tracker.all)))
log.Debug("Tx tracker status", "need-resubmit", len(resubmits), "stale", numStales, "ok", numOk)
return resubmits, rejournal
}
diff --git a/eth/backend.go b/eth/backend.go
index 6963f95db1c7..5cf1a338b699 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -36,7 +36,7 @@ import (
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/txpool/blobpool"
"github.com/ethereum/go-ethereum/core/txpool/legacypool"
- "github.com/ethereum/go-ethereum/core/txpool/tracker"
+ "github.com/ethereum/go-ethereum/core/txpool/locals"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/downloader"
@@ -71,7 +71,7 @@ type Ethereum struct {
// core protocol objects
config *ethconfig.Config
txPool *txpool.TxPool
- localTxTracker *tracker.TxTracker
+ localTxTracker *locals.TxTracker
blockchain *core.BlockChain
handler *handler
@@ -244,7 +244,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
log.Warn("Sanitizing invalid txpool journal time", "provided", rejournal, "updated", time.Second)
rejournal = time.Second
}
- eth.localTxTracker = tracker.New(config.TxPool.Journal, rejournal, eth.blockchain.Config(), eth.txPool)
+ eth.localTxTracker = locals.New(config.TxPool.Journal, rejournal, eth.blockchain.Config(), eth.txPool)
stack.RegisterLifecycle(eth.localTxTracker)
}