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

added THROW and THROWIFNOT opcodes to engine #24

Merged
merged 1 commit into from
Oct 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions neo/VM/ExecutionEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,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