mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
rpc: set MaxGasInvoke in config
Implement ability to restrict maximum amount of GAS available for free RPC calls.
This commit is contained in:
parent
4718375db1
commit
54e0b5a4a7
2 changed files with 4 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue