diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f122584..0a957a99a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.4.3 +*Oct 4th, 2018* + +BUG FIXES + +- [core] Fix division by zero + ## 0.4.2 *Sept 21th, 2018* diff --git a/core/state/state_candidate.go b/core/state/state_candidate.go index 8403df6b1..674c3a485 100644 --- a/core/state/state_candidate.go +++ b/core/state/state_candidate.go @@ -108,6 +108,10 @@ func (s *Stake) CalcBipValue(context *StateDB) *big.Int { data := context.stakeCache[s.Coin] + if data.TotalValue.Cmp(types.Big0) == 0 { + return big.NewInt(0) + } + value := big.NewInt(0).Set(data.BipValue) value.Mul(value, s.Value) value.Div(value, data.TotalValue) diff --git a/version/version.go b/version/version.go index 6e71d292a..1f4f35ce6 100755 --- a/version/version.go +++ b/version/version.go @@ -4,12 +4,12 @@ package version const ( Maj = "0" Min = "4" - Fix = "2" + Fix = "3" ) var ( // Must be a string because scripts like dist.sh read this file. - Version = "0.4.2" + Version = "0.4.3" // GitCommit is the current HEAD set using ldflags. GitCommit string