Skip to content

Commit

Permalink
Revert "optimization: enlarge p2p buffer size and add some metrics fo…
Browse files Browse the repository at this point in the history
…r performance monitor (bnb-chain#171)"

This reverts commit b4b9750.
  • Loading branch information
welkin22 committed Oct 28, 2024
1 parent 6585b93 commit fc9dc36
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
11 changes: 2 additions & 9 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions eth/protocols/eth/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit fc9dc36

Please sign in to comment.