From 09924cbcaab5106951fb67648315131bb4024ac5 Mon Sep 17 00:00:00 2001 From: lash Date: Fri, 22 Mar 2019 05:55:47 +0100 Subject: 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 --- cmd/swarm/config.go | 8 ++++++-- cmd/swarm/main.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index a941b3757..32cd442a0 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -123,18 +123,22 @@ func buildConfig(ctx *cli.Context) (config *bzzapi.Config, err error) { } //finally, after the configuration build phase is finished, initialize -func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context) { +func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context, nodeconfig *node.Config) error { //at this point, all vars should be set in the Config //get the account for the provided swarm account prvkey := getAccount(config.BzzAccount, ctx, stack) //set the resolved config path (geth --datadir) config.Path = expandPath(stack.InstanceDir()) //finally, initialize the configuration - config.Init(prvkey) + err := config.Init(prvkey, nodeconfig.NodeKey()) + if err != nil { + return err + } //configuration phase completed here log.Debug("Starting Swarm with the following parameters:") //after having created the config, print it to screen log.Debug(printConfig(config)) + return nil } //configFileOverride overrides the current config with the config file, if a config file has been provided diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index 06d5b0bb2..a4041eb3d 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -298,7 +298,10 @@ func bzzd(ctx *cli.Context) error { //a few steps need to be done after the config phase is completed, //due to overriding behavior - initSwarmNode(bzzconfig, stack, ctx) + err = initSwarmNode(bzzconfig, stack, ctx, &cfg) + if err != nil { + return err + } //register BZZ as node.Service in the ethereum node registerBzzService(bzzconfig, stack) //start the node -- cgit v1.2.3