diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-09-06 00:18:28 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-09-06 00:18:28 +0800 |
commit | b0ca1b67ce6e297fe02281d01a486225bbf385f8 (patch) | |
tree | 2a0e091700f33993e5851e79e2f3b0c4881a47fc /eth/handler.go | |
parent | 03d00361f5c91bedee27e7b5853523103750de3c (diff) | |
download | go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.tar go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.tar.gz go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.tar.bz2 go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.tar.lz go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.tar.xz go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.tar.zst go-tangerine-b0ca1b67ce6e297fe02281d01a486225bbf385f8.zip |
eth: use maxpeers from p2p layer instead of extra config
Diffstat (limited to 'eth/handler.go')
-rw-r--r-- | eth/handler.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/eth/handler.go b/eth/handler.go index 9d230a4ad..28ae208c0 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -99,7 +99,7 @@ type ProtocolManager struct { // NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable // with the ethereum network. -func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkId uint64, maxPeers int, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *core.BlockChain, chaindb ethdb.Database) (*ProtocolManager, error) { +func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkId uint64, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *core.BlockChain, chaindb ethdb.Database) (*ProtocolManager, error) { // Create the protocol manager with the base fields manager := &ProtocolManager{ networkId: networkId, @@ -108,7 +108,6 @@ func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, ne blockchain: blockchain, chaindb: chaindb, chainconfig: config, - maxPeers: maxPeers, peers: newPeerSet(), newPeerCh: make(chan *peer), noMorePeers: make(chan struct{}), @@ -203,11 +202,14 @@ func (pm *ProtocolManager) removePeer(id string) { } } -func (pm *ProtocolManager) Start() { +func (pm *ProtocolManager) Start(maxPeers int) { + pm.maxPeers = maxPeers + // broadcast transactions pm.txCh = make(chan core.TxPreEvent, txChanSize) pm.txSub = pm.txpool.SubscribeTxPreEvent(pm.txCh) go pm.txBroadcastLoop() + // broadcast mined blocks pm.minedBlockSub = pm.eventMux.Subscribe(core.NewMinedBlockEvent{}) go pm.minedBroadcastLoop() |