eth/downloader: correct sync mode logging to show old mode (#30219)

This PR fixes an issue in the setMode method of beaconBackfiller where the
log message was not displaying the previous mode correctly. The log message
now shows both the old and new sync modes.
This commit is contained in:
Seungmin Kim 2024-08-01 23:10:43 +09:00 committed by GitHub
parent ff6e43e8c4
commit dad8f237ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -123,7 +123,8 @@ func (b *beaconBackfiller) resume() {
func (b *beaconBackfiller) setMode(mode SyncMode) { func (b *beaconBackfiller) setMode(mode SyncMode) {
// Update the old sync mode and track if it was changed // Update the old sync mode and track if it was changed
b.lock.Lock() b.lock.Lock()
updated := b.syncMode != mode oldMode := b.syncMode
updated := oldMode != mode
filling := b.filling filling := b.filling
b.syncMode = mode b.syncMode = mode
b.lock.Unlock() b.lock.Unlock()
@ -133,7 +134,7 @@ func (b *beaconBackfiller) setMode(mode SyncMode) {
if !updated || !filling { if !updated || !filling {
return return
} }
log.Error("Downloader sync mode changed mid-run", "old", mode.String(), "new", mode.String()) log.Error("Downloader sync mode changed mid-run", "old", oldMode.String(), "new", mode.String())
b.suspend() b.suspend()
b.resume() b.resume()
} }