blockchain v0: start/stop real reactor (when v0)

This commit is contained in:
Aleksandr Bezobchuk
2021-01-11 11:54:04 -05:00
parent 2e49deba49
commit 96bc96aa40
2 changed files with 28 additions and 0 deletions

View File

@@ -956,6 +956,13 @@ func (n *Node) OnStart() error {
n.isListening = true
if n.config.FastSync.Version == "v0" {
// Start the real blockchain reactor separately since the switch uses the shim.
if err := n.bcReactor.Start(); err != nil {
return err
}
}
// Start the real state sync reactor separately since the switch uses the shim.
if err := n.stateSyncReactor.Start(); err != nil {
return err
@@ -1007,6 +1014,13 @@ func (n *Node) OnStop() {
n.Logger.Error("Error closing switch", "err", err)
}
if n.config.FastSync.Version == "v0" {
// Stop the real blockchain reactor separately since the switch uses the shim.
if err := n.bcReactor.Stop(); err != nil {
n.Logger.Error("failed to stop the blockchain reactor", "err", err)
}
}
// Stop the real state sync reactor separately since the switch uses the shim.
if err := n.stateSyncReactor.Stop(); err != nil {
n.Logger.Error("failed to stop the state sync reactor", "err", err)

View File

@@ -988,6 +988,13 @@ func (n *Node) OnStart() error {
n.isListening = true
if n.config.FastSync.Version == "v0" {
// Start the real blockchain reactor separately since the switch uses the shim.
if err := n.bcReactor.Start(); err != nil {
return err
}
}
// Start the real state sync reactor separately since the switch uses the shim.
if err := n.stateSyncReactor.Start(); err != nil {
return err
@@ -1039,6 +1046,13 @@ func (n *Node) OnStop() {
n.Logger.Error("Error closing switch", "err", err)
}
if n.config.FastSync.Version == "v0" {
// Stop the real blockchain reactor separately since the switch uses the shim.
if err := n.bcReactor.Stop(); err != nil {
n.Logger.Error("failed to stop the blockchain reactor", "err", err)
}
}
// Stop the real state sync reactor separately since the switch uses the shim.
if err := n.stateSyncReactor.Stop(); err != nil {
n.Logger.Error("failed to stop the state sync reactor", "err", err)