From cee9cfe51250bc216970482e5d9f884df84d8008 Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 21 Mar 2019 11:13:37 +0100 Subject: [PATCH] p2p/simulations, swarm/network: Make exec disc test pass --- p2p/simulations/adapters/exec.go | 11 +++++------ swarm/network/simulations/discovery/discovery_test.go | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/p2p/simulations/adapters/exec.go b/p2p/simulations/adapters/exec.go index 6d1c13f3c7..106b179e43 100644 --- a/p2p/simulations/adapters/exec.go +++ b/p2p/simulations/adapters/exec.go @@ -411,14 +411,13 @@ func startExecNodeStack() (*node.Node, error) { if err := json.Unmarshal([]byte(confEnv), &conf); err != nil { return nil, fmt.Errorf("error decoding %s: %v", envNodeConfig, err) } - // TODO verify that ListenAddr will contain the correct tcp addr - // if we should start using exec adapters with other host than local + + // create enode record nodeTcpConn, err := net.ResolveTCPAddr("tcp", conf.Stack.P2P.ListenAddr) - if err != nil { - conf.Node.initDummyEnode() - } else { - conf.Node.initEnode(nodeTcpConn.IP, nodeTcpConn.Port, nodeTcpConn.Port) + if nodeTcpConn.IP == nil { + nodeTcpConn.IP = net.IPv4(127, 0, 0, 1) } + conf.Node.initEnode(nodeTcpConn.IP, nodeTcpConn.Port, nodeTcpConn.Port) conf.Stack.P2P.PrivateKey = conf.Node.PrivateKey conf.Stack.Logger = log.New("node.id", conf.Node.ID.String()) diff --git a/swarm/network/simulations/discovery/discovery_test.go b/swarm/network/simulations/discovery/discovery_test.go index 1ad9ac2e9a..eb2c317922 100644 --- a/swarm/network/simulations/discovery/discovery_test.go +++ b/swarm/network/simulations/discovery/discovery_test.go @@ -131,7 +131,7 @@ func BenchmarkDiscovery_128_4(b *testing.B) { benchmarkDiscovery(b, 128, 4) } func BenchmarkDiscovery_256_4(b *testing.B) { benchmarkDiscovery(b, 256, 4) } func TestDiscoverySimulationExecAdapter(t *testing.T) { - t.Skip("This is left broken pending ENR preparations for swarm binary. Execadapter is not currently in use, so a short pause won't hurt") + //t.Skip("This is left broken pending ENR preparations for swarm binary. Execadapter is not currently in use, so a short pause won't hurt") testDiscoverySimulationExecAdapter(t, *nodeCount, *initCount) }