Skip to content

Commit

Permalink
moved locking post data fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin committed Apr 17, 2024
1 parent 69521b3 commit 6433abc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ func (m *Manager) RetriveLoop(ctx context.Context) {
// It fetches the batches from the settlement, gets the DA height and gets
// the actual blocks from the DA.
func (m *Manager) syncUntilTarget(ctx context.Context, syncTarget uint64) error {
m.executeBlockMutex.Lock()
defer m.executeBlockMutex.Unlock()

currentHeight := m.store.Height()
for currentHeight < syncTarget {
Expand Down Expand Up @@ -95,6 +93,9 @@ func (m *Manager) processNextDABatch(ctx context.Context, daMetaData *da.DASubmi

m.logger.Debug("retrieved batches", "n", len(batchResp.Batches), "daHeight", daMetaData.Height)

m.executeBlockMutex.Lock()
defer m.executeBlockMutex.Unlock()

for _, batch := range batchResp.Batches {
for i, block := range batch.Blocks {
if block.Header.Height != m.store.NextHeight() {
Expand Down

0 comments on commit 6433abc

Please sign in to comment.