cli: reload state root service on USR1

It's a bit special since it's _always_ present to catch stateroots from the
network.
This commit is contained in:
Roman Khimov 2022-07-26 22:27:36 +03:00
parent 9341bb6628
commit bf92966633
2 changed files with 12 additions and 0 deletions

View file

@ -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():

View file

@ -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
}