mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Update consensus.go
This commit is contained in:
parent
afa685efa0
commit
0d0468b132
1 changed files with 3 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
defmath "math"
|
||||||
"math/big"
|
"math/big"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -538,7 +538,7 @@ var (
|
||||||
// calculate reward for miners
|
// calculate reward for miners
|
||||||
func calculateReward(reward int, currentTimestamp uint64) (blockReward *big.Int) {
|
func calculateReward(reward int, currentTimestamp uint64) (blockReward *big.Int) {
|
||||||
rewardMaxDecimal := 7
|
rewardMaxDecimal := 7
|
||||||
currentReward := float64(reward) * math.Pow(10, float64(rewardMaxDecimal))
|
currentReward := float64(reward) * defmath.Pow(10, float64(rewardMaxDecimal))
|
||||||
rewardDecreaseTime := int64(3*365*24*60*60)
|
rewardDecreaseTime := int64(3*365*24*60*60)
|
||||||
fromTimestamp := int64(1518395555)
|
fromTimestamp := int64(1518395555)
|
||||||
timeDiff := int64(currentTimestamp) - fromTimestamp
|
timeDiff := int64(currentTimestamp) - fromTimestamp
|
||||||
|
|
@ -551,7 +551,7 @@ func calculateReward(reward int, currentTimestamp uint64) (blockReward *big.Int)
|
||||||
currentReward = currentReward / 2
|
currentReward = currentReward / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
if currentReward != math.Trunc(currentReward) {
|
if currentReward != defmath.Trunc(currentReward) {
|
||||||
currentReward = 0
|
currentReward = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue