OSDN Git Service

dispatch signature when proccess block (#85)
[bytom/vapor.git] / node / node.go
index d8e03a4..01e901f 100644 (file)
@@ -27,11 +27,8 @@ import (
        "github.com/vapor/env"
        "github.com/vapor/event"
        "github.com/vapor/mining/cpuminer"
-       "github.com/vapor/mining/miningpool"
-       "github.com/vapor/mining/tensority"
        "github.com/vapor/net/websocket"
        "github.com/vapor/netsync"
-       "github.com/vapor/p2p"
        "github.com/vapor/protocol"
        w "github.com/vapor/wallet"
 )
@@ -56,7 +53,6 @@ type Node struct {
        chain           *protocol.Chain
        txfeed          *txfeed.Tracker
        cpuMiner        *cpuminer.CPUMiner
-       miningPool      *miningpool.MiningPool
        miningEnable    bool
 }
 
@@ -82,7 +78,7 @@ func NewNode(config *cfg.Config) *Node {
 
        dispatcher := event.NewDispatcher()
        txPool := protocol.NewTxPool(store, dispatcher)
-       chain, err := protocol.NewChain(store, txPool)
+       chain, err := protocol.NewChain(store, txPool, dispatcher)
        if err != nil {
                cmn.Exit(cmn.Fmt("Failed to create chain structure: %v", err))
        }
@@ -153,14 +149,7 @@ func NewNode(config *cfg.Config) *Node {
        }
 
        node.cpuMiner = cpuminer.NewCPUMiner(chain, accounts, txPool, dispatcher)
-       node.miningPool = miningpool.NewMiningPool(chain, accounts, txPool, dispatcher)
-
        node.BaseService = *cmn.NewBaseService(nil, "Node", node)
-
-       if config.Simd.Enable {
-               tensority.UseSIMD = true
-       }
-
        return node
 }
 
@@ -210,7 +199,7 @@ func launchWebBrowser(port string) {
 }
 
 func (n *Node) initAndstartAPIServer() {
-       n.api = api.NewAPI(n.syncManager, n.wallet, n.txfeed, n.cpuMiner, n.miningPool, n.chain, n.config, n.accessTokens, n.eventDispatcher, n.notificationMgr)
+       n.api = api.NewAPI(n.syncManager, n.wallet, n.txfeed, n.cpuMiner, n.chain, n.config, n.accessTokens, n.eventDispatcher, n.notificationMgr)
 
        listenAddr := env.String("LISTEN", n.config.ApiAddress)
        env.Parse()
@@ -267,11 +256,3 @@ func (n *Node) RunForever() {
                n.Stop()
        })
 }
-
-func (n *Node) NodeInfo() *p2p.NodeInfo {
-       return n.syncManager.NodeInfo()
-}
-
-func (n *Node) MiningPool() *miningpool.MiningPool {
-       return n.miningPool
-}