Skip to content

Commit a1b336b

Browse files
authored
Merge pull request #118 from MinterTeam/fix/div-by-zero
Temporary fix for division by zero
2 parents 978fdfa + e1361f9 commit a1b336b

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 0.4.3
4+
*Oct 4th, 2018*
5+
6+
BUG FIXES
7+
8+
- [core] Fix division by zero
9+
310
## 0.4.2
411
*Sept 21th, 2018*
512

core/state/state_candidate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ func (s *Stake) CalcBipValue(context *StateDB) *big.Int {
108108

109109
data := context.stakeCache[s.Coin]
110110

111+
if data.TotalValue.Cmp(types.Big0) == 0 {
112+
return big.NewInt(0)
113+
}
114+
111115
value := big.NewInt(0).Set(data.BipValue)
112116
value.Mul(value, s.Value)
113117
value.Div(value, data.TotalValue)

version/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ package version
44
const (
55
Maj = "0"
66
Min = "4"
7-
Fix = "2"
7+
Fix = "3"
88
)
99

1010
var (
1111
// Must be a string because scripts like dist.sh read this file.
12-
Version = "0.4.2"
12+
Version = "0.4.3"
1313

1414
// GitCommit is the current HEAD set using ldflags.
1515
GitCommit string

0 commit comments

Comments
 (0)