diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-09-16 22:50:14 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-09-16 22:50:14 +0800 |
commit | 985b5f29ed18eac6a36d569edbde6dcfde8d1ab0 (patch) | |
tree | a5e098c99993d7abe7e012f147e98a1c68bb046c /core/genesis.go | |
parent | 1cc2f080417ba77ecb66a058727e00f6644c5e7b (diff) | |
parent | b25258996059439df82687cc653ed14a5a9edce1 (diff) | |
download | dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.tar dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.tar.gz dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.tar.bz2 dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.tar.lz dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.tar.xz dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.tar.zst dexon-985b5f29ed18eac6a36d569edbde6dcfde8d1ab0.zip |
Merge pull request #1801 from fjl/ethdb
all: move common.Database to ethdb and add NewBatch
Diffstat (limited to 'core/genesis.go')
-rw-r--r-- | core/genesis.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/genesis.go b/core/genesis.go index 3a8f0af0c..727e2c75f 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -27,13 +27,14 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/params" ) // WriteGenesisBlock writes the genesis block to the database as block number 0 -func WriteGenesisBlock(chainDb common.Database, reader io.Reader) (*types.Block, error) { +func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, error) { contents, err := ioutil.ReadAll(reader) if err != nil { return nil, err @@ -110,7 +111,7 @@ func WriteGenesisBlock(chainDb common.Database, reader io.Reader) (*types.Block, // GenesisBlockForTesting creates a block in which addr has the given wei balance. // The state trie of the block is written to db. -func GenesisBlockForTesting(db common.Database, addr common.Address, balance *big.Int) *types.Block { +func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big.Int) *types.Block { statedb := state.New(common.Hash{}, db) obj := statedb.GetOrNewStateObject(addr) obj.SetBalance(balance) @@ -124,7 +125,7 @@ func GenesisBlockForTesting(db common.Database, addr common.Address, balance *bi return block } -func WriteGenesisBlockForTesting(db common.Database, addr common.Address, balance *big.Int) *types.Block { +func WriteGenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big.Int) *types.Block { testGenesis := fmt.Sprintf(`{ "nonce":"0x%x", "gasLimit":"0x%x", @@ -137,7 +138,7 @@ func WriteGenesisBlockForTesting(db common.Database, addr common.Address, balanc return block } -func WriteTestNetGenesisBlock(chainDb common.Database, nonce uint64) (*types.Block, error) { +func WriteTestNetGenesisBlock(chainDb ethdb.Database, nonce uint64) (*types.Block, error) { testGenesis := fmt.Sprintf(`{ "nonce":"0x%x", "gasLimit":"0x%x", |