From 94f57efa67b40a6ddac72d805c4dfb6c0899b214 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 26 Sep 2024 12:31:38 +0530 Subject: [PATCH] add docs link to error message --- app/app.go | 4 ++++ pkg/constant/constant.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index be5657095a..a2a69b0b34 100644 --- a/app/app.go +++ b/app/app.go @@ -877,6 +877,10 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo // InitChainer application update at chain initialization func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { + // The defer is used to catch panics during InitChain + //and display a more meaningful message for people trying to sync a node from block 1 using the latest binary. + // We exit the process after displaying the message as we do not need to start a node with empty state. + defer func() { if r := recover(); r != nil { ctx.Logger().Error("panic occurred during InitGenesis", "error", r) diff --git a/pkg/constant/constant.go b/pkg/constant/constant.go index d5a5f1ca79..0a8207ecda 100644 --- a/pkg/constant/constant.go +++ b/pkg/constant/constant.go @@ -42,5 +42,8 @@ const ( OptionUnpause = "unpause" // InitChainErrorMessage is the error message displayed when trying to sync testnet or mainnet from block 1 - InitChainErrorMessage = "You cannot sync testnet or mainnet from block 1 using the latest version. You should sync your node from a snapshot" + InitChainErrorMessage = "You cannot sync testnet or mainnet from block 1 using the latest version. " + + "You should sync your node from a snapshot. " + + "Refer to the documentation for more information: " + + "https://www.zetachain.com/docs/nodes/start-here/syncing/" )