Skip to content

Commit

Permalink
fix: removed LastBlockNumberRequested because is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Feb 5, 2025
1 parent a32c43c commit dd21c75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
16 changes: 0 additions & 16 deletions bridgesync/bridgesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,6 @@ func (s *BridgeSync) GetLastProcessedBlock(ctx context.Context) (uint64, error)
return s.processor.GetLastProcessedBlock(ctx)
}

func (s *BridgeSync) GetLastRequestedBlock(ctx context.Context) (uint64, error) {
if s.processor.isHalted() {
return 0, sync.ErrInconsistentState
}
storageLastBlock, err := s.processor.GetLastProcessedBlock(ctx)
if err != nil {
return 0, err
}
downloaderLastBlock := s.downloader.LastBlockNumberRequested()
log.Infof("storage: %d downloader: %d", storageLastBlock, downloaderLastBlock)
if downloaderLastBlock > storageLastBlock {
return downloaderLastBlock, nil
}
return storageLastBlock, nil
}

func (s *BridgeSync) GetBridgeRootByHash(ctx context.Context, root common.Hash) (*tree.Root, error) {
if s.processor.isHalted() {
return nil, sync.ErrInconsistentState
Expand Down
11 changes: 4 additions & 7 deletions sync/evmdownloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ func (d *EVMDownloader) setStopDownloaderOnIterationN(iteration int) {
d.stopDownloaderOnIterationN = iteration
}

// LastBlockNumberRequested returns the last block number requested by the downloader
// maybe doesnt have data and are in unsafe zone, so no block have emitted
func (d *EVMDownloader) LastBlockNumberRequested() uint64 {
return d.lastBlockNumberRequested
}

func (d *EVMDownloader) Download(ctx context.Context, fromBlock uint64, downloadedCh chan EVMBlock) {
lastBlock := d.WaitForNewBlocks(ctx, 0)
toBlock := fromBlock + d.syncBlockChunkSize
Expand Down Expand Up @@ -371,8 +365,11 @@ func (d *EVMDownloaderImplementation) GetLogs(ctx context.Context, fromBlock, to
}
logs := make([]types.Log, 0, len(unfilteredLogs))
for _, l := range unfilteredLogs {
if l.Removed {
d.log.Warnf("log removed: %+v", l)
}
for _, topic := range d.topicsToQuery {
if l.Topics[0] == topic {
if l.Topics[0] == topic && !l.Removed {
logs = append(logs, l)
break
}
Expand Down

0 comments on commit dd21c75

Please sign in to comment.