Skip to content

Commit

Permalink
Merge pull request #251 from MinterTeam/dev
Browse files Browse the repository at this point in the history
Update checker interval
  • Loading branch information
danil-lashin authored May 14, 2019
2 parents 1ff6ea8 + 6d59ee7 commit a781c6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/minter/minter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a781c6e

Please sign in to comment.