diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-15 22:19:10 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-15 22:19:10 +0800 |
commit | 7d95e8624a3bdca4a68b2a7ff6ed133264088cc1 (patch) | |
tree | 2509b79c2b24015e339132eb80e28773df0b106e /ethvm | |
parent | 2b9f71c6ca45929ccef844838c633aa0af5802be (diff) | |
download | go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.gz go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.bz2 go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.lz go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.xz go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.tar.zst go-tangerine-7d95e8624a3bdca4a68b2a7ff6ed133264088cc1.zip |
Added message to closure && added change addresses
Diffstat (limited to 'ethvm')
-rw-r--r-- | ethvm/closure.go | 11 | ||||
-rw-r--r-- | ethvm/vm.go | 7 |
2 files changed, 9 insertions, 9 deletions
diff --git a/ethvm/closure.go b/ethvm/closure.go index f9be952d4..54bfd05f4 100644 --- a/ethvm/closure.go +++ b/ethvm/closure.go @@ -18,9 +18,10 @@ type ClosureRef interface { // Basic inline closure object which implement the 'closure' interface type Closure struct { - caller ClosureRef - object *ethstate.StateObject - Code []byte + caller ClosureRef + object *ethstate.StateObject + Code []byte + message *ethstate.Message Gas, UsedGas, Price *big.Int @@ -28,8 +29,8 @@ type Closure struct { } // Create a new closure for the given data items -func NewClosure(caller ClosureRef, object *ethstate.StateObject, code []byte, gas, price *big.Int) *Closure { - c := &Closure{caller: caller, object: object, Code: code, Args: nil} +func NewClosure(msg *ethstate.Message, caller ClosureRef, object *ethstate.StateObject, code []byte, gas, price *big.Int) *Closure { + c := &Closure{message: msg, caller: caller, object: object, Code: code, Args: nil} // Gas should be a pointer so it can safely be reduced through the run // This pointer will be off the state transition diff --git a/ethvm/vm.go b/ethvm/vm.go index a0d4db591..789697865 100644 --- a/ethvm/vm.go +++ b/ethvm/vm.go @@ -645,8 +645,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) { val, loc := stack.Popn() closure.SetStorage(loc, ethutil.NewValue(val)) - // Add the change to manifest - self.env.State().Manifest().AddStorageChange(closure.Object(), loc.Bytes(), val) + closure.message.AddStorageChange(loc.Bytes()) self.Printf(" {0x%x : 0x%x}", loc.Bytes(), val.Bytes()) case JUMP: @@ -719,7 +718,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) { closure.UseGas(closure.Gas) // Create the closure - c := NewClosure(closure, contract, initCode, gas, closure.Price) + c := NewClosure(msg, closure, contract, initCode, gas, closure.Price) // Call the closure and set the return value as // main script. contract.Code, _, err = c.Call(self, nil) @@ -783,7 +782,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) { stateObject.AddAmount(value) // Create a new callable closure - c := NewClosure(closure, stateObject, stateObject.Code, gas, closure.Price) + c := NewClosure(msg, closure, stateObject, stateObject.Code, gas, closure.Price) // Executer the closure and get the return value (if any) ret, _, err := c.Call(self, args) if err != nil { |