aboutsummaryrefslogtreecommitdiffstats
path: root/tests/block_test_util.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-11-18 00:33:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-11-27 17:06:12 +0800
commit1e806c4c775bd98b224eb0249007502d348e737b (patch)
treea34bfcac320df6f65e73eb1578b212289be86b5f /tests/block_test_util.go
parent8a44451edfa36ea40da564a2fa7ea905d45440a4 (diff)
downloaddexon-1e806c4c775bd98b224eb0249007502d348e737b.tar.gz
dexon-1e806c4c775bd98b224eb0249007502d348e737b.tar.zst
dexon-1e806c4c775bd98b224eb0249007502d348e737b.zip
cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacks
Diffstat (limited to 'tests/block_test_util.go')
-rw-r--r--tests/block_test_util.go23
1 files changed, 8 insertions, 15 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go
index 6a2eb96a4..473bc3419 100644
--- a/tests/block_test_util.go
+++ b/tests/block_test_util.go
@@ -36,7 +36,9 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
+ "github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -165,15 +167,6 @@ func runBlockTest(test *BlockTest) error {
ks := crypto.NewKeyStorePassphrase(filepath.Join(common.DefaultDataDir(), "keystore"), crypto.StandardScryptN, crypto.StandardScryptP)
am := accounts.NewManager(ks)
db, _ := ethdb.NewMemDatabase()
- cfg := &eth.Config{
- DataDir: common.DefaultDataDir(),
- Verbosity: 5,
- Etherbase: common.Address{},
- AccountManager: am,
- NewDB: func(path string) (ethdb.Database, error) { return db, nil },
- }
-
- cfg.GenesisBlock = test.Genesis
// import pre accounts & construct test genesis block & state root
_, err := test.InsertPreState(db, am)
@@ -181,16 +174,16 @@ func runBlockTest(test *BlockTest) error {
return fmt.Errorf("InsertPreState: %v", err)
}
- ethereum, err := eth.New(cfg)
- if err != nil {
- return err
+ cfg := &eth.Config{
+ TestGenesisState: db,
+ TestGenesisBlock: test.Genesis,
+ Etherbase: common.Address{},
+ AccountManager: am,
}
-
- err = ethereum.Start()
+ ethereum, err := eth.New(&node.ServiceContext{EventMux: new(event.TypeMux)}, cfg)
if err != nil {
return err
}
-
cm := ethereum.BlockChain()
validBlocks, err := test.TryBlocksInsert(cm)
if err != nil {