From 43390fe91db115fb13f7058d85dd4dbdb1721c60 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Thu, 1 Oct 2020 13:43:28 +0300 Subject: [PATCH] rpc: check VM state in (*Client).CreateTXFromScript We should also pay attention to the VM state before adding system fee to the transaction. We shouldn't allow to add system fee in case if transaction script is bad. --- pkg/rpc/client/nep5.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/rpc/client/nep5.go b/pkg/rpc/client/nep5.go index 8d9902323..1fc5fa89b 100644 --- a/pkg/rpc/client/nep5.go +++ b/pkg/rpc/client/nep5.go @@ -155,6 +155,9 @@ func (c *Client) CreateTxFromScript(script []byte, acc *wallet.Account, sysFee, if err != nil { return nil, fmt.Errorf("can't add system fee to transaction: %w", err) } + if result.State != "HALT" { + return nil, fmt.Errorf("can't add system fee to transaction: bad vm state: %s", result.State) + } sysFee = result.GasConsumed }