diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-03-20 08:59:38 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-03-23 23:32:20 +0800 |
commit | 33c5186fd06d890e590b18cc6f8479070c2e51e8 (patch) | |
tree | 7c83451d6200f4d1e1e2fbea67bdff35f03ab9ea | |
parent | 3f6e1b2fd3cbc6aeb1bbe658dd5b70945a57dffa (diff) | |
download | dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.tar dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.tar.gz dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.tar.bz2 dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.tar.lz dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.tar.xz dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.tar.zst dexon-33c5186fd06d890e590b18cc6f8479070c2e51e8.zip |
In blocktest cmd, disable network and add RPC flag
-rw-r--r-- | cmd/ethereum/blocktest.go | 15 | ||||
-rw-r--r-- | cmd/utils/flags.go | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/cmd/ethereum/blocktest.go b/cmd/ethereum/blocktest.go index e6d701d2c..f2014acfd 100644 --- a/cmd/ethereum/blocktest.go +++ b/cmd/ethereum/blocktest.go @@ -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) + } } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index f87d25ce9..9a4ab5804 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -256,7 +256,7 @@ func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { addr := ctx.GlobalString(RPCListenAddrFlag.Name) port := ctx.GlobalInt(RPCPortFlag.Name) dataDir := ctx.GlobalString(DataDirFlag.Name) - + fmt.Println("Starting RPC on port: ", port) l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", addr, port)) if err != nil { Fatalf("Can't listen on %s:%d: %v", addr, port, err) |