diff --git a/cli/server/server.go b/cli/server/server.go index d24f9b4eb..6294044e4 100644 --- a/cli/server/server.go +++ b/cli/server/server.go @@ -588,6 +588,17 @@ Main: if p2pNotary != nil && serv.IsInSync() { p2pNotary.Start() } + srMod.SetUpdateValidatorsCallback(nil) + sr.Shutdown() + sr, err = stateroot.New(cfgnew.ApplicationConfiguration.StateRoot, srMod, log, chain, serv.BroadcastExtensible) + if err != nil { + log.Error("failed to create state validation service", zap.Error(err)) + break // The show must go on. + } + serv.AddExtensibleService(sr, stateroot.Category, sr.OnPayload) + if serv.IsInSync() { + sr.Start() + } } cfg = cfgnew case <-grace.Done(): diff --git a/pkg/services/stateroot/validators.go b/pkg/services/stateroot/validators.go index 536440aaf..5a3ce73a4 100644 --- a/pkg/services/stateroot/validators.go +++ b/pkg/services/stateroot/validators.go @@ -71,6 +71,7 @@ func (s *service) Shutdown() { if !s.started.CAS(true, false) { return } + s.log.Info("stopping state validation service") close(s.stopCh) <-s.done }