aboutsummaryrefslogtreecommitdiffstats
path: root/core/genesis.go
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2018-11-05 11:26:27 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:17 +0800
commit23fc54de4f886978578207acc15f469abecc46b7 (patch)
treee9d63a4087f41a4cd53043a62e0b8f5731048ccd /core/genesis.go
parent541c269081e086a20db5883f6949f8c62d870e22 (diff)
downloadgo-tangerine-23fc54de4f886978578207acc15f469abecc46b7.tar
go-tangerine-23fc54de4f886978578207acc15f469abecc46b7.tar.gz
go-tangerine-23fc54de4f886978578207acc15f469abecc46b7.tar.bz2
go-tangerine-23fc54de4f886978578207acc15f469abecc46b7.tar.lz
go-tangerine-23fc54de4f886978578207acc15f469abecc46b7.tar.xz
go-tangerine-23fc54de4f886978578207acc15f469abecc46b7.tar.zst
go-tangerine-23fc54de4f886978578207acc15f469abecc46b7.zip
core: GenerateChainWithRoundChange for testing
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/genesis.go b/core/genesis.go
index 2412ede30..8b957edd2 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)
}