diff --git a/benchmark.go b/benchmark.go index 51a186e62..26d7f900a 100644 --- a/benchmark.go +++ b/benchmark.go @@ -228,6 +228,7 @@ func main() { go currentNode.SupportSyncing() if consensus.IsLeader { go currentNode.SupportClient() + go currentNode.SupportExplorer() } currentNode.StartServer() } diff --git a/node/node.go b/node/node.go index 9c13b7992..fe31e8bc6 100644 --- a/node/node.go +++ b/node/node.go @@ -15,6 +15,8 @@ import ( "sync/atomic" "time" + "github.com/harmony-one/harmony/services/explorer" + "github.com/harmony-one/harmony/client" clientService "github.com/harmony-one/harmony/client/service" @@ -494,6 +496,16 @@ func (node *Node) SupportClient() { node.StartClientServer() } +// SupportExplorer initializes and starts the client service +func (node *Node) SupportExplorer() { + es := explorer.Service{ + IP: node.SelfPeer.IP, + Port: node.SelfPeer.Port, + } + es.Init(true) + es.Run() +} + // InitClientServer initializes client server. func (node *Node) InitClientServer() { node.clientServer = clientService.NewServer(node.Chain.State, node.CallFaucetContract) diff --git a/services/explorer/service.go b/services/explorer/service.go index 67a5c6906..bcf57dea1 100644 --- a/services/explorer/service.go +++ b/services/explorer/service.go @@ -17,7 +17,7 @@ import ( // Constants for explorer service. const ( - ExplorerServicePort = "5000" + ExplorerServicePort = "10000" ) // Service is the struct for explorer service. @@ -29,8 +29,8 @@ type Service struct { } // Init is to do init for ExplorerService. -func (s *Service) Init() { - s.storage = GetStorageInstance(s.IP, s.Port, false) +func (s *Service) Init(remove bool) { + s.storage = GetStorageInstance(s.IP, s.Port, remove) } // Run is to run serving explorer. diff --git a/services/explorer/test2/main.go b/services/explorer/test2/main.go index 52982e8fd..28848617c 100644 --- a/services/explorer/test2/main.go +++ b/services/explorer/test2/main.go @@ -7,6 +7,6 @@ func main() { IP: "127.0.0.1", Port: "9000", } - service.Init() + service.Init(false) service.Run() }