diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-06 22:12:40 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | fb06ccc049ebaffabae928e8234b949d3bb53865 (patch) | |
tree | fbb4f520583ea491ddebcc451cc34ed49aa23fdd /core/genesis.go | |
parent | 21fabd3f164b23a3f984fceb1d8cdd7ab6c62978 (diff) | |
download | dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.tar dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.tar.gz dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.tar.bz2 dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.tar.lz dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.tar.xz dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.tar.zst dexon-fb06ccc049ebaffabae928e8234b949d3bb53865.zip |
core: vm: governance: add node info
Diffstat (limited to 'core/genesis.go')
-rw-r--r-- | core/genesis.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/genesis.go b/core/genesis.go index 5b168431f..552de19f3 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -80,6 +80,14 @@ func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error { return nil } +// NodeInfo represents the info of a node. +type NodeInfo struct { + Name string `json:"name"` + Email string `json:"email"` + Location string `json:"location"` + Url string `json:"url"` +} + // GenesisAccount is an account in the state of the genesis block. type GenesisAccount struct { Code []byte `json:"code,omitempty"` @@ -88,6 +96,7 @@ type GenesisAccount struct { Nonce uint64 `json:"nonce,omitempty"` Staked *big.Int `json:"staked"` PublicKey []byte `json:"publicKey"` + NodeInfo NodeInfo `json:"info"` PrivateKey []byte `json:"secretKey,omitempty"` // for tests } @@ -285,7 +294,9 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { account.Staked = big.NewInt(0) } if account.Staked.Cmp(big.NewInt(0)) > 0 { - govStateHelper.Stake(addr, account.PublicKey, account.Staked) + govStateHelper.Stake(addr, account.PublicKey, account.Staked, + account.NodeInfo.Name, account.NodeInfo.Email, + account.NodeInfo.Location, account.NodeInfo.Url) } } // Genesis CRS. @@ -420,6 +431,7 @@ func decodePrealloc(data string) GenesisAlloc { Staked *big.Int Code []byte PublicKey []byte + NodeInfo NodeInfo } var p []struct { @@ -436,6 +448,7 @@ func decodePrealloc(data string) GenesisAlloc { Staked: account.Account.Staked, Code: account.Account.Code, PublicKey: account.Account.PublicKey, + NodeInfo: account.Account.NodeInfo, } } return ga |