diff --git a/config/config.go b/config/config.go index bda9d07c4..84143b84d 100644 --- a/config/config.go +++ b/config/config.go @@ -96,6 +96,9 @@ type ( EnableCORSWorkaround bool `yaml:"EnableCORSWorkaround"` Address string `yaml:"Address"` Port uint16 `yaml:"Port"` + // MaxGasInvoke is a maximum amount of gas which + // can be spent during RPC call. + MaxGasInvoke util.Fixed8 `yaml:"MaxGasInvoke"` } // NetMode describes the mode the blockchain will operate on. diff --git a/pkg/rpc/server.go b/pkg/rpc/server.go index 9c0e3b86f..b2cd26f56 100644 --- a/pkg/rpc/server.go +++ b/pkg/rpc/server.go @@ -396,6 +396,7 @@ func (s *Server) invokescript(reqParams Params) (interface{}, error) { // result. func (s *Server) runScriptInVM(script []byte) *wrappers.InvokeResult { vm, _ := s.chain.GetTestVM() + vm.SetGasLimit(s.config.MaxGasInvoke) vm.LoadScript(script) _ = vm.Run() result := &wrappers.InvokeResult{