diff options
author | Sonic <sonic@dexon.org> | 2018-11-05 11:26:27 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 82f6493b2e0f15de322041fcc510865bf1cd6375 (patch) | |
tree | 4f37ad418a7c02d05544e176c60dcb932c76cab9 /core/genesis.go | |
parent | 76e1c3ee422099442fa2aacbf7b701d64ef57761 (diff) | |
download | dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.tar dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.tar.gz dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.tar.bz2 dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.tar.lz dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.tar.xz dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.tar.zst dexon-82f6493b2e0f15de322041fcc510865bf1cd6375.zip |
core: GenerateChainWithRoundChange for testing
Diffstat (limited to 'core/genesis.go')
-rw-r--r-- | core/genesis.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/genesis.go b/core/genesis.go index ec168b2a4..5b168431f 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -257,6 +257,9 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { totalStaked := big.NewInt(0) for addr, account := range g.Alloc { + if account.Staked == nil { + account.Staked = big.NewInt(0) + } statedb.AddBalance(addr, new(big.Int).Sub(account.Balance, account.Staked)) statedb.SetCode(addr, account.Code) statedb.SetNonce(addr, account.Nonce) @@ -278,6 +281,9 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { for _, addr := range keys { account := g.Alloc[addr] + if account.Staked == nil { + account.Staked = big.NewInt(0) + } if account.Staked.Cmp(big.NewInt(0)) > 0 { govStateHelper.Stake(addr, account.PublicKey, account.Staked) } |