From 2f8a3dde62409678e19758fbeb3aae4079be65b5 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 18 Jan 2017 23:44:31 +0200 Subject: [PATCH] swarm/network: cmdline network id highest precedence Already fixed in previous commits, but separate commit for this issue requested. Added comments to explain why test against 0 appears twice fixes #3444 fixes #3494 --- swarm/api/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swarm/api/config.go b/swarm/api/config.go index e4c2dfb5fc..23a8555007 100644 --- a/swarm/api/config.go +++ b/swarm/api/config.go @@ -86,6 +86,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey, n } data, err = ioutil.ReadFile(confpath) + // if not set in function param, then set default for swarm network, will be overwritten by config file if present if networkId == 0 { self.NetworkId = network.NetworkId } @@ -117,6 +118,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey, n return nil, fmt.Errorf("bzz key does not match the one in the config file %v != %v", keyhex, self.BzzKey) } + // if set in function param, replace id set from config file if networkId != 0 { self.NetworkId = networkId }