Skip to content

Commit

Permalink
fix retrieve loop
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt committed May 13, 2024
1 parent e1de9b2 commit 88abca6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions block/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ import (
// fetching batches from the settlement layer and then fetching the actual blocks
// from the DA.
func (m *Manager) RetrieveLoop(ctx context.Context) {
m.logger.Info("started retrieve loop")
targetSyncHeightPoller := diodes.NewPoller(m.targetSyncHeight, diodes.WithPollingContext(ctx))
m.logger.Info("Started retrieve loop.")
p := diodes.NewPoller(m.targetSyncHeight, diodes.WithPollingContext(ctx))

for {
select {
case <-ctx.Done():
return
default:
// Get only the latest sync target
targetHeight := targetSyncHeightPoller.Next()
/*
We only care about the latest one
*/
targetHeight := p.Next()
err := m.syncToTargetHeight(*(*uint64)(targetHeight))
if err != nil {
panic(fmt.Errorf("sync until target: %w", err))
Expand Down

0 comments on commit 88abca6

Please sign in to comment.