Fix problem to return OutOfBalance on setStake
@@ -125,6 +125,9 @@ func (s *chainScore) Ex_setStake(value *common.HexInt) (err error) {
account := s.cc.GetAccountState(s.from.ID())
balance := account.GetBalance()
availableStake := new(big.Int).Add(balance, ia.GetTotalStake())
+ if s.cc.Revision().LegacyFeeCharge() {
+ availableStake.Sub(availableStake, new(big.Int).Mul(s.cc.SumOfStepUsed(),s.cc.StepPrice()))
+ }
if availableStake.Cmp(v) == -1 {
return scoreresult.OutOfBalanceError.Errorf("Not enough balance")
}
