diff --git a/core/minter/minter.go b/core/minter/minter.go index df6ca1277..d7a5a6b9c 100644 --- a/core/minter/minter.go +++ b/core/minter/minter.go @@ -141,19 +141,18 @@ func (app *Blockchain) InitChain(req abciTypes.RequestInitChain) abciTypes.Respo // Signals the beginning of a block. func (app *Blockchain) BeginBlock(req abciTypes.RequestBeginBlock) abciTypes.ResponseBeginBlock { - // Check invariants - if app.height%1 == 0 { - if err := state.NewForCheckFromDeliver(app.stateCheck).CheckForInvariants(); err != nil { - log.With("module", "invariants").Error("Invariants error", "msg", err.Error(), "height", app.height) - } - } - app.wg.Add(1) if atomic.LoadUint32(&app.stopped) == 1 { panic("Application stopped") } height := uint64(req.Header.Height) + // Check invariants + if height%720 == 0 { + if err := state.NewForCheckFromDeliver(app.stateCheck).CheckForInvariants(); err != nil { + log.With("module", "invariants").Error("Invariants error", "msg", err.Error(), "height", app.height) + } + } // compute max gas app.updateBlocksTimeDelta(height, 3) diff --git a/core/state/statedb.go b/core/state/statedb.go index 25c174773..4bc17f7eb 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1964,6 +1964,9 @@ func (s *StateDB) Import(appState types.AppState) { func (s *StateDB) CheckForInvariants() error { height := s.height + if height <= 1 { + return nil + } genesisFile := utils.GetMinterHome() + "/config/genesis.json" genesis, err := tmTypes.GenesisDocFromFile(genesisFile)