aboutsummaryrefslogtreecommitdiffstats
path: root/core/genesis.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-06 22:12:40 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit32dcd528f9152d6fe3e32f76adb1ea3c595910de (patch)
tree68a8468659525481527b417548ff4c9e39e17cb7 /core/genesis.go
parentc1548136288e12b83a993821b5668899aca53804 (diff)
downloadgo-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.tar
go-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.tar.gz
go-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.tar.bz2
go-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.tar.lz
go-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.tar.xz
go-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.tar.zst
go-tangerine-32dcd528f9152d6fe3e32f76adb1ea3c595910de.zip
core: vm: governance: add node info
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/genesis.go b/core/genesis.go
index 8b957edd2..38b8c360b 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