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.
This commit is contained in:
Anna Shaleva 2020-10-01 13:43:28 +03:00
parent 08aa773dac
commit 43390fe91d

View file

@ -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
}