diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go
index 985e4d5567..7a0888f4f6 100644
--- a/core/txpool/blobpool/blobpool.go
+++ b/core/txpool/blobpool/blobpool.go
@@ -1699,13 +1699,6 @@ func (p *BlobPool) ContentFrom(addr common.Address) ([]*types.Transaction, []*ty
return []*types.Transaction{}, []*types.Transaction{}
}
-// Locals retrieves the accounts currently considered local by the pool.
-//
-// There is no notion of local accounts in the blob pool.
-func (p *BlobPool) Locals() []common.Address {
- return []common.Address{}
-}
-
// Status returns the known status (unknown/pending/queued) of a transaction
// identified by their hashes.
func (p *BlobPool) Status(hash common.Hash) txpool.TxStatus {
diff --git a/core/txpool/legacypool/legacypool_test.go b/core/txpool/legacypool/legacypool_test.go
index 7f37317d50..b8152e0b39 100644
--- a/core/txpool/legacypool/legacypool_test.go
+++ b/core/txpool/legacypool/legacypool_test.go
@@ -2245,34 +2245,6 @@ func benchmarkBatchInsert(b *testing.B, size int) {
}
}
-func BenchmarkInsertRemoteWithAllLocals(b *testing.B) {
- // Allocate keys for testing
- key, _ := crypto.GenerateKey()
- account := crypto.PubkeyToAddress(key.PublicKey)
-
- remoteKey, _ := crypto.GenerateKey()
- remoteAddr := crypto.PubkeyToAddress(remoteKey.PublicKey)
-
- remotes := make([]*types.Transaction, 1000)
- for i := 0; i < len(remotes); i++ {
- remotes[i] = pricedTransaction(uint64(i), 100000, big.NewInt(2), remoteKey) // Higher gasprice
- }
- // Benchmark importing the transactions into the queue
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- b.StopTimer()
- pool, _ := setupPool()
- testAddBalance(pool, account, big.NewInt(100000000))
- b.StartTimer()
- // Assign a high enough balance for testing
- testAddBalance(pool, remoteAddr, big.NewInt(100000000))
- for i := 0; i < len(remotes); i++ {
- pool.addRemotes([]*types.Transaction{remotes[i]})
- }
- pool.Close()
- }
-}
-
// Benchmarks the speed of batch transaction insertion in case of multiple accounts.
func BenchmarkMultiAccountBatchInsert(b *testing.B) {
// Generate a batch of transactions to enqueue into the pool
diff --git a/core/txpool/tracking/journal.go b/core/txpool/tracker/journal.go
similarity index 99%
rename from core/txpool/tracking/journal.go
rename to core/txpool/tracker/journal.go
index ba40b885b9..a008648379 100644
--- a/core/txpool/tracking/journal.go
+++ b/core/txpool/tracker/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 tracking
+package tracker
import (
"errors"
diff --git a/core/txpool/tracking/tx_tracker.go b/core/txpool/tracker/tx_tracker.go
similarity index 89%
rename from core/txpool/tracking/tx_tracker.go
rename to core/txpool/tracker/tx_tracker.go
index cfe75a658e..34a06c4f1b 100644
--- a/core/txpool/tracking/tx_tracker.go
+++ b/core/txpool/tracker/tx_tracker.go
@@ -15,7 +15,7 @@
// along with the go-ethereum library. If not, see .
// Package legacypool implements the normal EVM execution transaction pool.
-package tracking
+package tracker
import (
"sync"
@@ -48,19 +48,18 @@ type TxTracker struct {
signer types.Signer
shutdownCh chan struct{}
- triggerCh chan struct{}
mu sync.Mutex
wg sync.WaitGroup
}
-func NewTxTracker(journalPath string, journalTime time.Duration, chainConfig *params.ChainConfig, next *txpool.TxPool) *TxTracker {
+// New creates a new TxTracker
+func New(journalPath string, journalTime time.Duration, chainConfig *params.ChainConfig, next *txpool.TxPool) *TxTracker {
signer := types.LatestSigner(chainConfig)
pool := &TxTracker{
all: make(map[common.Hash]*types.Transaction),
byAddr: make(map[common.Address]*legacypool.SortedMap),
signer: signer,
shutdownCh: make(chan struct{}),
- triggerCh: make(chan struct{}),
pool: next,
}
if journalPath != "" {
@@ -148,7 +147,7 @@ func (tracker *TxTracker) Start() error {
return nil
}
-// Start implements node.Lifecycle interface
+// Stop implements node.Lifecycle interface
// Stop terminates all goroutines belonging to the service, blocking until they
// are all terminated.
func (tracker *TxTracker) Stop() error {
@@ -157,13 +156,6 @@ func (tracker *TxTracker) Stop() error {
return nil
}
-// TriggerRecheck triggers a recheck, whereby the tracker potentially resubmits
-// transactions to the tx pool. This method is mainly useful for test purposes,
-// in order to speed up the process.
-func (tracker *TxTracker) TriggerRecheck() {
- tracker.triggerCh <- struct{}{}
-}
-
func (tracker *TxTracker) loop() {
defer tracker.wg.Done()
if tracker.journal != nil {
@@ -180,11 +172,6 @@ func (tracker *TxTracker) loop() {
select {
case <-tracker.shutdownCh:
return
- case <-tracker.triggerCh:
- resubmits, _ := tracker.recheck(false)
- if len(resubmits) > 0 {
- tracker.pool.Add(resubmits, false)
- }
case <-t.C:
checkJournal := tracker.journal != nil && time.Since(lastJournal) > tracker.rejournal
resubmits, rejournal := tracker.recheck(checkJournal)
diff --git a/eth/backend.go b/eth/backend.go
index 077885b569..6963f95db1 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -23,6 +23,7 @@ import (
"math/big"
"runtime"
"sync"
+ "time"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
@@ -35,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/tracking"
+ "github.com/ethereum/go-ethereum/core/txpool/tracker"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/downloader"
@@ -70,7 +71,7 @@ type Ethereum struct {
// core protocol objects
config *ethconfig.Config
txPool *txpool.TxPool
- localTxTracker *tracking.TxTracker
+ localTxTracker *tracker.TxTracker
blockchain *core.BlockChain
handler *handler
@@ -238,12 +239,12 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
eth.txPool, err = txpool.New(config.TxPool.PriceLimit, eth.blockchain, []txpool.SubPool{legacyPool, blobPool})
if !config.TxPool.NoLocals {
- // TODO!
- // We also need to handle config.Locals, the accounts that are
- // to be treated as locals, regardless of how they arrive to geth.
- eth.localTxTracker = tracking.NewTxTracker(config.TxPool.Journal,
- config.TxPool.Rejournal,
- eth.blockchain.Config(), eth.txPool)
+ rejournal := config.TxPool.Rejournal
+ if rejournal < time.Second {
+ 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)
stack.RegisterLifecycle(eth.localTxTracker)
}
@@ -340,8 +341,7 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) {
s.blockchain.ResetWithGenesisBlock(gb)
}
-func (s *Ethereum) Miner() *miner.Miner { return s.miner }
-func (s *Ethereum) Tracker() *tracking.TxTracker { return s.localTxTracker }
+func (s *Ethereum) Miner() *miner.Miner { return s.miner }
func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager }
func (s *Ethereum) BlockChain() *core.BlockChain { return s.blockchain }