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 (
|
import (
|
||||||
"github.com/CityOfZion/neo-go/pkg/vm"
|
"github.com/CityOfZion/neo-go/pkg/vm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InvokeResult is used as a wrapper to represent an invokation result.
|
// Invoke represents code invocation result and is used by several RPC calls
|
||||||
type InvokeResult struct {
|
// that invoke functions, scripts and generic bytecode.
|
||||||
|
type Invoke struct {
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
GasConsumed string `json:"gas_consumed"`
|
GasConsumed string `json:"gas_consumed"`
|
||||||
Script string `json:"script"`
|
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
|
// runScriptInVM runs given script in a new test VM and returns the invocation
|
||||||
// result.
|
// result.
|
||||||
func (s *Server) runScriptInVM(script []byte) *wrappers.InvokeResult {
|
func (s *Server) runScriptInVM(script []byte) *result.Invoke {
|
||||||
vm, _ := s.chain.GetTestVM()
|
vm, _ := s.chain.GetTestVM()
|
||||||
vm.SetGasLimit(s.config.MaxGasInvoke)
|
vm.SetGasLimit(s.config.MaxGasInvoke)
|
||||||
vm.LoadScript(script)
|
vm.LoadScript(script)
|
||||||
_ = vm.Run()
|
_ = vm.Run()
|
||||||
result := &wrappers.InvokeResult{
|
result := &result.Invoke{
|
||||||
State: vm.State(),
|
State: vm.State(),
|
||||||
GasConsumed: vm.GasConsumed().String(),
|
GasConsumed: vm.GasConsumed().String(),
|
||||||
Script: hex.EncodeToString(script),
|
Script: hex.EncodeToString(script),
|
||||||
|
|
Loading…
Reference in a new issue