Skip to content

Commit

Permalink
better logs
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
  • Loading branch information
joshua-kim committed May 6, 2024
1 parent c4237f0 commit d7d2ad3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions vms/proposervm/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,16 @@ func (s *state) pruneProcessingBlocks(db *versiondb.Database) error {
preferredBlkIDs := set.Set[ids.ID]{}
preferredBlk, status, err := s.BlockState.GetBlock(preferredID)
if err != nil {
return fmt.Errorf("failed to get preferred chain tip: %w", err)
return fmt.Errorf("failed to get preferred chain tip %s: %w", preferredID, err)
}

for status == choices.Processing {
preferredBlkIDs.Add(preferredBlk.ID())
preferredBlk, status, err = s.BlockState.GetBlock(preferredBlk.ParentID())

parentID := preferredBlk.ParentID()
preferredBlk, status, err = s.BlockState.GetBlock(parentID)
if err != nil {
return fmt.Errorf("failed to get block in preferred chain: %w", err)
return fmt.Errorf("failed to get block in preferred chain %s: %w", parentID, err)
}
}

Expand All @@ -109,11 +111,11 @@ func (s *state) pruneProcessingBlocks(db *versiondb.Database) error {
}

if err := s.processingBlockIndex.DeleteProcessingBlock(blkID); err != nil {
return fmt.Errorf("failed to delete processing block from index: %w", err)
return fmt.Errorf("failed to delete processing block %s from index: %w", blkID, err)
}

if err := s.BlockState.DeleteBlock(blkID); err != nil {
return fmt.Errorf("failed to delete processing block: %w", err)
return fmt.Errorf("failed to delete processing block %s: %w", blkID, err)
}
}

Expand Down

0 comments on commit d7d2ad3

Please sign in to comment.