From 9a7ce08e3ee51f1ad65cf67c327783dac2923c38 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 16 Sep 2021 07:43:23 +0200 Subject: [PATCH] statesync: shut down node when statesync fails (#6944) --- node/node.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/node.go b/node/node.go index 89b6b057e..efa69a724 100644 --- a/node/node.go +++ b/node/node.go @@ -702,7 +702,11 @@ func (n *nodeImpl) OnStart() error { n.Logger.Info("starting state sync") state, err := n.stateSyncReactor.Sync(context.TODO()) if err != nil { - n.Logger.Error("state sync failed", "err", err) + n.Logger.Error("state sync failed; shutting down this node", "err", err) + // stop the node + if err := n.Stop(); err != nil { + n.Logger.Error("failed to shut down node", "err", err) + } return }