diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/cmd.go | 17 | ||||
-rw-r--r-- | utils/vm_env.go | 5 |
2 files changed, 15 insertions, 7 deletions
diff --git a/utils/cmd.go b/utils/cmd.go index 700542cae..32aebc91e 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -19,9 +19,9 @@ import ( "github.com/ethereum/eth-go/ethlog" "github.com/ethereum/eth-go/ethminer" "github.com/ethereum/eth-go/ethpipe" - "github.com/ethereum/eth-go/ethrpc" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethwire" + "github.com/ethereum/eth-go/rpc" ) var logger = ethlog.NewLogger("CLI") @@ -118,9 +118,12 @@ func InitLogging(Datadir string, LogFile string, LogLevel int, DebugFile string) return sys } -func InitConfig(ConfigFile string, Datadir string, EnvPrefix string) *ethutil.ConfigManager { +func InitConfig(vmType int, ConfigFile string, Datadir string, EnvPrefix string) *ethutil.ConfigManager { InitDataDir(Datadir) - return ethutil.ReadConfig(ConfigFile, Datadir, EnvPrefix) + cfg := ethutil.ReadConfig(ConfigFile, Datadir, EnvPrefix) + cfg.VmType = vmType + + return cfg } func exit(err error) { @@ -166,7 +169,7 @@ func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) { } func ShowGenesis(ethereum *eth.Ethereum) { - logger.Infoln(ethereum.BlockChain().Genesis()) + logger.Infoln(ethereum.ChainManager().Genesis()) exit(nil) } @@ -241,7 +244,7 @@ func KeyTasks(keyManager *ethcrypto.KeyManager, KeyRing string, GenAddr bool, Se func StartRpc(ethereum *eth.Ethereum, RpcPort int) { var err error - ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpipe.NewJSPipe(ethereum), RpcPort) + ethereum.RpcServer, err = rpc.NewJsonRpcServer(ethpipe.NewJSPipe(ethereum), RpcPort) if err != nil { logger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) } else { @@ -307,12 +310,12 @@ func StopMining(ethereum *eth.Ethereum) bool { // Replay block func BlockDo(ethereum *eth.Ethereum, hash []byte) error { - block := ethereum.BlockChain().GetBlock(hash) + block := ethereum.ChainManager().GetBlock(hash) if block == nil { return fmt.Errorf("unknown block %x", hash) } - parent := ethereum.BlockChain().GetBlock(block.PrevHash) + parent := ethereum.ChainManager().GetBlock(block.PrevHash) _, err := ethereum.StateManager().ApplyDiff(parent.State(), parent, block) if err != nil { diff --git a/utils/vm_env.go b/utils/vm_env.go index 30568c421..21341ab04 100644 --- a/utils/vm_env.go +++ b/utils/vm_env.go @@ -5,6 +5,7 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethstate" + "github.com/ethereum/eth-go/vm" ) type VMEnv struct { @@ -33,3 +34,7 @@ func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty } func (self *VMEnv) BlockHash() []byte { return self.block.Hash() } func (self *VMEnv) Value() *big.Int { return self.value } func (self *VMEnv) State() *ethstate.State { return self.state } +func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit } +func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { + return vm.Transfer(from, to, amount) +} |