diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-02-22 13:14:55 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | c9104455be030e69fd499d6df646c3e0f021a9c0 (patch) | |
tree | 729516a01483e1a8aea3356e5a9000e6c6e53e25 /consensus/dexcon/dexcon.go | |
parent | 57998d5b9eceec5967637028c51aee374a812664 (diff) | |
download | dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.tar dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.tar.gz dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.tar.bz2 dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.tar.lz dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.tar.xz dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.tar.zst dexon-c9104455be030e69fd499d6df646c3e0f021a9c0.zip |
core: Remove K, Phi and NumChains from Governance (#198)
* change default sync_core.sh
* vendor: sync to latest core
* core: Remove K, Phi and NumChain
Diffstat (limited to 'consensus/dexcon/dexcon.go')
-rw-r--r-- | consensus/dexcon/dexcon.go | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/consensus/dexcon/dexcon.go b/consensus/dexcon/dexcon.go index 2e406f0b0..aff5c9c45 100644 --- a/consensus/dexcon/dexcon.go +++ b/consensus/dexcon/dexcon.go @@ -111,26 +111,17 @@ func (d *Dexcon) calculateBlockReward(round int64, state *state.StateDB) *big.In gs := d.govStateFetcer.GetGovStateHelperAtRound(uint64(round)) config := gs.Configuration() - gsCurrent := vm.GovernanceStateHelper{state} - configCurrent := gsCurrent.Configuration() - heightCurrent := gsCurrent.RoundHeight(big.NewInt(round)).Uint64() + blocksPerRound := config.RoundLength + roundInterval := new(big.Float).Mul( + big.NewFloat(float64(blocksPerRound)), + big.NewFloat(float64(config.MinBlockInterval))) - blocksPerRound := uint64(0) - - // The initial round, calculate an approximate number of round base on config. - if round == 0 || heightCurrent == 0 { - blocksPerRound = uint64(config.NumChains) * config.RoundInterval / config.MinBlockInterval - } else { - heightPrev := gsCurrent.RoundHeight(big.NewInt(round - 1)).Uint64() - blocksPerRound = heightCurrent - heightPrev - } - - // blockReard = miningVelocity * totalStaked * roundInterval / aYear / numBlocksInPrevRound + // blockReard = miningVelocity * totalStaked * roundInterval / aYear / numBlocksInCurRound numerator, _ := new(big.Float).Mul( new(big.Float).Mul( - big.NewFloat(float64(configCurrent.MiningVelocity)), + big.NewFloat(float64(config.MiningVelocity)), new(big.Float).SetInt(gs.TotalStaked())), - new(big.Float).SetInt(gs.RoundInterval())).Int(nil) + roundInterval).Int(nil) reward := new(big.Int).Div(numerator, new(big.Int).Mul( |