use charge gas safe in places we return errors

This commit is contained in:
Jeromy 2020-03-27 10:11:21 -07:00
parent dc49a81a05
commit 97a7b449e6

View File

@ -210,7 +210,9 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
}() }()
} }
rt.ChargeGas(rt.Pricelist().OnMethodInvocation(msg.Value, msg.Method)) if aerr := rt.chargeGasSafe(rt.Pricelist().OnMethodInvocation(msg.Value, msg.Method)); aerr != nil {
return nil, aerrors.Wrap(aerr, "not enough gas for method invocation"), rt
}
toActor, err := st.GetActor(msg.To) toActor, err := st.GetActor(msg.To)
if err != nil { if err != nil {