Skip to content

Commit

Permalink
pool: queued goes to 0 locally after this change
Browse files Browse the repository at this point in the history
  • Loading branch information
emailtovamos committed Sep 6, 2024
1 parent 0e61543 commit 0a5dbef
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ var (
queuedGauge = metrics.NewRegisteredGauge("txpool/queued", nil)
localGauge = metrics.NewRegisteredGauge("txpool/local", nil)
slotsGauge = metrics.NewRegisteredGauge("txpool/slots", nil)
pool2Gauge = metrics.NewRegisteredGauge("txpool/pool2", nil)
pool3Gauge = metrics.NewRegisteredGauge("txpool/pool3", nil)

reheapTimer = metrics.NewRegisteredTimer("txpool/reheap", nil)
)
Expand Down Expand Up @@ -968,7 +970,9 @@ func (pool *LegacyPool) addToPool12OrPool3(tx *types.Transaction, from common.Ad
}
dirty := newAccountSet(pool.signer)
dirty.addTx(tx)
<-pool.requestPromoteExecutables(dirty)
go func() {
<-pool.requestPromoteExecutables(dirty)
}()
log.Trace("Pooled new executable transaction", "hash", tx.Hash(), "from", from, "to", tx.To())

// Successful promotion, bump the heartbeat
Expand All @@ -985,7 +989,10 @@ func (pool *LegacyPool) addToPool12OrPool3(tx *types.Transaction, from common.Ad
}
dirty := newAccountSet(pool.signer)
dirty.addTx(tx)
<-pool.requestPromoteExecutables(dirty)
pool2Gauge.Inc(1)
go func() {
<-pool.requestPromoteExecutables(dirty)
}()
log.Trace("Pooled new executable transaction", "hash", tx.Hash(), "from", from, "to", tx.To())

// Successful promotion, bump the heartbeat
Expand All @@ -994,6 +1001,7 @@ func (pool *LegacyPool) addToPool12OrPool3(tx *types.Transaction, from common.Ad
}
if pool3 {
pool.localBufferPool.Add(tx)
pool3Gauge.Inc(1)
return true, nil
}
return false, errors.New("could not add to any pool")
Expand Down

0 comments on commit 0a5dbef

Please sign in to comment.