mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
pool constructor
This commit is contained in:
parent
9a9d017866
commit
3204f70409
@ -99,8 +99,7 @@ func (i *nonce2TxItem) Less(than btree.Item) bool {
|
||||
// TxPool - holds all pool-related data structures and lock-based tiny methods
|
||||
// most of logic implemented by pure tests-friendly functions
|
||||
type TxPool struct {
|
||||
lock *sync.RWMutex
|
||||
logger log.Logger //nolint
|
||||
lock *sync.RWMutex
|
||||
|
||||
protocolBaseFee atomic.Uint64
|
||||
blockBaseFee atomic.Uint64
|
||||
@ -117,6 +116,20 @@ type TxPool struct {
|
||||
//lastTxPropagationTimestamp time.Time
|
||||
}
|
||||
|
||||
func New() *TxPool {
|
||||
localsHistory, _ := lru.New(1024)
|
||||
return &TxPool{
|
||||
lock: &sync.RWMutex{},
|
||||
senderInfo: map[uint64]SenderInfo{},
|
||||
byHash: map[string]*MetaTx{},
|
||||
localsHistory: localsHistory,
|
||||
recentlyConnectedPeers: &recentlyConnectedPeers{},
|
||||
pending: NewSubPool(),
|
||||
baseFee: NewSubPool(),
|
||||
queued: NewSubPool(),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *TxPool) GetRlp(hash []byte) []byte {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
@ -557,12 +570,6 @@ type PoolImpl struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func NewPool() *PoolImpl {
|
||||
return &PoolImpl{
|
||||
recentlyConnectedPeers: &recentlyConnectedPeers{},
|
||||
}
|
||||
}
|
||||
|
||||
// Loop - does:
|
||||
// send pending byHash to p2p:
|
||||
// - new byHash
|
||||
|
Loading…
Reference in New Issue
Block a user