From 8676aeb798f575024e173ca5c677aaee32e77725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 27 Feb 2017 13:22:33 +0200 Subject: eth/downloader: review fixes --- eth/downloader/downloader.go | 2 +- eth/downloader/modes.go | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'eth/downloader') diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 8ce86eacd..92e42f0b3 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -383,7 +383,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e 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) { log.Debug("Synchronisation terminated", "elapsed", time.Since(start)) }(time.Now()) diff --git a/eth/downloader/modes.go b/eth/downloader/modes.go index c2ce0cfef..ae3c43888 100644 --- a/eth/downloader/modes.go +++ b/eth/downloader/modes.go @@ -25,10 +25,16 @@ const ( LightSync // Download only the headers and terminate afterwards ) -// syncModeLabels contains a mapping of sync modes to textual label used by the -// logging system. -var syncModeLabels = map[SyncMode]string{ - FullSync: "full", - FastSync: "fast", - LightSync: "light", +// String implements the stringer interface. +func (mode SyncMode) String() string { + switch mode { + case FullSync: + return "full" + case FastSync: + return "fast" + case LightSync: + return "light" + default: + return "unknown" + } } -- cgit v1.2.3