Disable charging INPUT costs on OUT_OF_BALANCE
@@ -99,16 +99,8 @@ func (th *transactionHandler) Execute(ctx contract.Context, estimate bool) (txre
if !cc.ApplySteps(state.StepTypeDefault, 1) {
status = scoreresult.ErrOutOfStep
- } else {
- cnt, err := MeasureBytesOfData(ctx.Revision(), th.data)
- if err != nil {
- return nil, err
- } else {
- if !cc.ApplySteps(state.StepTypeInput, cnt) {
- status = scoreresult.ErrOutOfStep
}
- // Check balance before start
if status == nil && !isPatch && !estimate {
as := ctx.GetAccountState(th.from.ID())
bal := as.GetBalance()
@@ -121,6 +113,16 @@ func (th *transactionHandler) Execute(ctx contract.Context, estimate bool) (txre
}
}
+ if status == nil {
+ cnt, err := MeasureBytesOfData(ctx.Revision(), th.data)
+ if err != nil {
+ return nil, err
+ }
+ if !cc.ApplySteps(state.StepTypeInput, cnt) {
+ status = scoreresult.ErrOutOfStep
+ }
+ }
+
// Execute
if status == nil {
var used *big.Int
@@ -136,8 +138,6 @@ func (th *transactionHandler) Execute(ctx contract.Context, estimate bool) (txre
cc.DeductSteps(cc.StepAvailable())
}
}
- }
- }
// Try to charge fee
stepPrice := ctx.StepPrice()
