Skip to content

Commit

Permalink
Merge branch 'staking' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
longzhi committed May 7, 2018
2 parents 70b6d01 + afcbc44 commit b19bb7c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions modules/stake/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,19 @@ func (c check) updateCandidacy(tx TxUpdateCandidacy) error {
return ErrBadAmount()
}

y := big.NewInt(int64(c.params.ReserveRequirementRatio))
rr.Mul(x, y)
rr.Div(rr, big.NewInt(100))

balance, err := commons.GetBalance(c.ethereum, c.sender)
if err != nil {
return err
}
if candidate.MaxShares.Cmp(x) != 0 {
y := big.NewInt(int64(c.params.ReserveRequirementRatio))
rr.Mul(x, y)
rr.Div(rr, big.NewInt(100))

balance, err := commons.GetBalance(c.ethereum, c.sender)
if err != nil {
return err
}

if balance.Cmp(rr) < 0 {
return ErrInsufficientFunds()
if balance.Cmp(rr) < 0 {
return ErrInsufficientFunds()
}
}
}

Expand Down

0 comments on commit b19bb7c

Please sign in to comment.