Skip to content

Commit

Permalink
sync service: fix merge (ethereum#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes authored Dec 7, 2020
1 parent 9a34e16 commit d24b127
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rollup/sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,9 @@ func (s *SyncService) ProcessSequencerBatchAppendedLog(ctx context.Context, ethl
}

log.Debug("Decoded chain elements", "count", len(cd.ChainElements))
// Keep track of the number of enqueued elements so that the queue index
// can be calculated in the case of `element.IsSequenced` is false.
enqueuedCount := uint64(0)
for i, element := range cd.ChainElements {
var tx *types.Transaction
index := (event.TotalElements.Uint64() - uint64(len(cd.ChainElements))) + uint64(i)
Expand Down Expand Up @@ -1077,9 +1080,11 @@ func (s *SyncService) ProcessSequencerBatchAppendedLog(ctx context.Context, ethl
}
} else {
// Queue transaction
rtx, ok := s.txCache.Load(index)
queueIndex := event.StartingQueueIndex.Uint64() + enqueuedCount
enqueuedCount++
rtx, ok := s.txCache.Load(queueIndex)
if !ok {
log.Error("Cannot find transaction in transaction cache", "index", index)
log.Error("Cannot find transaction in transaction cache", "queue-index", queueIndex)
continue
}
tx = rtx.tx
Expand Down

0 comments on commit d24b127

Please sign in to comment.