diff options
author | Felföldi Zsolt <zsfelfoldi@gmail.com> | 2018-02-05 21:41:53 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-02-05 21:41:53 +0800 |
commit | c3f238dd5371961d309350fb0f9d5136c9fc6afa (patch) | |
tree | 8879532944de4818030c0e8630613e52885695b6 /les/backend.go | |
parent | bc0666fb277be5e7d1fd7c5523a3b335b310a154 (diff) | |
download | dexon-c3f238dd5371961d309350fb0f9d5136c9fc6afa.tar.gz dexon-c3f238dd5371961d309350fb0f9d5136c9fc6afa.tar.zst dexon-c3f238dd5371961d309350fb0f9d5136c9fc6afa.zip |
les: limit LES peer count and improve peer configuration logic (#16010)
* les: limit number of LES connections
* eth, cmd/utils: light vs max peer configuration logic
Diffstat (limited to 'les/backend.go')
-rw-r--r-- | les/backend.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/les/backend.go b/les/backend.go index 798e44e85..6a324cb04 100644 --- a/les/backend.go +++ b/les/backend.go @@ -46,6 +46,8 @@ import ( ) type LightEthereum struct { + config *eth.Config + odr *LesOdr relay *LesTxRelay chainConfig *params.ChainConfig @@ -92,6 +94,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) { quitSync := make(chan struct{}) leth := &LightEthereum{ + config: config, chainConfig: chainConfig, chainDb: chainDb, eventMux: ctx.EventMux, @@ -224,7 +227,7 @@ func (s *LightEthereum) Start(srvr *p2p.Server) error { // clients are searching for the first advertised protocol in the list protocolVersion := AdvertiseProtocolVersions[0] s.serverPool.start(srvr, lesTopic(s.blockchain.Genesis().Hash(), protocolVersion)) - s.protocolManager.Start() + s.protocolManager.Start(s.config.LightPeers) return nil } |