neoneo-go/pkg/vm/vm_ops.go
dauTT 24cd21bd8c VM:Implement THROW opcode (#219)
[VM]

- Changed vmstate from HALT to FAULT in Sub opcode
- Implemented THROW opcode + tests
- Renamed TestSimpleRun test to TestThrowIfNot
2019-03-26 21:19:41 +00:00

22 lines
603 B
Go

package vm
import "github.com/CityOfZion/neo-go/pkg/vm/stack"
type stackInfo func(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rstack *stack.RandomAccess) (Vmstate, error)
var opFunc = map[stack.Instruction]stackInfo{
stack.ADD: Add,
stack.SUB: Sub,
stack.PUSHBYTES1: PushNBytes,
stack.PUSHBYTES75: PushNBytes,
stack.RET: RET,
stack.EQUAL: EQUAL,
stack.THROWIFNOT: THROWIFNOT,
stack.THROW: THROW,
}
func init() {
for i := int(stack.PUSHBYTES1); i <= int(stack.PUSHBYTES75); i++ {
opFunc[stack.Instruction(i)] = PushNBytes
}
}