Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #24 from hal0x2328/master
Browse files Browse the repository at this point in the history
added THROW and THROWIFNOT opcodes to engine
  • Loading branch information
localhuman committed Oct 8, 2017
2 parents f1d9db3 + d2e28c0 commit f7efe14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions neo/VM/ExecutionEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,15 @@ def ExecuteOp(self, opcode, context):

estack.PushT(Struct(items))

elif opcode == THROW:
self._VMState |= VMState.FAULT
return

elif opcode == THROWIFNOT:
if estack.Pop().GetBoolean() == False:
self._VMState |= VMState.FAULT
return

else:

self._VMState |= VMState.FAULT
Expand Down
5 changes: 5 additions & 0 deletions neo/VM/OpCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
TAILCALL = b'\x69'


# Exceptions
THROW = b'\xf0'
THROWIFNOT = b'\xf1'


# Stack
DUPFROMALTSTACK = b'\x6A'
TOALTSTACK = b'\x6B' # Puts the input onto the top of the alt stack. Removes it from the main stack.
Expand Down

0 comments on commit f7efe14

Please sign in to comment.