diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-10 20:29:40 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-10 23:37:41 +0800 |
commit | a32c51effda8682b292d04863aae7811f78abf7e (patch) | |
tree | d721822cc10c929d5a2def0865c366e085ef99be /common | |
parent | 5a810758dbe75dce9537d464ac0e5b5385b0e78f (diff) | |
download | dexon-a32c51effda8682b292d04863aae7811f78abf7e.tar.gz dexon-a32c51effda8682b292d04863aae7811f78abf7e.tar.zst dexon-a32c51effda8682b292d04863aae7811f78abf7e.zip |
cmd, core, eth, common: genesis preparation
Implemented the --genesis flag thru which we can set a custom genesis
block, including the official Ethereum genesis block.
Diffstat (limited to 'common')
-rw-r--r-- | common/natspec/natspec_e2e_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/natspec/natspec_e2e_test.go b/common/natspec/natspec_e2e_test.go index 0cbe040c0..395cef3c7 100644 --- a/common/natspec/natspec_e2e_test.go +++ b/common/natspec/natspec_e2e_test.go @@ -33,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/ethdb" xe "github.com/ethereum/go-ethereum/xeth" ) @@ -128,12 +129,12 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { if err != nil { panic(err) } + testAddress := strings.TrimPrefix(testAccount.Address.Hex(), "0x") + db, _ := ethdb.NewMemDatabase() // set up mock genesis with balance on the testAddress - core.GenesisAccounts = []byte(`{ - "` + testAddress + `": {"balance": "` + testBalance + `"} - }`) + core.WriteGenesisBlockForTesting(db, common.HexToAddress(testAddress), common.String2Big(testBalance)) // only use minimalistic stack with no networking ethereum, err = eth.New(ð.Config{ @@ -142,6 +143,7 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { MaxPeers: 0, PowTest: true, Etherbase: common.HexToAddress(testAddress), + NewDB: func(path string) (common.Database, error) { return db, nil }, }) if err != nil { |