Commit f75aae34 authored by Joshua Gutow's avatar Joshua Gutow

op-node: Fix disable p2p

parent f3f9960c
......@@ -123,7 +123,7 @@ func RollupNodeMain(ctx *cli.Context) error {
if cfg.Heartbeat.Enabled {
var peerID string
if cfg.P2P == nil {
if cfg.P2P.Disabled() {
peerID = "disabled"
} else {
peerID = n.P2P().Host().ID().String()
......
......@@ -33,6 +33,7 @@ var DefaultBootnodes = []*enode.Node{
// SetupP2P provides a host and discovery service for usage in the rollup node.
type SetupP2P interface {
Check() error
Disabled() bool
// Host creates a libp2p host service. Returns nil, nil if p2p is disabled.
Host(log log.Logger, reporter metrics.Reporter) (host.Host, error)
// Discovery creates a disc-v5 service. Returns nil, nil, nil if discovery is disabled.
......@@ -134,6 +135,10 @@ func (conf *Config) TargetPeers() uint {
return conf.PeersLo
}
func (conf *Config) Disabled() bool {
return conf.DisableP2P
}
const maxMeshParam = 1000
func (conf *Config) Check() error {
......
......@@ -63,3 +63,7 @@ func (p *Prepared) Discovery(log log.Logger, rollupCfg *rollup.Config, tcpPort u
func (p *Prepared) ConfigureGossip(params *pubsub.GossipSubParams) []pubsub.Option {
return nil
}
func (p *Prepared) Disabled() bool {
return false
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment