aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ethereum
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/ethereum')
-rw-r--r--cmd/ethereum/admin.go2
-rw-r--r--cmd/ethereum/blocktest.go28
-rw-r--r--cmd/ethereum/js.go1
-rw-r--r--cmd/ethereum/main.go2
4 files changed, 24 insertions, 9 deletions
diff --git a/cmd/ethereum/admin.go b/cmd/ethereum/admin.go
index 65adb4086..139395dad 100644
--- a/cmd/ethereum/admin.go
+++ b/cmd/ethereum/admin.go
@@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
- "github.com/ethereum/go-ethereum/state"
+ "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/xeth"
"github.com/robertkrimen/otto"
)
diff --git a/cmd/ethereum/blocktest.go b/cmd/ethereum/blocktest.go
index e6d701d2c..d9cdfa83f 100644
--- a/cmd/ethereum/blocktest.go
+++ b/cmd/ethereum/blocktest.go
@@ -5,9 +5,9 @@ import (
"github.com/codegangsta/cli"
"github.com/ethereum/go-ethereum/cmd/utils"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/tests"
)
@@ -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)
@@ -51,7 +52,8 @@ func runblocktest(ctx *cli.Context) {
ethereum.ResetWithGenesisBlock(test.Genesis)
// import pre accounts
- if err := test.InsertPreState(ethereum.StateDb()); err != nil {
+ statedb, err := test.InsertPreState(ethereum.StateDb())
+ if err != nil {
utils.Fatalf("could not insert genesis accounts: %v", err)
}
@@ -60,7 +62,19 @@ func runblocktest(ctx *cli.Context) {
if err := chain.InsertChain(test.Blocks); err != nil {
utils.Fatalf("Block Test load error: %v", err)
} else {
- fmt.Println("Block Test chain loaded, starting ethereum.")
+ fmt.Println("Block Test chain loaded")
+ }
+
+ if err := test.ValidatePostState(statedb); err != nil {
+ utils.Fatalf("post state validation failed: %v", err)
+ }
+ fmt.Println("Block Test post state validated, starting ethereum.")
+
+ if startrpc == "rpc" {
+ startEth(ctx, ethereum)
+ utils.StartRPC(ethereum, ctx)
+ ethereum.WaitForShutdown()
+ } else {
+ startEth(ctx, ethereum)
}
- startEth(ctx, ethereum)
}
diff --git a/cmd/ethereum/js.go b/cmd/ethereum/js.go
index 88d16d6a8..6f0ac526f 100644
--- a/cmd/ethereum/js.go
+++ b/cmd/ethereum/js.go
@@ -91,6 +91,7 @@ func newJSRE(ethereum *eth.Ethereum, libPath string) *jsre {
func (js *jsre) apiBindings() {
ethApi := rpc.NewEthereumApi(js.xeth, js.ethereum.DataDir)
+ ethApi.Close()
//js.re.Bind("jeth", rpc.NewJeth(ethApi, js.re.ToVal))
jeth := rpc.NewJeth(ethApi, js.re.ToVal, js.re)
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index e351453b1..5ad4c0a4e 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -36,7 +36,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/state"
+ "github.com/ethereum/go-ethereum/core/state"
"github.com/peterh/liner"
)