Skip to content

Commit

Permalink
Move logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vcastellm committed Apr 10, 2024
1 parent 60e80a4 commit 99dcd67
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,7 @@ func newState(ctx context.Context, c *config.Config, etherman *etherman.Client,
if err != nil {
log.Fatal("error getting forkIDs. Error: ", err)
}

log.Info("Adding forkID to db and memory")
for _, forkID := range forkIDIntervals {
err = st.AddForkIDInterval(ctx, forkID, nil)
if err != nil {
log.Fatal("error adding forkID to db. Error: ", err)
}
}
st.UpdateForkIDIntervalsInMemory(forkIDIntervals)

currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId
log.Infof("Fork ID read from POE SC = %v", currentForkID)
Expand Down Expand Up @@ -788,6 +781,14 @@ func forkIDIntervals(ctx context.Context, st *state.State, etherman *etherman.Cl
forkIDIntervals = forkIntervals

log.Debugf("Retrieved %d forkIDs", len(forkIDIntervals))

log.Debug("Adding forkIDs to db and memory")
for _, forkID := range forkIDIntervals {
err = st.AddForkIDInterval(ctx, forkID, nil)
if err != nil {
log.Fatal("error adding forkID to db. Error: ", err)
}
}
}
}
return forkIDIntervals, nil
Expand Down

0 comments on commit 99dcd67

Please sign in to comment.