From ad4f91165937d6f5e647cc233e574c4d9e777dbf Mon Sep 17 00:00:00 2001 From: lklimek <842586+lklimek@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:21:47 +0200 Subject: [PATCH] fix(node): genesis.json not loaded on restart before genesis block is mined --- node/node.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/node/node.go b/node/node.go index 2634b5022..7daa8eee4 100644 --- a/node/node.go +++ b/node/node.go @@ -719,7 +719,8 @@ func loadStateFromDBOrGenesisDocProvider(stateStore sm.Store, genDoc *types.Gene return sm.State{}, err } - if state.IsEmpty() { + // If genesis state wasn't mined yet (last block height is 0), we assume that loaded state should be wiped + if state.IsEmpty() || state.LastBlockHeight == 0 { // 2. If it's not there, derive it from the genesis doc state, err = sm.MakeGenesisState(genDoc) if err != nil {