aboutsummaryrefslogtreecommitdiff
path: root/core/genesis.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-30 17:05:50 -0400
committerDeterminant <[email protected]>2020-06-30 17:05:50 -0400
commit7feec02902d52a3abf722613eb9e218e015b723c (patch)
tree3ca683e866cdaba9c06480f825682677826557f3 /core/genesis.go
parent3a872747058e9fd32810d0864e19a197529b7d79 (diff)
make mc tx work
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/genesis.go b/core/genesis.go
index 347beb3..ef490bf 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -78,11 +78,14 @@ func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error {
return nil
}
+type GenesisMultiCoinBalance map[common.Hash]*big.Int
+
// GenesisAccount is an account in the state of the genesis block.
type GenesisAccount struct {
Code []byte `json:"code,omitempty"`
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
Balance *big.Int `json:"balance" gencodec:"required"`
+ MCBalance GenesisMultiCoinBalance `json:"mcbalance,omitempty"`
Nonce uint64 `json:"nonce,omitempty"`
PrivateKey []byte `json:"secretKey,omitempty"` // for tests
}
@@ -261,6 +264,12 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
for key, value := range account.Storage {
statedb.SetState(addr, key, value)
}
+ if account.MCBalance != nil {
+ statedb.ForceEnableMultiCoin(addr)
+ for coinID, value := range account.MCBalance {
+ statedb.AddBalanceMultiCoin(addr, coinID, value)
+ }
+ }
}
root := statedb.IntermediateRoot(false)
head := &types.Header{