diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-31 21:30:55 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-31 21:30:55 +0800 |
commit | 3453f8c5d2cf075063bcb8cd716b72e005b93e39 (patch) | |
tree | 6a4c6bca360dfafaaf48d39944dec5d0aafb7792 | |
parent | 485dcf90cd4ea290cc1b6bea1c4f3135aa25cb7c (diff) | |
download | dexon-3453f8c5d2cf075063bcb8cd716b72e005b93e39.tar.gz dexon-3453f8c5d2cf075063bcb8cd716b72e005b93e39.tar.zst dexon-3453f8c5d2cf075063bcb8cd716b72e005b93e39.zip |
Added Code field
-rw-r--r-- | core/genesis.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/genesis.go b/core/genesis.go index e0d3e51b8..716298231 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -7,8 +7,8 @@ import ( "os" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" ) /* @@ -34,7 +34,10 @@ func GenesisBlock(db common.Database) *types.Block { genesis.SetTransactions(types.Transactions{}) genesis.SetReceipts(types.Receipts{}) - var accounts map[string]struct{ Balance string } + var accounts map[string]struct { + Balance string + Code string + } err := json.Unmarshal(genesisData, &accounts) if err != nil { fmt.Println("enable to decode genesis json data:", err) @@ -46,6 +49,7 @@ func GenesisBlock(db common.Database) *types.Block { codedAddr := common.Hex2Bytes(addr) accountState := statedb.GetAccount(common.BytesToAddress(codedAddr)) accountState.SetBalance(common.Big(account.Balance)) + accountState.SetCode(common.FromHex(account.Code)) statedb.UpdateStateObject(accountState) } statedb.Sync() |