diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-29 03:03:25 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-29 03:03:25 +0800 |
commit | 3b7e4173ce00fb82ee2f186350dd2aca528ea60d (patch) | |
tree | 8f80238dd5cbe37919e7a3afcbaf5c6b382c64e6 /core/vm/context.go | |
parent | 3ea8c7301e6227467e39ae3daa0f382f06b16fba (diff) | |
download | go-tangerine-3b7e4173ce00fb82ee2f186350dd2aca528ea60d.tar.gz go-tangerine-3b7e4173ce00fb82ee2f186350dd2aca528ea60d.tar.zst go-tangerine-3b7e4173ce00fb82ee2f186350dd2aca528ea60d.zip |
Cleanup VM
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 |