diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ethereum/main.go | 4 | ||||
-rw-r--r-- | cmd/evm/main.go | 1 | ||||
-rw-r--r-- | cmd/utils/cmd.go | 39 |
3 files changed, 4 insertions, 40 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index f79f948d1..9d78b6282 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -114,6 +114,10 @@ func main() { return } + if StartMining { + ethereum.Miner().Start() + } + if len(ImportChain) > 0 { start := time.Now() err := utils.ImportChain(ethereum, ImportChain) diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 432cbd001..d6a93460e 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -65,7 +65,6 @@ func main() { statedb := state.New(nil, db) sender := statedb.NewStateObject([]byte("sender")) receiver := statedb.NewStateObject([]byte("receiver")) - //receiver.SetCode([]byte(*code)) receiver.SetCode(ethutil.Hex2Bytes(*code)) vmenv := NewEnv(statedb, []byte("evmuser"), ethutil.Big(*value)) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 5c7ec3221..794753f11 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -32,7 +32,6 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/rlp" rpchttp "github.com/ethereum/go-ethereum/rpc/http" rpcws "github.com/ethereum/go-ethereum/rpc/ws" @@ -182,32 +181,6 @@ func StartWebSockets(eth *eth.Ethereum, wsPort int) { } } -var gminer *miner.Miner - -func GetMiner() *miner.Miner { - return gminer -} - -func StartMining(ethereum *eth.Ethereum) bool { - if !ethereum.Mining { - ethereum.Mining = true - addr := ethereum.KeyManager().Address() - - go func() { - clilogger.Infoln("Start mining") - if gminer == nil { - gminer = miner.New(addr, ethereum, 4) - } - gminer.Start() - }() - RegisterInterrupt(func(os.Signal) { - StopMining(ethereum) - }) - return true - } - return false -} - func FormatTransactionData(data string) []byte { d := ethutil.StringToByteFunc(data, func(s string) (ret []byte) { slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000) @@ -221,18 +194,6 @@ func FormatTransactionData(data string) []byte { return d } -func StopMining(ethereum *eth.Ethereum) bool { - if ethereum.Mining && gminer != nil { - gminer.Stop() - clilogger.Infoln("Stopped mining") - ethereum.Mining = false - - return true - } - - return false -} - // Replay block func BlockDo(ethereum *eth.Ethereum, hash []byte) error { block := ethereum.ChainManager().GetBlock(hash) |