diff options
author | Maran <maran.hidskes@gmail.com> | 2014-05-14 18:41:30 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2014-05-14 18:41:30 +0800 |
commit | e8147cf7c6f508910698e6743ad347c78010ffe3 (patch) | |
tree | 3783c2631e37291d6cf9ce5d4130f472c7e01cbb /ethereum | |
parent | 0d9c948b9b2c5eef6f0069f9aa05e9868f939444 (diff) | |
download | dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.tar dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.tar.gz dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.tar.bz2 dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.tar.lz dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.tar.xz dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.tar.zst dexon-e8147cf7c6f508910698e6743ad347c78010ffe3.zip |
Refactored mining into utils and exposed it to ethereal. Partly fixes #43
Diffstat (limited to 'ethereum')
-rw-r--r-- | ethereum/ethereum.go | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 055cc0bc4..207e61c88 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -1,11 +1,9 @@ package main import ( - "encoding/hex" "fmt" "github.com/ethereum/eth-go" "github.com/ethereum/eth-go/ethchain" - "github.com/ethereum/eth-go/ethminer" "github.com/ethereum/eth-go/ethpub" "github.com/ethereum/eth-go/ethrpc" "github.com/ethereum/eth-go/ethutil" @@ -127,28 +125,7 @@ func main() { ethereum.Mining = StartMining if StartMining { - logger.Infoln("Miner started") - - // Fake block mining. It broadcasts a new block every 5 seconds - go func() { - - if StartMining { - logger.Infoln("Miner started") - - go func() { - data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) - keyRing := ethutil.NewValueFromBytes(data) - addr := keyRing.Get(0).Bytes() - - pair, _ := ethchain.NewKeyPairFromSec(ethutil.FromHex(hex.EncodeToString(addr))) - - miner := ethminer.NewDefaultMiner(pair.Address(), ethereum) - miner.Start() - - }() - } - }() - + utils.DoMining(ethereum) } if StartConsole { |