Skip to content
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
12 changes: 11 additions & 1 deletion block/internal/syncing/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ func (s *Syncer) waitForGenesis() bool {
}

func (s *Syncer) PipeEvent(ctx context.Context, event common.DAHeightEvent) error {
// Avoid sending already seen events to channel (would have been skipped in processHeightEvent anyway)
if s.cache.IsHeaderSeen(event.Header.Hash().String()) {
return nil
}

select {
case s.heightInCh <- event:
return nil
Expand All @@ -537,6 +542,7 @@ func (s *Syncer) processHeightEvent(ctx context.Context, event *common.DAHeightE
Uint64("height", height).
Uint64("da_height", event.DaHeight).
Str("hash", headerHash).
Str("source", string(event.Source)).
Msg("processing height event")

currentHeight, err := s.store.Height(ctx)
Expand All @@ -547,7 +553,10 @@ func (s *Syncer) processHeightEvent(ctx context.Context, event *common.DAHeightE

// Skip if already processed
if height <= currentHeight || s.cache.IsHeaderSeen(headerHash) {
s.logger.Debug().Uint64("height", height).Msg("height already processed")
s.logger.Debug().
Uint64("height", height).
Str("source", string(event.Source)).
Msg("height already processed")
return
}

Expand Down Expand Up @@ -656,6 +665,7 @@ func (s *Syncer) processHeightEvent(ctx context.Context, event *common.DAHeightE
s.logger.Error().Err(err).
Uint64("event-height", event.Header.Height()).
Uint64("state-height", s.getLastState().LastBlockHeight).
Str("source", string(event.Source)).
Msg("failed to sync next block")
// If the error is not due to a validation error, re-store the event as pending
switch {
Expand Down
Loading