Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dot/sync): cleanup logs; don't log case where we fail to get parent while processing #2188

Merged
merged 3 commits into from
Jan 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions dot/sync/chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ func (s *chainProcessor) processReadyBlocks() {
}

if err := s.processBlockData(bd); err != nil {
logger.Errorf("block data processing for block with hash %s failed: %s", bd.Hash, err)

// depending on the error, we might want to save this block for later
if errors.Is(err, errFailedToGetParent) {
if err := s.pendingBlocks.addBlock(&types.Block{
Header: *bd.Header,
Body: *bd.Body,
}); err != nil {
logger.Debugf("failed to re-add block to pending blocks: %s", err)
}
if !errors.Is(err, errFailedToGetParent) {
logger.Errorf("block data processing for block with hash %s failed: %s", bd.Hash, err)
continue
}

logger.Tracef("block data processing for block with hash %s failed: %s", bd.Hash, err)
if err := s.pendingBlocks.addBlock(&types.Block{
Header: *bd.Header,
Body: *bd.Body,
}); err != nil {
logger.Debugf("failed to re-add block to pending blocks: %s", err)
}
}
}
Expand Down Expand Up @@ -167,7 +169,7 @@ func (s *chainProcessor) processBlockData(bd *types.BlockData) error {
}

if err := s.handleBlock(block); err != nil {
logger.Errorf("failed to handle block number %s: %s", block.Header.Number, err)
logger.Debugf("failed to handle block number %s: %s", block.Header.Number, err)
return err
}

Expand Down