|
|
@ -95,9 +95,9 @@ func (g *gethrpc) waitSynced() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func startGethWithRpc(t *testing.T, name string, args ...string) *gethrpc { |
|
|
|
func startGethWithIpc(t *testing.T, name string, args ...string) *gethrpc { |
|
|
|
g := &gethrpc{name: name} |
|
|
|
g := &gethrpc{name: name} |
|
|
|
args = append([]string{"--networkid=42", "--port=0", "--nousb", "--http", "--http.port=0", "--http.api=admin,eth,les"}, args...) |
|
|
|
args = append([]string{"--networkid=42", "--port=0", "--nousb"}, args...) |
|
|
|
t.Logf("Starting %v with rpc: %v", name, args) |
|
|
|
t.Logf("Starting %v with rpc: %v", name, args) |
|
|
|
g.geth = runGeth(t, args...) |
|
|
|
g.geth = runGeth(t, args...) |
|
|
|
// wait before we can attach to it. TODO: probe for it properly
|
|
|
|
// wait before we can attach to it. TODO: probe for it properly
|
|
|
@ -112,7 +112,7 @@ func startGethWithRpc(t *testing.T, name string, args ...string) *gethrpc { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func initGeth(t *testing.T) string { |
|
|
|
func initGeth(t *testing.T) string { |
|
|
|
g := runGeth(t, "--networkid=42", "init", "./testdata/clique.json") |
|
|
|
g := runGeth(t, "--nousb", "--networkid=42", "init", "./testdata/clique.json") |
|
|
|
datadir := g.Datadir |
|
|
|
datadir := g.Datadir |
|
|
|
g.WaitExit() |
|
|
|
g.WaitExit() |
|
|
|
return datadir |
|
|
|
return datadir |
|
|
@ -120,15 +120,15 @@ func initGeth(t *testing.T) string { |
|
|
|
|
|
|
|
|
|
|
|
func startLightServer(t *testing.T) *gethrpc { |
|
|
|
func startLightServer(t *testing.T) *gethrpc { |
|
|
|
datadir := initGeth(t) |
|
|
|
datadir := initGeth(t) |
|
|
|
runGeth(t, "--datadir", datadir, "--password", "./testdata/password.txt", "account", "import", "./testdata/key.prv").WaitExit() |
|
|
|
runGeth(t, "--nousb", "--datadir", datadir, "--password", "./testdata/password.txt", "account", "import", "./testdata/key.prv").WaitExit() |
|
|
|
account := "0x02f0d131f1f97aef08aec6e3291b957d9efe7105" |
|
|
|
account := "0x02f0d131f1f97aef08aec6e3291b957d9efe7105" |
|
|
|
server := startGethWithRpc(t, "lightserver", "--allow-insecure-unlock", "--datadir", datadir, "--password", "./testdata/password.txt", "--unlock", account, "--mine", "--light.serve=100", "--light.maxpeers=1", "--nodiscover", "--nat=extip:127.0.0.1") |
|
|
|
server := startGethWithIpc(t, "lightserver", "--allow-insecure-unlock", "--datadir", datadir, "--password", "./testdata/password.txt", "--unlock", account, "--mine", "--light.serve=100", "--light.maxpeers=1", "--nodiscover", "--nat=extip:127.0.0.1") |
|
|
|
return server |
|
|
|
return server |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func startClient(t *testing.T, name string) *gethrpc { |
|
|
|
func startClient(t *testing.T, name string) *gethrpc { |
|
|
|
datadir := initGeth(t) |
|
|
|
datadir := initGeth(t) |
|
|
|
return startGethWithRpc(t, name, "--datadir", datadir, "--nodiscover", "--syncmode=light", "--nat=extip:127.0.0.1") |
|
|
|
return startGethWithIpc(t, name, "--datadir", datadir, "--nodiscover", "--syncmode=light", "--nat=extip:127.0.0.1") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestPriorityClient(t *testing.T) { |
|
|
|
func TestPriorityClient(t *testing.T) { |
|
|
@ -166,6 +166,7 @@ func TestPriorityClient(t *testing.T) { |
|
|
|
freeCli.getNodeInfo().ID: freeCli, |
|
|
|
freeCli.getNodeInfo().ID: freeCli, |
|
|
|
prioCli.getNodeInfo().ID: prioCli, |
|
|
|
prioCli.getNodeInfo().ID: prioCli, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
time.Sleep(1 * time.Second) |
|
|
|
lightServer.callRPC(&peers, "admin_peers") |
|
|
|
lightServer.callRPC(&peers, "admin_peers") |
|
|
|
peersWithNames := make(map[string]string) |
|
|
|
peersWithNames := make(map[string]string) |
|
|
|
for _, p := range peers { |
|
|
|
for _, p := range peers { |
|
|
|