Commit 94505146 authored by obscuren's avatar obscuren

updated vm env

parent 843db497
...@@ -4,8 +4,8 @@ import ( ...@@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm" "github.com/ethereum/go-ethereum/vm"
) )
...@@ -45,8 +45,8 @@ type StateTransition struct { ...@@ -45,8 +45,8 @@ type StateTransition struct {
} }
type Message interface { type Message interface {
From() []byte From() common.Address
To() []byte To() common.Address
GasPrice() *big.Int GasPrice() *big.Int
Gas() *big.Int Gas() *big.Int
......
...@@ -3,6 +3,7 @@ package core ...@@ -3,6 +3,7 @@ package core
import ( import (
"math/big" "math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm" "github.com/ethereum/go-ethereum/vm"
...@@ -27,7 +28,7 @@ func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types ...@@ -27,7 +28,7 @@ func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types
} }
} }
func (self *VMEnv) Origin() []byte { return self.msg.From() } func (self *VMEnv) Origin() common.Address { return self.msg.From() }
func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number() } func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number() }
func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase() } func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase() }
func (self *VMEnv) Time() int64 { return self.block.Time() } func (self *VMEnv) Time() int64 { return self.block.Time() }
...@@ -57,16 +58,16 @@ func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *Execution ...@@ -57,16 +58,16 @@ func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *Execution
return NewExecution(self, addr, data, gas, price, value) return NewExecution(self, addr, data, gas, price, value)
} }
func (self *VMEnv) Call(me vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { func (self *VMEnv) Call(me vm.ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error) {
exe := self.vm(addr, data, gas, price, value) exe := self.vm(addr, data, gas, price, value)
return exe.Call(addr, me) return exe.Call(addr, me)
} }
func (self *VMEnv) CallCode(me vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) { func (self *VMEnv) CallCode(me vm.ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error) {
exe := self.vm(me.Address(), data, gas, price, value) exe := self.vm(me.Address(), data, gas, price, value)
return exe.Call(addr, me) return exe.Call(addr, me)
} }
func (self *VMEnv) Create(me vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) { func (self *VMEnv) Create(me vm.ContextRef, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) {
exe := self.vm(addr, data, gas, price, value) exe := self.vm(common.Address{}, data, gas, price, value)
return exe.Create(me) return exe.Create(me)
} }
...@@ -3,14 +3,15 @@ package pow ...@@ -3,14 +3,15 @@ package pow
import ( import (
"math/big" "math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
) )
type Block interface { type Block interface {
Difficulty() *big.Int Difficulty() *big.Int
HashNoNonce() []byte HashNoNonce() common.Hash
Nonce() uint64 Nonce() uint64
MixDigest() []byte MixDigest() common.Hash
NumberU64() uint64 NumberU64() uint64
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment