diff options
Diffstat (limited to 'core/vm/context.go')
-rw-r--r-- | core/vm/context.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/core/vm/context.go b/core/vm/context.go index e73199b77..e4b94b600 100644 --- a/core/vm/context.go +++ b/core/vm/context.go @@ -74,16 +74,12 @@ func (c *Context) Return(ret []byte) []byte { /* * Gas functions */ -func (c *Context) UseGas(gas *big.Int) bool { - if c.Gas.Cmp(gas) < 0 { - return false +func (c *Context) UseGas(gas *big.Int) (ok bool) { + ok = UseGas(c.Gas, gas) + if ok { + c.UsedGas.Add(c.UsedGas, gas) } - - // Sub the amount of gas from the remaining - c.Gas.Sub(c.Gas, gas) - c.UsedGas.Add(c.UsedGas, gas) - - return true + return } // Implement the caller interface |