From a32c51effda8682b292d04863aae7811f78abf7e Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 10 Jul 2015 14:29:40 +0200 Subject: 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. --- common/natspec/natspec_e2e_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common') 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 { -- cgit v1.2.3