diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-19 16:31:44 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:23:39 +0800 |
commit | 93563f41410b964454f23229cfabe1ec1ba735f5 (patch) | |
tree | 4fbae033c7abf67076e5e04fd43a3931c8525392 /params | |
parent | 9ec8fa02e86e992f8dc6a1f230b2e406178f24de (diff) | |
download | go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.tar go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.tar.gz go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.tar.bz2 go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.tar.lz go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.tar.xz go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.tar.zst go-tangerine-93563f41410b964454f23229cfabe1ec1ba735f5.zip |
core: vm: add blockReward to governance
Diffstat (limited to 'params')
-rw-r--r-- | params/config.go | 10 | ||||
-rw-r--r-- | params/gen_dexcon_config.go | 22 |
2 files changed, 16 insertions, 16 deletions
diff --git a/params/config.go b/params/config.go index c5437256b..358a26749 100644 --- a/params/config.go +++ b/params/config.go @@ -232,8 +232,9 @@ func (c *CliqueConfig) String() string { // DexconConfig is the consensus engine configs for DEXON consensus. type DexconConfig struct { - Owner common.Address `json:"owner"` GenesisCRSText string `json:"genesisCRSText"` + Owner common.Address `json:"owner"` + BlockReward *big.Int `json:"blockReward"` NumChains uint32 `json:"numChains"` LambdaBA uint64 `json:"lambdaBA"` LambdaDKG uint64 `json:"lambdaDKG"` @@ -244,7 +245,6 @@ type DexconConfig struct { RoundInterval uint64 `json:"roundInterval"` MinBlockInterval uint64 `json:"minBlockInterval"` MaxBlockInterval uint64 `json:"maxBlockInterval"` - BlockReward *big.Int `json:"blockReward"` } type dexconConfigSpecMarshaling struct { @@ -253,9 +253,10 @@ type dexconConfigSpecMarshaling struct { // String implements the stringer interface, returning the consensus engine details. func (d *DexconConfig) String() string { - return fmt.Sprintf("{Owner: %v GenesisCRSText: %v NumChains: %v LambdaBA: %v LambdaDKG: %v K: %v PhiRatio: %v NotarySetSize: %v DKGSetSize: %v RoundInterval: %v MinBlockInterval: %v MaxBlockInterval: %v BlockReward: %v", - d.Owner, + return fmt.Sprintf("{GenesisCRSText: %v Owner: %v BlockReward: %v NumChains: %v LambdaBA: %v LambdaDKG: %v K: %v PhiRatio: %v NotarySetSize: %v DKGSetSize: %v RoundInterval: %v MinBlockInterval: %v MaxBlockInterval: %v BlockReward: %v", d.GenesisCRSText, + d.Owner, + d.BlockReward, d.NumChains, d.LambdaBA, d.LambdaDKG, @@ -266,7 +267,6 @@ func (d *DexconConfig) String() string { d.RoundInterval, d.MinBlockInterval, d.MaxBlockInterval, - d.BlockReward, ) } diff --git a/params/gen_dexcon_config.go b/params/gen_dexcon_config.go index e53560e47..f81951140 100644 --- a/params/gen_dexcon_config.go +++ b/params/gen_dexcon_config.go @@ -15,8 +15,9 @@ var _ = (*dexconConfigSpecMarshaling)(nil) // MarshalJSON marshals as JSON. func (d DexconConfig) MarshalJSON() ([]byte, error) { type DexconConfig struct { - Owner common.Address `json:"owner"` GenesisCRSText string `json:"genesisCRSText"` + Owner common.Address `json:"owner"` + BlockReward *math.HexOrDecimal256 `json:"blockReward"` NumChains uint32 `json:"numChains"` LambdaBA uint64 `json:"lambdaBA"` LambdaDKG uint64 `json:"lambdaDKG"` @@ -27,11 +28,11 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) { RoundInterval uint64 `json:"roundInterval"` MinBlockInterval uint64 `json:"minBlockInterval"` MaxBlockInterval uint64 `json:"maxBlockInterval"` - BlockReward *math.HexOrDecimal256 `json:"blockReward"` } var enc DexconConfig - enc.Owner = d.Owner enc.GenesisCRSText = d.GenesisCRSText + enc.Owner = d.Owner + enc.BlockReward = (*math.HexOrDecimal256)(d.BlockReward) enc.NumChains = d.NumChains enc.LambdaBA = d.LambdaBA enc.LambdaDKG = d.LambdaDKG @@ -42,15 +43,15 @@ func (d DexconConfig) MarshalJSON() ([]byte, error) { enc.RoundInterval = d.RoundInterval enc.MinBlockInterval = d.MinBlockInterval enc.MaxBlockInterval = d.MaxBlockInterval - enc.BlockReward = (*math.HexOrDecimal256)(d.BlockReward) return json.Marshal(&enc) } // UnmarshalJSON unmarshals from JSON. func (d *DexconConfig) UnmarshalJSON(input []byte) error { type DexconConfig struct { - Owner *common.Address `json:"owner"` GenesisCRSText *string `json:"genesisCRSText"` + Owner *common.Address `json:"owner"` + BlockReward *math.HexOrDecimal256 `json:"blockReward"` NumChains *uint32 `json:"numChains"` LambdaBA *uint64 `json:"lambdaBA"` LambdaDKG *uint64 `json:"lambdaDKG"` @@ -61,17 +62,19 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error { RoundInterval *uint64 `json:"roundInterval"` MinBlockInterval *uint64 `json:"minBlockInterval"` MaxBlockInterval *uint64 `json:"maxBlockInterval"` - BlockReward *math.HexOrDecimal256 `json:"blockReward"` } var dec DexconConfig if err := json.Unmarshal(input, &dec); err != nil { return err } + if dec.GenesisCRSText != nil { + d.GenesisCRSText = *dec.GenesisCRSText + } if dec.Owner != nil { d.Owner = *dec.Owner } - if dec.GenesisCRSText != nil { - d.GenesisCRSText = *dec.GenesisCRSText + if dec.BlockReward != nil { + d.BlockReward = (*big.Int)(dec.BlockReward) } if dec.NumChains != nil { d.NumChains = *dec.NumChains @@ -103,8 +106,5 @@ func (d *DexconConfig) UnmarshalJSON(input []byte) error { if dec.MaxBlockInterval != nil { d.MaxBlockInterval = *dec.MaxBlockInterval } - if dec.BlockReward != nil { - d.BlockReward = (*big.Int)(dec.BlockReward) - } return nil } |