Browse Source

pex: allow disabled pex reactor (#7198)

This ensures the implementation respects disabling the pex reactor.
pull/7204/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
ffcd347ef6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      node/node.go

+ 13
- 5
node/node.go View File

@ -355,9 +355,12 @@ func makeNode(cfg *config.Config,
nodeMetrics.statesync,
)
pexReactor, err := createPEXReactor(logger, peerManager, router)
if err != nil {
return nil, combineCloseError(err, makeCloser(closers))
var pexReactor service.Service
if cfg.P2P.PexReactor {
pexReactor, err = createPEXReactor(logger, peerManager, router)
if err != nil {
return nil, combineCloseError(err, makeCloser(closers))
}
}
node := &nodeImpl{
@ -423,6 +426,9 @@ func makeSeedNode(cfg *config.Config,
genesisDocProvider genesisDocProvider,
logger log.Logger,
) (service.Service, error) {
if !cfg.P2P.PexReactor {
return nil, errors.New("cannot run seed nodes with PEX disabled")
}
genDoc, err := genesisDocProvider()
if err != nil {
@ -546,8 +552,10 @@ func (n *nodeImpl) OnStart() error {
}
}
if err := n.pexReactor.Start(); err != nil {
return err
if n.config.P2P.PexReactor {
if err := n.pexReactor.Start(); err != nil {
return err
}
}
// Run state sync


Loading…
Cancel
Save