wire up new block service

pull/375/head
Minh Doan 6 years ago committed by Minh Doan
parent 3f25de399a
commit b3a9c744be
  1. 4
      cmd/harmony.go
  2. 3
      node/node.go

@ -211,10 +211,6 @@ func main() {
if consensus.IsLeader { if consensus.IsLeader {
currentNode.State = node.NodeLeader currentNode.State = node.NodeLeader
// Node waiting for consensus readiness to create new block
go func() {
currentNode.WaitForConsensusReady(consensus.ReadySignal)
}()
} else { } else {
go currentNode.JoinShard(leader) go currentNode.JoinShard(leader)
} }

@ -27,6 +27,7 @@ import (
service_manager "github.com/harmony-one/harmony/api/service" service_manager "github.com/harmony-one/harmony/api/service"
consensus_service "github.com/harmony-one/harmony/api/service/consensus" consensus_service "github.com/harmony-one/harmony/api/service/consensus"
"github.com/harmony-one/harmony/api/service/explorer" "github.com/harmony-one/harmony/api/service/explorer"
newblock "github.com/harmony-one/harmony/api/service/newblock"
"github.com/harmony-one/harmony/api/service/syncing" "github.com/harmony-one/harmony/api/service/syncing"
"github.com/harmony-one/harmony/api/service/syncing/downloader" "github.com/harmony-one/harmony/api/service/syncing/downloader"
downloader_pb "github.com/harmony-one/harmony/api/service/syncing/downloader/proto" downloader_pb "github.com/harmony-one/harmony/api/service/syncing/downloader/proto"
@ -639,6 +640,8 @@ func (node *Node) setupForShardLeader() {
node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer)) node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer))
// Register consensus service. // Register consensus service.
node.serviceManager.RegisterService(service_manager.Consensus, consensus_service.NewService(node.BlockChannel, node.Consensus)) node.serviceManager.RegisterService(service_manager.Consensus, consensus_service.NewService(node.BlockChannel, node.Consensus))
// Register new block service.
node.serviceManager.RegisterService(service_manager.NewBlock, newblock.NewService(node.Consensus.ReadySignal, node.WaitForConsensusReady))
} }
func (node *Node) setupForShardValidator() { func (node *Node) setupForShardValidator() {

Loading…
Cancel
Save