Skip to content

Commit

Permalink
Fixed some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alarso16 committed Feb 28, 2025
1 parent 23cd38c commit 2213833
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 4 additions & 6 deletions plugin/evm/statesync/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (d *Downloader) Pivot() *types.Block {

// Opens bufferLock to allow block requests to go through after finalizing the sync
func (d *Downloader) Close() {
d.bufferLock.TryLock()
d.bufferLock.TryLock() // this should be a no-op
d.flushQueue(true)
d.bufferLock.Unlock()
}
Expand Down Expand Up @@ -172,14 +172,12 @@ func (d *Downloader) SnapSync() error {
// If stateSync is ended, clear queue and return
// If err, just return so we can see it
case <-sync.done:
if sync.err != nil {
return sync.err
}
d.bufferLock.Lock() // unlocked by syncer client once we can normally process blocks
return nil
d.bufferLock.Lock() // unlocked in Close()
return sync.err
case newPivot := <-d.newPivot:
// If a new pivot block is found, cancel the current state sync and
// start a new one.
log.Debug("Pivot block updated to", "hash", d.pivotBlock.Root(), d.pivotBlock.NumberU64())
sync.Cancel()
sync = d.syncState(newPivot.Root())
}
Expand Down
3 changes: 2 additions & 1 deletion plugin/evm/syncervm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncS
return block.StateSyncSkipped, err
}

log.Info("Set LastAcceptedBlock as first pivot", "height", evmBlock.ID(), evmBlock.Height(), "timestamp", evmBlock.Timestamp())
log.Info("Set LastAcceptedBlock as first pivot", "id", evmBlock.ID(), "height", evmBlock.Height(), "timestamp", evmBlock.Timestamp())
}
go func() {
defer client.wg.Done()
Expand All @@ -287,6 +287,7 @@ func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncS
client.stateSyncErr = err
} else {
if client.useUpstream {
// finish sync on final pivot, Close() will clear queue as if bootstrapping from static sync
client.stateSyncErr = client.finishSync(client.dl.Pivot().Hash())
} else {
client.stateSyncErr = client.finishSync(client.syncSummary.BlockHash)
Expand Down

0 comments on commit 2213833

Please sign in to comment.