diff --git a/swarm/network/simulations/overlay.go b/swarm/network/simulations/overlay.go index 6c5a58a18d..04f7b8be60 100644 --- a/swarm/network/simulations/overlay.go +++ b/swarm/network/simulations/overlay.go @@ -6,6 +6,7 @@ package main import ( + "flag" "fmt" "math/rand" "net/http" @@ -22,6 +23,8 @@ import ( "github.com/ethereum/go-ethereum/swarm/network" ) +var noDiscovery = flag.Bool("no-discovery", false, "disable discovery (useful if you want to load a snapshot)") + type Simulation struct { mtx sync.Mutex stores map[discover.NodeID]*adapters.SimStateStore @@ -57,6 +60,7 @@ func (s *Simulation) NewService(ctx *adapters.ServiceContext) (node.Service, err ticker := time.NewTicker(time.Duration(kad.PruneInterval) * time.Millisecond) kad.Prune(ticker.C) hp := network.NewHiveParams() + hp.Discovery = !*noDiscovery hp.KeepAliveInterval = 3 * time.Second config := &network.BzzConfig{ @@ -192,6 +196,8 @@ func startStopMocker(net *simulations.Network) { // var server func main() { + flag.Parse() + runtime.GOMAXPROCS(runtime.NumCPU()) log.Root().SetHandler(log.LvlFilterHandler(log.LvlDebug, log.StreamHandler(os.Stderr, log.TerminalFormat(false))))