eth/downloader: review fixes

上级 46eea4d1
...@@ -383,7 +383,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e ...@@ -383,7 +383,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e
return errTooOld return errTooOld
} }
log.Debug("Synchronising with the network", "peer", p.id, "eth", p.version, "head", hash.Hex()[2:10], "td", td, "mode", syncModeLabels[d.mode]) log.Debug("Synchronising with the network", "peer", p.id, "eth", p.version, "head", hash.Hex()[2:10], "td", td, "mode", d.mode)
defer func(start time.Time) { defer func(start time.Time) {
log.Debug("Synchronisation terminated", "elapsed", time.Since(start)) log.Debug("Synchronisation terminated", "elapsed", time.Since(start))
}(time.Now()) }(time.Now())
......
...@@ -25,10 +25,16 @@ const ( ...@@ -25,10 +25,16 @@ const (
LightSync // Download only the headers and terminate afterwards LightSync // Download only the headers and terminate afterwards
) )
// syncModeLabels contains a mapping of sync modes to textual label used by the // String implements the stringer interface.
// logging system. func (mode SyncMode) String() string {
var syncModeLabels = map[SyncMode]string{ switch mode {
FullSync: "full", case FullSync:
FastSync: "fast", return "full"
LightSync: "light", case FastSync:
return "fast"
case LightSync:
return "light"
default:
return "unknown"
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册