aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/simulations/adapters/exec.go
diff options
context:
space:
mode:
authorlash <nolash@users.noreply.github.com>2019-03-22 12:55:47 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2019-03-22 12:55:47 +0800
commit09924cbcaab5106951fb67648315131bb4024ac5 (patch)
treeefeb2e96b97b6537ce5680a26934176567da00b3 /p2p/simulations/adapters/exec.go
parent358535188852bd9d8e351ccbb0d1fa608284a77b (diff)
downloadgo-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.tar
go-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.tar.gz
go-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.tar.bz2
go-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.tar.lz
go-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.tar.xz
go-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.tar.zst
go-tangerine-09924cbcaab5106951fb67648315131bb4024ac5.zip
cmd/swarm, p2p, swarm: Enable ENR in binary/execadapter (#19309)
* cmd/swarm, p2p, swarm: Enable ENR in binary/execadapter * cmd/p2p/swarm: Remove comments + config.Enode nomarshal * p2p/simulations: Remove superfluous error check * p2p/simulation: Move init enode comment * swarm/api: Check error in config test * swarm, p2p/simulations, cmd/swarm: Use nodekey in binary record sign * cmd/swarm: Make nodekey available for swarm api config
Diffstat (limited to 'p2p/simulations/adapters/exec.go')
-rw-r--r--p2p/simulations/adapters/exec.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/p2p/simulations/adapters/exec.go b/p2p/simulations/adapters/exec.go
index bd8bcbc85..6d1c13f3c 100644
--- a/p2p/simulations/adapters/exec.go
+++ b/p2p/simulations/adapters/exec.go
@@ -92,6 +92,10 @@ func (e *ExecAdapter) NewNode(config *NodeConfig) (Node, error) {
return nil, fmt.Errorf("error creating node directory: %s", err)
}
+ err := config.initDummyEnode()
+ if err != nil {
+ return nil, err
+ }
// generate the config
conf := &execNodeConfig{
Stack: node.DefaultConfig,
@@ -407,6 +411,14 @@ 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
+ 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)
+ }
conf.Stack.P2P.PrivateKey = conf.Node.PrivateKey
conf.Stack.Logger = log.New("node.id", conf.Node.ID.String())