diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-04 00:55:23 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-04 00:55:23 +0800 |
commit | 313fe3861b3c338b3b6304adac46c86af7e2d52e (patch) | |
tree | e19ace3d9fd0b8f8fe67e5f0fb934cfd407b5664 /cmd | |
parent | 22b132e28f74cabef38a55874da8e3db93786144 (diff) | |
download | dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.gz dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.bz2 dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.lz dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.xz dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.tar.zst dexon-313fe3861b3c338b3b6304adac46c86af7e2d52e.zip |
fixed pow stuff
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ethereum/main.go | 2 | ||||
-rw-r--r-- | cmd/utils/cmd.go | 39 |
2 files changed, 1 insertions, 40 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index f72b11e14..dc25e4ae0 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -114,7 +114,7 @@ func main() { } if StartMining { - utils.StartMining(ethereum) + ethereum.Miner().Start() } if len(ImportChain) > 0 { diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index a36c10e3b..03ad883d7 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) |