From 67025d76fc39cc026a666e5c1dddcb1915d552c4 Mon Sep 17 00:00:00 2001 From: Edwin Date: Mon, 14 Aug 2017 13:13:24 +0800 Subject: [PATCH] core, container: rename HttpPort to P2PPort --- container/ethereum_test.go | 2 +- core/cluster.go | 32 ++++++++++++++++---------------- tests/integration_test.go | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/container/ethereum_test.go b/container/ethereum_test.go index 3b7b080b..4d8bda1f 100644 --- a/container/ethereum_test.go +++ b/container/ethereum_test.go @@ -39,7 +39,7 @@ func TestEthereumContainer(t *testing.T) { ImageName("quay.io/maicoin/ottoman_geth:istanbul_develop"), HostDataDir(env.DataDir), DataDir("/data"), - Port(fmt.Sprintf("%d", env.HttpPort)), + Port(fmt.Sprintf("%d", env.P2PPort)), RPC(), RPCAddress("0.0.0.0"), RPCAPI("eth,net,web3,personal"), diff --git a/core/cluster.go b/core/cluster.go index 8bff4aba..2593b7ee 100644 --- a/core/cluster.go +++ b/core/cluster.go @@ -36,7 +36,7 @@ import ( const ( defaultBaseRpcPort = uint16(8545) - defaultHttpPort = uint16(30303) + defaultP2PPort = uint16(30303) defaultLocalDir = "/tmp/gdata" datadirPrivateKey = "nodekey" @@ -59,12 +59,12 @@ func GenerateClusterKeys(numbers int) []*ecdsa.PrivateKey { } type Env struct { - GethID int - HttpPort uint16 - RpcPort uint16 - DataDir string - Key *ecdsa.PrivateKey - Client *client.Client + GethID int + P2PPort uint16 + RpcPort uint16 + DataDir string + Key *ecdsa.PrivateKey + Client *client.Client } func Teardown(envs []*Env) { @@ -76,7 +76,7 @@ func Teardown(envs []*Env) { func SetupEnv(prvKeys []*ecdsa.PrivateKey) []*Env { envs := make([]*Env, len(prvKeys)) rpcPort := defaultBaseRpcPort - httpPort := defaultHttpPort + p2pPort := defaultP2PPort for i := 0; i < len(envs); i++ { client, err := client.NewEnvClient() @@ -90,16 +90,16 @@ func SetupEnv(prvKeys []*ecdsa.PrivateKey) []*Env { } envs[i] = &Env{ - GethID: i, - HttpPort: httpPort, - RpcPort: rpcPort, - DataDir: dataDir, - Key: prvKeys[i], - Client: client, + GethID: i, + P2PPort: p2pPort, + RpcPort: rpcPort, + DataDir: dataDir, + Key: prvKeys[i], + Client: client, } rpcPort = rpcPort + 1 - httpPort = httpPort + 1 + p2pPort = p2pPort + 1 } return envs } @@ -175,7 +175,7 @@ func transformToStaticNodes(envs []*Env) []string { } nodeID := discover.PubkeyID(&env.Key.PublicKey) - nodes[i] = discover.NewNode(nodeID, net.ParseIP(host), 0, env.HttpPort).String() + nodes[i] = discover.NewNode(nodeID, net.ParseIP(host), 0, env.P2PPort).String() } return nodes } diff --git a/tests/integration_test.go b/tests/integration_test.go index 2e6149f4..a0d189f1 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -53,7 +53,7 @@ var _ = Describe("4 validators Istanbul", func() { container.ImageName("quay.io/maicoin/ottoman_geth:istanbul_develop"), container.HostDataDir(env.DataDir), container.DataDir("/data"), - container.Port(fmt.Sprintf("%d", env.HttpPort)), + container.Port(fmt.Sprintf("%d", env.P2PPort)), container.RPC(), container.RPCAddress("0.0.0.0"), container.RPCAPI("eth,net,web3,personal"),