In blocktest cmd, disable network and add RPC flag
This commit is contained in:
@ -26,10 +26,10 @@ be able to interact with the chain defined by the test.
|
||||
}
|
||||
|
||||
func runblocktest(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 2 {
|
||||
utils.Fatalf("This command requires two arguments.")
|
||||
if len(ctx.Args()) != 3 {
|
||||
utils.Fatalf("Usage: ethereum blocktest <path-to-test-file> <test-name> {rpc, norpc}")
|
||||
}
|
||||
file, testname := ctx.Args()[0], ctx.Args()[1]
|
||||
file, testname, startrpc := ctx.Args()[0], ctx.Args()[1], ctx.Args()[2]
|
||||
|
||||
bt, err := tests.LoadBlockTests(file)
|
||||
if err != nil {
|
||||
@ -42,6 +42,7 @@ func runblocktest(ctx *cli.Context) {
|
||||
|
||||
cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx)
|
||||
cfg.NewDB = func(path string) (common.Database, error) { return ethdb.NewMemDatabase() }
|
||||
cfg.MaxPeers = 0 // disable network
|
||||
ethereum, err := eth.New(cfg)
|
||||
if err != nil {
|
||||
utils.Fatalf("%v", err)
|
||||
@ -62,5 +63,11 @@ func runblocktest(ctx *cli.Context) {
|
||||
} else {
|
||||
fmt.Println("Block Test chain loaded, starting ethereum.")
|
||||
}
|
||||
startEth(ctx, ethereum)
|
||||
if startrpc == "rpc" {
|
||||
startEth(ctx, ethereum)
|
||||
utils.StartRPC(ethereum, ctx)
|
||||
ethereum.WaitForShutdown()
|
||||
} else {
|
||||
startEth(ctx, ethereum)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user