Cleanup VM

This commit is contained in:
obscuren
2015-03-28 20:03:25 +01:00
parent 3ea8c7301e
commit 3b7e4173ce
5 changed files with 40 additions and 29 deletions

View File

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