From 8e0724873478ca44d844f897f74111f21fe6c276 Mon Sep 17 00:00:00 2001 From: tanyuan <1067598718@qq.com> Date: Fri, 28 Sep 2018 10:47:00 +0800 Subject: [PATCH] adjust validate service api order (#666) --- smartcontract/service/neovm/neovm_service.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/smartcontract/service/neovm/neovm_service.go b/smartcontract/service/neovm/neovm_service.go index a7435200c1..af63a8cb7b 100644 --- a/smartcontract/service/neovm/neovm_service.go +++ b/smartcontract/service/neovm/neovm_service.go @@ -253,6 +253,11 @@ func (this *NeoVmService) SystemCall(engine *vm.ExecutionEngine) error { if !ok { return errors.NewErr(fmt.Sprintf("[SystemCall] service not support: %s", serviceName)) } + if service.Validator != nil { + if err := service.Validator(engine); err != nil { + return errors.NewDetailErr(err, errors.ErrNoCode, "[SystemCall] service validator error!") + } + } price, err := GasPrice(engine, serviceName) if err != nil { return err @@ -260,12 +265,6 @@ func (this *NeoVmService) SystemCall(engine *vm.ExecutionEngine) error { if !this.ContextRef.CheckUseGas(price) { return ERR_GAS_INSUFFICIENT } - if service.Validator != nil { - if err := service.Validator(engine); err != nil { - return errors.NewDetailErr(err, errors.ErrNoCode, "[SystemCall] service validator error!") - } - } - if err := service.Execute(this, engine); err != nil { return errors.NewDetailErr(err, errors.ErrNoCode, "[SystemCall] service execute error!") }