mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Make lightserver a miner, the first server doesn't really matter
This commit is contained in:
parent
0158889e7d
commit
d2a28b29d8
1 changed files with 8 additions and 7 deletions
|
|
@ -98,19 +98,17 @@ func startGethWithRpc(t *testing.T, name string, datadir string, args ...string)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%v rpc connect: %v", name, err)
|
t.Fatalf("%v rpc connect: %v", name, err)
|
||||||
}
|
}
|
||||||
t.Logf("%v rpc dial done", name)
|
t.Logf("Started with rpc: %v", name)
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
func startMiner(t *testing.T) *gethrpc {
|
func startServer(t *testing.T) *gethrpc {
|
||||||
datadir := tmpdir(t)
|
datadir := tmpdir(t)
|
||||||
defer os.RemoveAll(datadir)
|
defer os.RemoveAll(datadir)
|
||||||
|
|
||||||
runGeth(t, "--datadir", datadir, "init", "./testdata/genesis.json").WaitExit()
|
runGeth(t, "--datadir", datadir, "init", "./testdata/genesis.json").WaitExit()
|
||||||
runGeth(t, "--datadir", datadir, "--gcmode=archive", "import", "./testdata/blockchain.blocks").WaitExit()
|
runGeth(t, "--datadir", datadir, "--gcmode=archive", "import", "./testdata/blockchain.blocks").WaitExit()
|
||||||
//etherbase := "0x8888f1f195afa192cfee860698584c030f4c9db1"
|
g := startGethWithRpc(t, "server", datadir, "--nodiscover", "--light.serve=1", "--nat=extip:127.0.0.1")
|
||||||
// g := startGethWithRpc(t, "miner", datadir, "--mine", "--nodiscover", "--light.serve=1", "--miner.etherbase", etherbase, "--nat=extip:127.0.0.1")
|
|
||||||
g := startGethWithRpc(t, "miner", datadir, "--nodiscover", "--light.serve=1", "--nat=extip:127.0.0.1")
|
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,7 +117,10 @@ func startLightServer(t *testing.T) *gethrpc {
|
||||||
defer os.RemoveAll(datadir)
|
defer os.RemoveAll(datadir)
|
||||||
|
|
||||||
runGeth(t, "--datadir", datadir, "init", "./testdata/genesis.json").WaitExit()
|
runGeth(t, "--datadir", datadir, "init", "./testdata/genesis.json").WaitExit()
|
||||||
g := startGethWithRpc(t, "server", datadir, "--light.serve=100", "--light.maxpeers=1", "--nodiscover", "--nat=extip:127.0.0.1")
|
// Start it as a miner, otherwise it won't consider itself synced
|
||||||
|
// Use the coinbase from testdata/genesis.json
|
||||||
|
etherbase := "0x8888f1f195afa192cfee860698584c030f4c9db1"
|
||||||
|
g := startGethWithRpc(t, "lightserver", datadir, "--mine", "--miner.etherbase", etherbase, "--syncmode=fast", "--light.serve=100", "--light.maxpeers=1", "--nodiscover", "--nat=extip:127.0.0.1")
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
func startClient(t *testing.T, name string) *gethrpc {
|
func startClient(t *testing.T, name string) *gethrpc {
|
||||||
|
|
@ -134,7 +135,7 @@ func startClient(t *testing.T, name string) *gethrpc {
|
||||||
|
|
||||||
func TestPriorityClient(t *testing.T) {
|
func TestPriorityClient(t *testing.T) {
|
||||||
// Init and start server
|
// Init and start server
|
||||||
miner := startMiner(t)
|
miner := startServer(t)
|
||||||
defer miner.killAndWait()
|
defer miner.killAndWait()
|
||||||
|
|
||||||
server := startLightServer(t)
|
server := startLightServer(t)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue