diff --git a/eth/downloader/beaconsync.go b/eth/downloader/beaconsync.go index 405643e576..1a3f109e0d 100644 --- a/eth/downloader/beaconsync.go +++ b/eth/downloader/beaconsync.go @@ -114,7 +114,9 @@ func (b *beaconBackfiller) resume() { if b.success != nil { b.success() } + log.Debug("Backfilling completed") }() + log.Debug("Backfilling started") } // SetBadBlockCallback sets the callback to run when a bad block is hit by the diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 65c10099cf..e16014be95 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -367,7 +367,7 @@ func (d *Downloader) synchronise(beaconPing chan struct{}) (err error) { } // Obtain the synchronized used in this cycle - mode := d.moder.get() + mode := d.moder.get(true) defer func() { if err == nil && mode == ethconfig.SnapSync { d.moder.disableSnap() @@ -424,7 +424,7 @@ func (d *Downloader) getMode() SyncMode { // ConfigSyncMode returns the sync mode configured for the node. // The actual running sync mode can differ from this. func (d *Downloader) ConfigSyncMode() SyncMode { - return d.moder.get() + return d.moder.get(false) } // syncToHead starts a block synchronization based on the hash chain from diff --git a/eth/downloader/skeleton.go b/eth/downloader/skeleton.go index 69e2b8522b..e504a73e0a 100644 --- a/eth/downloader/skeleton.go +++ b/eth/downloader/skeleton.go @@ -510,6 +510,7 @@ func (s *skeleton) sync(head *types.Header) (*types.Header, error) { // The skeleton chain is no longer linked to the local chain for some reason // (e.g. debug_setHead was used to trim the local chain). Re-schedule the // skeleton sync to fill the chain gap. + log.Warn("Local chain has been trimmed", "tailnumber", s.scratchHead, "tailhash", s.progress.Subchains[0].Next) return nil, errSyncTrimmed } } diff --git a/eth/downloader/syncmode.go b/eth/downloader/syncmode.go index 7983d39e3a..036119ce3d 100644 --- a/eth/downloader/syncmode.go +++ b/eth/downloader/syncmode.go @@ -75,7 +75,7 @@ func newSyncModer(mode ethconfig.SyncMode, chain BlockChain, disk ethdb.KeyValue // get retrieves the current sync mode, either explicitly set, or derived // from the chain status. -func (m *syncModer) get() ethconfig.SyncMode { +func (m *syncModer) get(report bool) ethconfig.SyncMode { m.lock.Lock() defer m.lock.Unlock() @@ -83,12 +83,16 @@ func (m *syncModer) get() ethconfig.SyncMode { if m.mode == ethconfig.SnapSync { return ethconfig.SnapSync } + logger := log.Debug + if report { + logger = log.Info + } // We are probably in full sync, but we might have rewound to before the // snap sync pivot, check if we should re-enable snap sync. head := m.chain.CurrentBlock() if pivot := rawdb.ReadLastPivotNumber(m.disk); pivot != nil { if head.Number.Uint64() < *pivot { - log.Info("Reenabled snap-sync as chain is lagging behind the pivot", "head", head.Number, "pivot", pivot) + logger("Reenabled snap-sync as chain is lagging behind the pivot", "head", head.Number, "pivot", pivot) return ethconfig.SnapSync } } @@ -96,7 +100,7 @@ func (m *syncModer) get() ethconfig.SyncMode { // the head state, forcefully rerun the snap sync. Note it doesn't mean the // persistent state is corrupted, just mismatch with the head block. if !m.chain.HasState(head.Root) { - log.Info("Reenabled snap-sync as chain is stateless") + logger("Reenabled snap-sync as chain is stateless") return ethconfig.SnapSync } // Nope, we're really full syncing