diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-02 23:14:12 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-02 23:14:12 +0800 |
commit | 4dc7ee90879d7146c9e5004c04992c90ad78f632 (patch) | |
tree | 7521046c38bb2e7c69b9813b669c87a8a55d4641 /core | |
parent | e2d1d832efe0623539c9d37ca8aee17d44e47067 (diff) | |
download | go-tangerine-4dc7ee90879d7146c9e5004c04992c90ad78f632.tar.gz go-tangerine-4dc7ee90879d7146c9e5004c04992c90ad78f632.tar.zst go-tangerine-4dc7ee90879d7146c9e5004c04992c90ad78f632.zip |
Closure => Context
Diffstat (limited to 'core')
-rw-r--r-- | core/chain_manager.go | 20 | ||||
-rw-r--r-- | core/execution.go | 6 | ||||
-rw-r--r-- | core/state_transition.go | 2 | ||||
-rw-r--r-- | core/vm_env.go | 6 |
4 files changed, 7 insertions, 27 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index d623c170b..ece98d783 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -20,26 +20,6 @@ type StateQuery interface { GetAccount(addr []byte) *state.StateObject } -/* -func AddTestNetFunds(block *types.Block) { - for _, addr := range []string{ - "51ba59315b3a95761d0863b05ccc7a7f54703d99", - "e4157b34ea9615cfbde6b4fda419828124b70c78", - "b9c015918bdaba24b4ff057a92a3873d6eb201be", - "6c386a4b26f73c802f34673f7248bb118f97424a", - "cd2a3d9f938e13cd947ec05abc7fe734df8dd826", - "2ef47100e0787b915105fd5e3f4ff6752079d5cb", - "e6716f9544a56c530d868e4bfbacb172315bdead", - "1a26338f0d905e295fccb71fa9ea849ffa12aaf4", - } { - codedAddr := ethutil.Hex2Bytes(addr) - account := block.State().GetAccount(codedAddr) - account.SetBalance(ethutil.Big("1606938044258990275541962092341162602522202993782792835301376")) //ethutil.BigPow(2, 200) - block.State().UpdateStateObject(account) - } -} -*/ - func CalcDifficulty(block, parent *types.Block) *big.Int { diff := new(big.Int) diff --git a/core/execution.go b/core/execution.go index b7eead0dd..a7bb59651 100644 --- a/core/execution.go +++ b/core/execution.go @@ -24,14 +24,14 @@ func (self *Execution) Addr() []byte { return self.address } -func (self *Execution) Call(codeAddr []byte, caller vm.ClosureRef) ([]byte, error) { +func (self *Execution) Call(codeAddr []byte, caller vm.ContextRef) ([]byte, error) { // Retrieve the executing code code := self.env.State().GetCode(codeAddr) return self.exec(code, codeAddr, caller) } -func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret []byte, err error) { +func (self *Execution) exec(code, contextAddr []byte, caller vm.ContextRef) (ret []byte, err error) { env := self.env evm := vm.New(env, vm.DebugVmTy) @@ -63,7 +63,7 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret return } -func (self *Execution) Create(caller vm.ClosureRef) (ret []byte, err error, account *state.StateObject) { +func (self *Execution) Create(caller vm.ContextRef) (ret []byte, err error, account *state.StateObject) { ret, err = self.exec(self.input, nil, caller) account = self.env.State().GetStateObject(self.address) diff --git a/core/state_transition.go b/core/state_transition.go index 7b7026c29..91cfd5fe3 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -184,7 +184,7 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) { } vmenv := self.VmEnv() - var ref vm.ClosureRef + var ref vm.ContextRef if MessageCreatesContract(msg) { contract := MakeContract(msg, self.state) ret, err, ref = vmenv.Create(sender, contract.Address(), self.msg.Data(), self.gas, self.gasPrice, self.value) diff --git a/core/vm_env.go b/core/vm_env.go index 209115eab..4e0315ff3 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -46,16 +46,16 @@ func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *Execution return NewExecution(self, addr, data, gas, price, value) } -func (self *VMEnv) Call(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { +func (self *VMEnv) Call(me vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { exe := self.vm(addr, data, gas, price, value) return exe.Call(addr, me) } -func (self *VMEnv) CallCode(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { +func (self *VMEnv) CallCode(me vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { exe := self.vm(me.Address(), data, gas, price, value) return exe.Call(addr, me) } -func (self *VMEnv) Create(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ClosureRef) { +func (self *VMEnv) Create(me vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) { exe := self.vm(addr, data, gas, price, value) return exe.Create(me) } |