mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 09:33:36 +00:00
rpc: move Invoke to result package
It's just a data.
This commit is contained in:
parent
c189062f40
commit
b8f7ab8e6a
2 changed files with 6 additions and 5 deletions
|
@ -1,11 +1,12 @@
|
|||
package wrappers
|
||||
package result
|
||||
|
||||
import (
|
||||
"github.com/CityOfZion/neo-go/pkg/vm"
|
||||
)
|
||||
|
||||
// InvokeResult is used as a wrapper to represent an invokation result.
|
||||
type InvokeResult struct {
|
||||
// Invoke represents code invocation result and is used by several RPC calls
|
||||
// that invoke functions, scripts and generic bytecode.
|
||||
type Invoke struct {
|
||||
State string `json:"state"`
|
||||
GasConsumed string `json:"gas_consumed"`
|
||||
Script string `json:"script"`
|
|
@ -486,12 +486,12 @@ func (s *Server) invokescript(reqParams Params) (interface{}, error) {
|
|||
|
||||
// runScriptInVM runs given script in a new test VM and returns the invocation
|
||||
// result.
|
||||
func (s *Server) runScriptInVM(script []byte) *wrappers.InvokeResult {
|
||||
func (s *Server) runScriptInVM(script []byte) *result.Invoke {
|
||||
vm, _ := s.chain.GetTestVM()
|
||||
vm.SetGasLimit(s.config.MaxGasInvoke)
|
||||
vm.LoadScript(script)
|
||||
_ = vm.Run()
|
||||
result := &wrappers.InvokeResult{
|
||||
result := &result.Invoke{
|
||||
State: vm.State(),
|
||||
GasConsumed: vm.GasConsumed().String(),
|
||||
Script: hex.EncodeToString(script),
|
||||
|
|
Loading…
Reference in a new issue