Skip to content

Commit

Permalink
Merge pull request #247 from MinterTeam/dev
Browse files Browse the repository at this point in the history
v0.20.4
  • Loading branch information
danil-lashin authored Apr 30, 2019
2 parents 57e6f7c + 4aec90f commit f671f1e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.20.4

BUG FIXES

- [core] Fix empty frozen funds case

## 0.20.3

BUG FIXES
Expand Down
39 changes: 21 additions & 18 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1677,30 +1677,33 @@ func (s *StateDB) deleteCoin(symbol types.CoinSymbol) {
// remove coin from frozen funds
for _, height := range frozenFundsHeights {
frozenFunds := s.GetStateFrozenFunds(height)
var newFrozenFundsList []FrozenFund
for _, ff := range frozenFunds.data.List {
if ff.Coin == symbol {
ret := formula.CalculateSaleReturn(coinToDelete.Volume(), coinToDelete.ReserveBalance(), 100, ff.Value)
if frozenFunds != nil {
var newFrozenFundsList []FrozenFund

coinToDelete.SubReserve(ret)
coinToDelete.SubVolume(ff.Value)
for _, ff := range frozenFunds.data.List {
if ff.Coin == symbol {
ret := formula.CalculateSaleReturn(coinToDelete.Volume(), coinToDelete.ReserveBalance(), 100, ff.Value)

newFrozenFundsList = append(newFrozenFundsList, FrozenFund{
Address: ff.Address,
CandidateKey: ff.CandidateKey,
Coin: types.GetBaseCoin(),
Value: ret,
})
coinToDelete.SubReserve(ret)
coinToDelete.SubVolume(ff.Value)

continue
newFrozenFundsList = append(newFrozenFundsList, FrozenFund{
Address: ff.Address,
CandidateKey: ff.CandidateKey,
Coin: types.GetBaseCoin(),
Value: ret,
})

continue
}

newFrozenFundsList = append(newFrozenFundsList, ff)
}

newFrozenFundsList = append(newFrozenFundsList, ff)
frozenFunds.data.List = newFrozenFundsList
s.setStateFrozenFunds(frozenFunds)
s.MarkStateFrozenFundsDirty(frozenFunds.blockHeight)
}

frozenFunds.data.List = newFrozenFundsList
s.setStateFrozenFunds(frozenFunds)
s.MarkStateFrozenFundsDirty(frozenFunds.blockHeight)
}

// remove coin from stakes
Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ package version
const (
Maj = "0"
Min = "20"
Fix = "3"
Fix = "4"

AppVer = 4
)

var (
// Must be a string because scripts like dist.sh read this file.
Version = "0.20.3"
Version = "0.20.4"

// GitCommit is the current HEAD set using ldflags.
GitCommit string
Expand Down

0 comments on commit f671f1e

Please sign in to comment.