From d74e870c8b726c78a384cc14be8c3fc333c35a79 Mon Sep 17 00:00:00 2001 From: Danial Date: Sat, 31 May 2025 20:54:40 +0800 Subject: [PATCH] set gasTip's type as normal value --- core/txpool/legacypool/legacypool.go | 17 +++++++---------- core/txpool/legacypool/legacypool_test.go | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 0223b456e6..d16b5dea47 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -229,7 +229,7 @@ type LegacyPool struct { config Config chainconfig *params.ChainConfig chain BlockChain - gasTip atomic.Pointer[uint256.Int] + gasTip *uint256.Int txFeed event.Feed signer types.Signer mu sync.RWMutex @@ -307,7 +307,7 @@ func (pool *LegacyPool) Init(gasTip uint64, head *types.Header, reserver txpool. pool.reserver = reserver // Set the basic pool parameters - pool.gasTip.Store(uint256.NewInt(gasTip)) + pool.gasTip = uint256.NewInt(gasTip) // Initialize the state with head block, or fallback to empty one in // case the head state is not available (might occur when node is not @@ -418,13 +418,10 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) { pool.mu.Lock() defer pool.mu.Unlock() - var ( - newTip = uint256.MustFromBig(tip) - old = pool.gasTip.Load() - ) - pool.gasTip.Store(newTip) + old := pool.gasTip + pool.gasTip = uint256.MustFromBig(tip) // If the min miner fee increased, remove transactions below the new threshold - if newTip.Cmp(old) > 0 { + if pool.gasTip.Cmp(old) > 0 { // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead drop := pool.all.TxsBelowTip(tip) for _, tx := range drop { @@ -432,7 +429,7 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) { } pool.priced.Removed(len(drop)) } - log.Info("Legacy pool tip threshold updated", "tip", newTip) + log.Info("Legacy pool tip threshold updated", "tip", tip) } // Nonce returns the next nonce of an account, with all transactions executable @@ -572,7 +569,7 @@ func (pool *LegacyPool) ValidateTxBasics(tx *types.Transaction) error { 1<