mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-06 02:52:19 +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 {
|
type Timings struct {
|
||||||
syncToNewPeersEvery time.Duration
|
syncToNewPeersEvery time.Duration
|
||||||
|
logEvery time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultTimings = Timings{
|
var DefaultTimings = Timings{
|
||||||
syncToNewPeersEvery: 2 * time.Minute,
|
syncToNewPeersEvery: 2 * time.Minute,
|
||||||
|
logEvery: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFetch creates a new fetch object that will work with given sentry clients. Since the
|
// 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/hashicorp/golang-lru/simplelru"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
"github.com/ledgerwatch/erigon-lib/kv"
|
"github.com/ledgerwatch/erigon-lib/kv"
|
||||||
|
"github.com/ledgerwatch/log/v3"
|
||||||
"go.uber.org/atomic"
|
"go.uber.org/atomic"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -160,6 +161,11 @@ func New(newTxs chan Hashes, db kv.RwDB) (*TxPool, error) {
|
|||||||
}, nil
|
}, 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 {
|
func (p *TxPool) GetRlp(hash []byte) []byte {
|
||||||
p.lock.RLock()
|
p.lock.RLock()
|
||||||
defer p.lock.RUnlock()
|
defer p.lock.RUnlock()
|
||||||
@ -837,6 +843,9 @@ func (p *WorstQueue) Pop() interface{} {
|
|||||||
// promote/demote transactions
|
// promote/demote transactions
|
||||||
// reorgs
|
// reorgs
|
||||||
func BroadcastLoop(ctx context.Context, p *TxPool, newTxs chan Hashes, send *Send, timings Timings) {
|
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)
|
syncToNewPeersEvery := time.NewTicker(timings.syncToNewPeersEvery)
|
||||||
defer syncToNewPeersEvery.Stop()
|
defer syncToNewPeersEvery.Stop()
|
||||||
|
|
||||||
@ -847,6 +856,8 @@ func BroadcastLoop(ctx context.Context, p *TxPool, newTxs chan Hashes, send *Sen
|
|||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
|
case <-logEvery.C:
|
||||||
|
p.logStats()
|
||||||
case h := <-newTxs:
|
case h := <-newTxs:
|
||||||
// first broadcast all local txs to all peers, then non-local to random sqrt(peersAmount) peers
|
// first broadcast all local txs to all peers, then non-local to random sqrt(peersAmount) peers
|
||||||
localTxHashes = localTxHashes[:0]
|
localTxHashes = localTxHashes[:0]
|
||||||
|
Loading…
Reference in New Issue
Block a user