aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/ethereum.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-13 22:37:47 +0800
committerobscuren <geffobscura@gmail.com>2014-05-13 22:37:47 +0800
commit1adfc272a856d466e3d513522ee2fa83853b08ab (patch)
tree1618746391e6302d65401581e9804b7900cfbd45 /ethereum/ethereum.go
parent721d3a9a57fbc7478255d52271531f001375b863 (diff)
parent9caf53f8c63cb30a174d2b33ef85176c8f6f8204 (diff)
downloaddexon-1adfc272a856d466e3d513522ee2fa83853b08ab.tar.gz
dexon-1adfc272a856d466e3d513522ee2fa83853b08ab.tar.zst
dexon-1adfc272a856d466e3d513522ee2fa83853b08ab.zip
Merge branch 'release/poc5-rc4'
Diffstat (limited to 'ethereum/ethereum.go')
-rw-r--r--ethereum/ethereum.go48
1 files changed, 29 insertions, 19 deletions
diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go
index 2f05bf2a1..babebbb48 100644
--- a/ethereum/ethereum.go
+++ b/ethereum/ethereum.go
@@ -1,6 +1,7 @@
package main
import (
+ "encoding/hex"
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
@@ -122,24 +123,8 @@ func main() {
// Set the max peers
ethereum.MaxPeers = MaxPeer
- if StartConsole {
- err := os.Mkdir(ethutil.Config.ExecPath, os.ModePerm)
- // Error is OK if the error is ErrExist
- if err != nil && !os.IsExist(err) {
- log.Panic("Unable to create EXECPATH:", err)
- }
-
- console := NewConsole(ethereum)
- go console.Start()
- }
- if StartRpc {
- ethereum.RpcServer = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum.StateManager(), ethereum.BlockChain(), ethereum.TxPool()))
- go ethereum.RpcServer.Start()
- }
-
- RegisterInterrupts(ethereum)
-
- ethereum.Start(UseSeed)
+ // Set Mining status
+ ethereum.Mining = StartMining
if StartMining {
logger.Infoln("Miner started")
@@ -155,7 +140,9 @@ func main() {
keyRing := ethutil.NewValueFromBytes(data)
addr := keyRing.Get(1).Bytes()
- miner := ethminer.NewDefaultMiner(addr, ethereum)
+ pair, _ := ethchain.NewKeyPairFromSec(ethutil.FromHex(hex.EncodeToString(addr)))
+
+ miner := ethminer.NewDefaultMiner(pair.Address(), ethereum)
miner.Start()
}()
@@ -164,6 +151,29 @@ func main() {
}
+ if StartConsole {
+ err := os.Mkdir(ethutil.Config.ExecPath, os.ModePerm)
+ // Error is OK if the error is ErrExist
+ if err != nil && !os.IsExist(err) {
+ log.Panic("Unable to create EXECPATH:", err)
+ }
+
+ console := NewConsole(ethereum)
+ go console.Start()
+ }
+ if StartRpc {
+ ethereum.RpcServer, err = ethrpc.NewJsonRpcServer(ethpub.NewPEthereum(ethereum), RpcPort)
+ if err != nil {
+ logger.Infoln("Could not start RPC interface:", err)
+ } else {
+ go ethereum.RpcServer.Start()
+ }
+ }
+
+ RegisterInterrupts(ethereum)
+
+ ethereum.Start(UseSeed)
+
// Wait for shutdown
ethereum.WaitForShutdown()
}