Skip to content

Commit 546d421

Browse files
zsfelfoldikaralabe
authored andcommitted
les: pass server pool to protocol manager (#16947)
1 parent f991995 commit 546d421

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

les/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
127127
}
128128

129129
leth.txPool = light.NewTxPool(leth.chainConfig, leth.blockchain, leth.relay)
130-
if leth.protocolManager, err = NewProtocolManager(leth.chainConfig, true, ClientProtocolVersions, config.NetworkId, leth.eventMux, leth.engine, leth.peers, leth.blockchain, nil, chainDb, leth.odr, leth.relay, quitSync, &leth.wg); err != nil {
130+
if leth.protocolManager, err = NewProtocolManager(leth.chainConfig, true, ClientProtocolVersions, config.NetworkId, leth.eventMux, leth.engine, leth.peers, leth.blockchain, nil, chainDb, leth.odr, leth.relay, leth.serverPool, quitSync, &leth.wg); err != nil {
131131
return nil, err
132132
}
133133
leth.ApiBackend = &LesApiBackend{leth, nil}

les/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ type ProtocolManager struct {
129129

130130
// NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable
131131
// with the ethereum network.
132-
func NewProtocolManager(chainConfig *params.ChainConfig, lightSync bool, protocolVersions []uint, networkId uint64, mux *event.TypeMux, engine consensus.Engine, peers *peerSet, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LesOdr, txrelay *LesTxRelay, quitSync chan struct{}, wg *sync.WaitGroup) (*ProtocolManager, error) {
132+
func NewProtocolManager(chainConfig *params.ChainConfig, lightSync bool, protocolVersions []uint, networkId uint64, mux *event.TypeMux, engine consensus.Engine, peers *peerSet, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LesOdr, txrelay *LesTxRelay, serverPool *serverPool, quitSync chan struct{}, wg *sync.WaitGroup) (*ProtocolManager, error) {
133133
// Create the protocol manager with the base fields
134134
manager := &ProtocolManager{
135135
lightSync: lightSync,
@@ -141,6 +141,7 @@ func NewProtocolManager(chainConfig *params.ChainConfig, lightSync bool, protoco
141141
networkId: networkId,
142142
txpool: txpool,
143143
txrelay: txrelay,
144+
serverPool: serverPool,
144145
peers: peers,
145146
newPeerCh: make(chan *peer),
146147
quitSync: quitSync,

les/helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor
178178
} else {
179179
protocolVersions = ServerProtocolVersions
180180
}
181-
pm, err := NewProtocolManager(gspec.Config, lightSync, protocolVersions, NetworkId, evmux, engine, peers, chain, nil, db, odr, nil, make(chan struct{}), new(sync.WaitGroup))
181+
pm, err := NewProtocolManager(gspec.Config, lightSync, protocolVersions, NetworkId, evmux, engine, peers, chain, nil, db, odr, nil, nil, make(chan struct{}), new(sync.WaitGroup))
182182
if err != nil {
183183
return nil, err
184184
}

les/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type LesServer struct {
5252

5353
func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) {
5454
quitSync := make(chan struct{})
55-
pm, err := NewProtocolManager(eth.BlockChain().Config(), false, ServerProtocolVersions, config.NetworkId, eth.EventMux(), eth.Engine(), newPeerSet(), eth.BlockChain(), eth.TxPool(), eth.ChainDb(), nil, nil, quitSync, new(sync.WaitGroup))
55+
pm, err := NewProtocolManager(eth.BlockChain().Config(), false, ServerProtocolVersions, config.NetworkId, eth.EventMux(), eth.Engine(), newPeerSet(), eth.BlockChain(), eth.TxPool(), eth.ChainDb(), nil, nil, nil, quitSync, new(sync.WaitGroup))
5656
if err != nil {
5757
return nil, err
5858
}

0 commit comments

Comments
 (0)