From fc9dc36d88c85117ce4239b6b9a50598923a1908 Mon Sep 17 00:00:00 2001 From: welkin22 Date: Mon, 28 Oct 2024 13:49:19 +0800 Subject: [PATCH] Revert "optimization: enlarge p2p buffer size and add some metrics for performance monitor (#171)" This reverts commit b4b975043ff706b7defb1aa810b47fa7b4d7cd87. --- core/txpool/legacypool/legacypool.go | 11 ++--------- eth/protocols/eth/peer.go | 6 ++---- miner/worker.go | 3 +-- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 094346ba4f..a539253fa3 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -1110,9 +1110,7 @@ func (pool *LegacyPool) addRemoteSync(tx *types.Transaction) error { // to the add is finished. Only use this during tests for determinism! func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error { defer func(t0 time.Time) { - if len(txs) > 0 { - addTimer.Update(time.Since(t0) / time.Duration(len(txs))) - } + addTimer.UpdateSince(t0) }(time.Now()) // Do not treat as local if local transactions have been disabled local = local && !pool.config.NoLocals @@ -1149,9 +1147,7 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error pool.mu.Lock() t0 := time.Now() newErrs, dirtyAddrs := pool.addTxsLocked(news, local) - if len(news) > 0 { - addWithLockTimer.Update(time.Since(t0) / time.Duration(len(news))) - } + addWithLockTimer.UpdateSince(t0) pool.mu.Unlock() var nilSlot = 0 @@ -1407,9 +1403,6 @@ func (pool *LegacyPool) runReorg(done chan struct{}, reset *txpoolResetRequest, reorgDurationTimer.Update(time.Since(t0)) if reset != nil { reorgresetTimer.UpdateSince(t0) - if reset.newHead != nil { - log.Info("Transaction pool reorged", "from", reset.oldHead.Number.Uint64(), "to", reset.newHead.Number.Uint64()) - } } }(time.Now()) defer close(done) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index fc7c2a18ea..ffd78b0594 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -39,13 +39,11 @@ const ( // maxQueuedTxs is the maximum number of transactions to queue up before dropping // older broadcasts. - // we need a higher limit to support 10k txs in a block - maxQueuedTxs = 98304 + maxQueuedTxs = 4096 // maxQueuedTxAnns is the maximum number of transaction announcements to queue up // before dropping older announcements. - // we need a higher limit to support 10k txs in a block - maxQueuedTxAnns = 98304 + maxQueuedTxAnns = 4096 // maxQueuedBlocks is the maximum number of block propagations to queue up before // dropping broadcasts. There's not much point in queueing stale blocks, so a few diff --git a/miner/worker.go b/miner/worker.go index 0b5e807b16..b94a4b85bb 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -21,13 +21,12 @@ import ( "crypto/ecdsa" "errors" "fmt" + mapset "github.com/deckarep/golang-set/v2" "math/big" "sync" "sync/atomic" "time" - mapset "github.com/deckarep/golang-set/v2" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus/misc"