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 { ...@@ -123,7 +123,7 @@ func RollupNodeMain(ctx *cli.Context) error {
if cfg.Heartbeat.Enabled { if cfg.Heartbeat.Enabled {
var peerID string var peerID string
if cfg.P2P == nil { if cfg.P2P.Disabled() {
peerID = "disabled" peerID = "disabled"
} else { } else {
peerID = n.P2P().Host().ID().String() peerID = n.P2P().Host().ID().String()
......
...@@ -33,6 +33,7 @@ var DefaultBootnodes = []*enode.Node{ ...@@ -33,6 +33,7 @@ var DefaultBootnodes = []*enode.Node{
// SetupP2P provides a host and discovery service for usage in the rollup node. // SetupP2P provides a host and discovery service for usage in the rollup node.
type SetupP2P interface { type SetupP2P interface {
Check() error Check() error
Disabled() bool
// Host creates a libp2p host service. Returns nil, nil if p2p is disabled. // Host creates a libp2p host service. Returns nil, nil if p2p is disabled.
Host(log log.Logger, reporter metrics.Reporter) (host.Host, error) Host(log log.Logger, reporter metrics.Reporter) (host.Host, error)
// Discovery creates a disc-v5 service. Returns nil, nil, nil if discovery is disabled. // Discovery creates a disc-v5 service. Returns nil, nil, nil if discovery is disabled.
...@@ -134,6 +135,10 @@ func (conf *Config) TargetPeers() uint { ...@@ -134,6 +135,10 @@ func (conf *Config) TargetPeers() uint {
return conf.PeersLo return conf.PeersLo
} }
func (conf *Config) Disabled() bool {
return conf.DisableP2P
}
const maxMeshParam = 1000 const maxMeshParam = 1000
func (conf *Config) Check() error { func (conf *Config) Check() error {
......
...@@ -63,3 +63,7 @@ func (p *Prepared) Discovery(log log.Logger, rollupCfg *rollup.Config, tcpPort u ...@@ -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 { func (p *Prepared) ConfigureGossip(params *pubsub.GossipSubParams) []pubsub.Option {
return nil 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