diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-26 13:33:35 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:17 +0800 |
commit | 1c480036940bc98702f09e2444461a349f3381cc (patch) | |
tree | 58ebd3fab992a360dfae654626cdfa13c3d32889 /core/genesis.go | |
parent | 5387db84cbb2e8c5838dacd2b9d02df894c1f262 (diff) | |
download | go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.tar go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.tar.gz go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.tar.bz2 go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.tar.lz go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.tar.xz go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.tar.zst go-tangerine-1c480036940bc98702f09e2444461a349f3381cc.zip |
core: set correct balance for governance contract
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 cdc5531f2..2412ede30 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -254,6 +254,8 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { statedb, _ := state.New(common.Hash{}, state.NewDatabase(db)) govStateHelper := vm.GovernanceStateHelper{statedb} + totalStaked := big.NewInt(0) + for addr, account := range g.Alloc { statedb.AddBalance(addr, new(big.Int).Sub(account.Balance, account.Staked)) statedb.SetCode(addr, account.Code) @@ -261,8 +263,12 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { for key, value := range account.Storage { statedb.SetState(addr, key, value) } + totalStaked = new(big.Int).Add(totalStaked, account.Staked) } + // Move staked balance to governance contract. + statedb.AddBalance(vm.GovernanceContractAddress, totalStaked) + // Stake in governance state. keys := AllocKey{} for addr := range g.Alloc { |