Skip to content

Commit

Permalink
Remove update submodule log due to too much printing
Browse files Browse the repository at this point in the history
  • Loading branch information
DarianShawn committed Mar 13, 2023
1 parent be0d698 commit 6f11a34
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions consensus/ibft/ibft.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func (i *Ibft) startSyncing() {

// update module cache
if err := i.updateCurrentModules(blockNumber + 1); err != nil {
logger.Error("failed to update sub modules", "height", blockNumber+1, "err", err)
logger.Warn("failed to update sub modules when syncing", "height", blockNumber+1, "err", err)
}

// reset headers of txpool
Expand Down Expand Up @@ -530,8 +530,8 @@ func (i *Ibft) startConsensus() {
)

if err := i.updateCurrentModules(pending); err != nil {
i.logger.Error(
"failed to update submodules",
i.logger.Warn(
"failed to update submodules in consensus",
"height", pending,
"err", err,
)
Expand Down Expand Up @@ -899,15 +899,18 @@ func (i *Ibft) updateCurrentModules(height uint64) error {
return err
}

i.currentValidatorsMux.Lock()
if !i.currentValidatorsMux.TryLock() {
return errFailedToGetUpdateLock
}

defer i.currentValidatorsMux.Unlock()

i.currentValidators = snap.Set

i.logger.Info("update current module",
"height", height,
"validators", i.currentValidators,
)
// i.logger.Debug("update current module",
// "height", height,
// "validators", i.currentValidators,
// )

return nil
}
Expand Down Expand Up @@ -1239,6 +1242,7 @@ var (
errIncorrectBlockHeight = errors.New("proposed block number is incorrect")
errBlockVerificationFailed = errors.New("block verification failed")
errFailedToInsertBlock = errors.New("failed to insert block")
errFailedToGetUpdateLock = errors.New("failed to get update lock")
)

func (i *Ibft) handleStateErr(err error) {
Expand Down

0 comments on commit 6f11a34

Please sign in to comment.