mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +00:00
remove statusData from fetch
This commit is contained in:
parent
8c5c1bdc52
commit
2206550ae6
@ -50,10 +50,12 @@ type Fetch struct {
|
||||
|
||||
type Timings struct {
|
||||
syncToNewPeersEvery time.Duration
|
||||
logEvery time.Duration
|
||||
}
|
||||
|
||||
var DefaultTimings = Timings{
|
||||
syncToNewPeersEvery: 2 * time.Minute,
|
||||
logEvery: 30 * time.Second,
|
||||
}
|
||||
|
||||
// NewFetch creates a new fetch object that will work with given sentry clients. Since the
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
"github.com/hashicorp/golang-lru/simplelru"
|
||||
"github.com/holiman/uint256"
|
||||
"github.com/ledgerwatch/erigon-lib/kv"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
@ -160,6 +161,11 @@ func New(newTxs chan Hashes, db kv.RwDB) (*TxPool, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *TxPool) logStats() {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
log.Info(fmt.Sprintf("[txpool] queues size: pending=%d/%d, baseFee=%d/%d, queued=%d/%d", p.pending.Len(), PendingSubPoolLimit, p.baseFee.Len(), BaseFeeSubPoolLimit, p.pending.Len(), PendingSubPoolLimit))
|
||||
}
|
||||
func (p *TxPool) GetRlp(hash []byte) []byte {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
@ -837,6 +843,9 @@ func (p *WorstQueue) Pop() interface{} {
|
||||
// promote/demote transactions
|
||||
// reorgs
|
||||
func BroadcastLoop(ctx context.Context, p *TxPool, newTxs chan Hashes, send *Send, timings Timings) {
|
||||
logEvery := time.NewTicker(timings.logEvery)
|
||||
defer logEvery.Stop()
|
||||
|
||||
syncToNewPeersEvery := time.NewTicker(timings.syncToNewPeersEvery)
|
||||
defer syncToNewPeersEvery.Stop()
|
||||
|
||||
@ -847,6 +856,8 @@ func BroadcastLoop(ctx context.Context, p *TxPool, newTxs chan Hashes, send *Sen
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-logEvery.C:
|
||||
p.logStats()
|
||||
case h := <-newTxs:
|
||||
// first broadcast all local txs to all peers, then non-local to random sqrt(peersAmount) peers
|
||||
localTxHashes = localTxHashes[:0]
|
||||
|
Loading…
Reference in New Issue
Block a user