vm: implement ASSERT/ABORT opcodes

Rename THROWIFNOT to ASSERT, add ABORT opcode.
ABORT cannot be caught, but the implementation should be postponed until
exception handling is implemented.
This commit is contained in:
Evgenii Stratonikov 2020-05-06 15:54:18 +03:00
parent 963a70d54a
commit 977c431bf1
9 changed files with 104 additions and 98 deletions

View file

@ -424,7 +424,7 @@ func TestCreateBasicChain(t *testing.T) {
func newNEP5Transfer(sc, from, to util.Uint160, amount int64) *transaction.Transaction {
w := io.NewBufBinWriter()
emit.AppCallWithOperationAndArgs(w.BinWriter, sc, "transfer", from, to, amount)
emit.Opcode(w.BinWriter, opcode.THROWIFNOT)
emit.Opcode(w.BinWriter, opcode.ASSERT)
script := w.Bytes()
return transaction.NewInvocationTX(script, 0)