Moved execution from vm to chain.
This moves call and create to the specified environments. Vms are no longer re-used. Vm uses environment's Call(Code) and Create in order to execute new contracts or transfer value between accounts. State transition now uses the same mechanism described above.
This commit is contained in:
@ -21,6 +21,13 @@ type Environment interface {
|
||||
GasLimit() *big.Int
|
||||
Transfer(from, to Account, amount *big.Int) error
|
||||
AddLog(*state.Log)
|
||||
|
||||
Depth() int
|
||||
SetDepth(i int)
|
||||
|
||||
Call(me ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)
|
||||
CallCode(me ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)
|
||||
Create(me ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, ClosureRef)
|
||||
}
|
||||
|
||||
type Object interface {
|
||||
@ -43,9 +50,5 @@ func Transfer(from, to Account, amount *big.Int) error {
|
||||
from.SubBalance(amount)
|
||||
to.AddBalance(amount)
|
||||
|
||||
// Add default LOG. Default = big(sender.addr) + 1
|
||||
//addr := ethutil.BigD(receiver.Address())
|
||||
//tx.addLog(vm.Log{sender.Address(), [][]byte{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes()}, nil})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user