From 6d1305bdd934cbacbd34e95b720225f2f58cbbc3 Mon Sep 17 00:00:00 2001 From: Lucas Hendren Date: Mon, 3 Sep 2018 13:03:10 -0400 Subject: [PATCH] cmd, eth, les: 16400 Fixed formatting issues --- cmd/geth/main.go | 4 ++-- eth/downloader/downloader.go | 6 +++--- les/fetcher.go | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index a9354b498b..9e27fc2f39 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -340,7 +340,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { if err := stack.Service(&lightEthereum); err != nil { utils.Fatalf("LightEthereum service not running: %v", err) } - <-lightEthereum.Downloader().SyncedCh + <-lightEthereum.Downloader().syncedCh log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced) time.Sleep(exitWhenSynced) stack.Stop() @@ -351,7 +351,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { if err := stack.Service(ðereum); err != nil { utils.Fatalf("Ethereum service not running: %v", err) } - <-ethereum.Downloader().SyncedCh + <-ethereum.Downloader().syncedCh log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced) time.Sleep(exitWhenSynced) stack.Stop() diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 17dbc9dbc2..f01d8f911c 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -128,7 +128,7 @@ type Downloader struct { bodyWakeCh chan bool // [eth/62] Channel to signal the block body fetcher of new tasks receiptWakeCh chan bool // [eth/63] Channel to signal the receipt fetcher of new tasks headerProcCh chan []*types.Header // [eth/62] Channel to feed the header processor new tasks - SyncedCh chan bool + syncedCh chan bool // for stateFetcher stateSyncStart chan *stateSync @@ -227,7 +227,7 @@ func New(mode SyncMode, stateDb ethdb.Database, mux *event.TypeMux, chain BlockC syncStatsState: stateSyncStats{ processed: rawdb.ReadFastTrieProgress(stateDb), }, - SyncedCh: make(chan bool, 1), + syncedCh: make(chan bool, 1), trackStateReq: make(chan *stateReq), } go dl.qosTuner() @@ -320,7 +320,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode switch err { case nil: select { - case d.SyncedCh <- true: + case d.syncedCh <- true: default: } case errBusy: diff --git a/les/fetcher.go b/les/fetcher.go index 280247300c..f659f723cc 100644 --- a/les/fetcher.go +++ b/les/fetcher.go @@ -50,7 +50,8 @@ type lightFetcher struct { lastUpdateStats *updateStatsEntry syncing bool syncDone chan *peer - SyncedCh chan bool + syncedCh chan bool + reqMu sync.RWMutex // reqMu protects access to sent header fetch requests requested map[uint64]fetchRequest deliverChn chan fetchResponse @@ -116,7 +117,7 @@ func newLightFetcher(pm *ProtocolManager) *lightFetcher { timeoutChn: make(chan uint64), requestChn: make(chan bool, 100), syncDone: make(chan *peer), - SyncedCh: make(chan bool, 1), + syncedCh: make(chan bool, 1), maxConfirmedTd: big.NewInt(0), } pm.peers.notify(f) @@ -447,7 +448,7 @@ func (f *lightFetcher) nextRequest() (*distReq, uint64) { p.Log().Debug("Synchronisation started") f.pm.synchronise(p) f.syncDone <- p - f.SyncedCh <- true + f.syncedCh <- true }() return nil },