Skip to content

Commit

Permalink
les: fix server panic when discovery disabled (ethereum#16055)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsfelfoldi authored and mariameda committed Aug 19, 2018
1 parent 1f36cf6 commit d26a1fe
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions les/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,17 @@ func (s *LesServer) Protocols() []p2p.Protocol {
// Start starts the LES server
func (s *LesServer) Start(srvr *p2p.Server) {
s.protocolManager.Start(s.config.LightPeers)
for _, topic := range s.lesTopics {
topic := topic
go func() {
logger := log.New("topic", topic)
logger.Info("Starting topic registration")
defer logger.Info("Terminated topic registration")

srvr.DiscV5.RegisterTopic(topic, s.quitSync)
}()
if srvr.DiscV5 != nil {
for _, topic := range s.lesTopics {
topic := topic
go func() {
logger := log.New("topic", topic)
logger.Info("Starting topic registration")
defer logger.Info("Terminated topic registration")

srvr.DiscV5.RegisterTopic(topic, s.quitSync)
}()
}
}
s.privateKey = srvr.PrivateKey
s.protocolManager.blockLoop()
Expand Down

0 comments on commit d26a1fe

Please sign in to comment.