forked from TrueCloudLab/neoneo-go
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:
parent
08aa773dac
commit
43390fe91d
1 changed files with 3 additions and 0 deletions
|
@ -155,6 +155,9 @@ func (c *Client) CreateTxFromScript(script []byte, acc *wallet.Account, sysFee,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't add system fee to transaction: %w", err)
|
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
|
sysFee = result.GasConsumed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue