From d35ee4e0d5ee74135d85bea8c735155b4139ac23 Mon Sep 17 00:00:00 2001 From: ak Date: Thu, 31 Jan 2019 17:55:32 -0800 Subject: [PATCH 1/3] staking service --- api/service/manager.go | 2 ++ api/service/staking/service.go | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 api/service/staking/service.go diff --git a/api/service/manager.go b/api/service/manager.go index 7c07318e7..be74d2faf 100644 --- a/api/service/manager.go +++ b/api/service/manager.go @@ -44,6 +44,8 @@ func (t Type) String() string { return "BlockProposal" case Test: return "Test" + case Staking: + return "Staking" case Done: return "Done" default: diff --git a/api/service/staking/service.go b/api/service/staking/service.go new file mode 100644 index 000000000..c7cae265a --- /dev/null +++ b/api/service/staking/service.go @@ -0,0 +1,25 @@ +package staking + +import ( + "github.com/harmony-benchmark/log" + "github.com/harmony-one/harmony/p2p" +) + +// Service is the struct for staking service. +type Service struct { + Host p2p.Host +} + +//StartService starts the staking service. +func (s *Service) StartService() { + log.Info("Starting staking service.") +} + +func (s *Service) createStakingTransaction() { + //creates staking transaction. +} + +// StopService shutdowns staking service. +func (s *Service) StopService() { + log.Info("Shutting down staking service.") +} From d01b40b646ed257a2d104742f5e636faf3a9ac11 Mon Sep 17 00:00:00 2001 From: ak Date: Fri, 1 Feb 2019 11:48:29 -0800 Subject: [PATCH 2/3] using utils logs --- api/service/staking/service.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/service/staking/service.go b/api/service/staking/service.go index c7cae265a..bd9349f4d 100644 --- a/api/service/staking/service.go +++ b/api/service/staking/service.go @@ -1,7 +1,7 @@ package staking import ( - "github.com/harmony-benchmark/log" + "github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/p2p" ) @@ -12,7 +12,7 @@ type Service struct { //StartService starts the staking service. func (s *Service) StartService() { - log.Info("Starting staking service.") + utils.GetLogInstance().Info("Starting staking service.") } func (s *Service) createStakingTransaction() { @@ -21,5 +21,5 @@ func (s *Service) createStakingTransaction() { // StopService shutdowns staking service. func (s *Service) StopService() { - log.Info("Shutting down staking service.") + utils.GetLogInstance().Info("Shutting down staking service.") } From 56606f77966678d1cc30ebf2aed417b4bdc4f2d6 Mon Sep 17 00:00:00 2001 From: ak Date: Mon, 4 Feb 2019 13:41:37 -0800 Subject: [PATCH 3/3] fixing a missed case --- api/service/manager.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/service/manager.go b/api/service/manager.go index 3bec3a02a..fc5834888 100644 --- a/api/service/manager.go +++ b/api/service/manager.go @@ -27,6 +27,7 @@ const ( Consensus BlockProposal PeerDiscovery + Staking Test Done ) @@ -45,10 +46,10 @@ func (t Type) String() string { return "BlockProposal" case PeerDiscovery: return "PeerDiscovery" - case Test: - return "Test" case Staking: return "Staking" + case Test: + return "Test" case Done: return "Done" default: