diff --git a/config/tendermint/config.go b/config/tendermint/config.go index 3731c53bb..2bb57077e 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -55,7 +55,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("proxy_app", "tcp://127.0.0.1:46658") mapConfig.SetDefault("tmsp", "socket") mapConfig.SetDefault("moniker", "anonymous") - mapConfig.SetDefault("node_laddr", "0.0.0.0:46656") + mapConfig.SetDefault("node_laddr", "tcp://0.0.0.0:46656") mapConfig.SetDefault("seeds", "") // mapConfig.SetDefault("seeds", "goldenalchemist.chaintest.net:46656") mapConfig.SetDefault("fast_sync", true) @@ -65,7 +65,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("db_backend", "leveldb") mapConfig.SetDefault("db_dir", rootDir+"/data") mapConfig.SetDefault("log_level", "info") - mapConfig.SetDefault("rpc_laddr", "0.0.0.0:46657") + mapConfig.SetDefault("rpc_laddr", "tcp://0.0.0.0:46657") mapConfig.SetDefault("prof_laddr", "") mapConfig.SetDefault("revision_file", rootDir+"/revision") mapConfig.SetDefault("cswal", rootDir+"/data/cswal") @@ -92,12 +92,12 @@ var defaultConfigTmpl = `# This is a TOML config file. proxy_app = "tcp://127.0.0.1:46658" moniker = "__MONIKER__" -node_laddr = "0.0.0.0:46656" +node_laddr = "tcp://0.0.0.0:46656" seeds = "" fast_sync = true db_backend = "leveldb" log_level = "notice" -rpc_laddr = "0.0.0.0:46657" +rpc_laddr = "tcp://0.0.0.0:46657" ` func defaultConfig(moniker string) (defaultConfig string) { diff --git a/config/tendermint_test/config.go b/config/tendermint_test/config.go index c53f8bfbb..422337565 100644 --- a/config/tendermint_test/config.go +++ b/config/tendermint_test/config.go @@ -70,7 +70,7 @@ func ResetConfig(localPath string) cfg.Config { mapConfig.SetDefault("proxy_app", "dummy") mapConfig.SetDefault("tmsp", "socket") mapConfig.SetDefault("moniker", "anonymous") - mapConfig.SetDefault("node_laddr", "0.0.0.0:36656") + mapConfig.SetDefault("node_laddr", "tcp://0.0.0.0:36656") mapConfig.SetDefault("fast_sync", false) mapConfig.SetDefault("skip_upnp", true) mapConfig.SetDefault("addrbook_file", rootDir+"/addrbook.json") @@ -78,7 +78,7 @@ func ResetConfig(localPath string) cfg.Config { mapConfig.SetDefault("db_backend", "memdb") mapConfig.SetDefault("db_dir", rootDir+"/data") mapConfig.SetDefault("log_level", "debug") - mapConfig.SetDefault("rpc_laddr", "0.0.0.0:36657") + mapConfig.SetDefault("rpc_laddr", "tcp://0.0.0.0:36657") mapConfig.SetDefault("prof_laddr", "") mapConfig.SetDefault("revision_file", rootDir+"/revision") mapConfig.SetDefault("cswal", rootDir+"/data/cswal") @@ -105,12 +105,12 @@ var defaultConfigTmpl = `# This is a TOML config file. proxy_app = "dummy" moniker = "__MONIKER__" -node_laddr = "0.0.0.0:36656" +node_laddr = "tcp://0.0.0.0:36656" seeds = "" fast_sync = false db_backend = "memdb" log_level = "debug" -rpc_laddr = "0.0.0.0:36657" +rpc_laddr = "tcp://0.0.0.0:36657" ` func defaultConfig(moniker string) (defaultConfig string) { diff --git a/node/node.go b/node/node.go index 231b6b650..4842b6aee 100644 --- a/node/node.go +++ b/node/node.go @@ -348,7 +348,9 @@ func RunNode(config cfg.Config) { // Create & start node n := NewNode(config, privValidator, GetProxyApp) - l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), config.GetBool("skip_upnp")) + + protocol, address := ProtocolAndAddress(config.GetString("node_laddr")) + l := p2p.NewDefaultListener(protocol, address, config.GetBool("skip_upnp")) n.AddListener(l) err := n.Start() if err != nil { @@ -448,3 +450,13 @@ func RunReplay(config cfg.Config) { } log.Notice("Replay run successfully") } + +// Defaults to tcp +func ProtocolAndAddress(listenAddr string) (string, string) { + protocol, address := "tcp", listenAddr + parts := strings.SplitN(address, "://", 2) + if len(parts) == 2 { + protocol, address = parts[0], parts[1] + } + return protocol, address +} diff --git a/node/node_test.go b/node/node_test.go index 8cb81f159..5701c5b94 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -18,7 +18,8 @@ func TestNodeStartStop(t *testing.T) { // Create & start node n := NewNode(config, privValidator, GetProxyApp) - l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), config.GetBool("skip_upnp")) + protocol, address := ProtocolAndAddress(config.GetString("node_laddr")) + l := p2p.NewDefaultListener(protocol, address, config.GetBool("skip_upnp")) n.AddListener(l) n.Start() log.Notice("Started node", "nodeInfo", n.sw.NodeInfo()) diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index 59709ada2..75c8fdd34 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -55,7 +55,8 @@ func newNode(ready chan struct{}) { privValidatorFile := config.GetString("priv_validator_file") privValidator := types.LoadOrGenPrivValidator(privValidatorFile) node = nm.NewNode(config, privValidator, nm.GetProxyApp) - l := p2p.NewDefaultListener("tcp", config.GetString("node_laddr"), true) + protocol, address := nm.ProtocolAndAddress(config.GetString("node_laddr")) + l := p2p.NewDefaultListener(protocol, address, true) node.AddListener(l) node.Start() diff --git a/test/test.sh b/test/test.sh index 7d69728d5..0f486f677 100644 --- a/test/test.sh +++ b/test/test.sh @@ -1,4 +1,5 @@ #! /bin/bash +set -eu # Top Level Testing Script # See the github.com/tendermint/tendermint/test/README.md