cmd, eth, les: Fixed bugs resulting formatting

This commit is contained in:
Lucas Hendren 2018-09-05 23:53:21 -04:00
parent c22c3825c2
commit 87eab8abd1
3 changed files with 9 additions and 12 deletions

View file

@ -84,10 +84,7 @@ var (
utils.TxPoolAccountQueueFlag, utils.TxPoolAccountQueueFlag,
utils.TxPoolGlobalQueueFlag, utils.TxPoolGlobalQueueFlag,
utils.TxPoolLifetimeFlag, utils.TxPoolLifetimeFlag,
utils.FastSyncFlag,
utils.ExitWhenSyncedFlag, utils.ExitWhenSyncedFlag,
utils.LightModeFlag,
utils.SyncModeFlag, utils.SyncModeFlag,
utils.GCModeFlag, utils.GCModeFlag,
utils.LightServFlag, utils.LightServFlag,
@ -335,12 +332,12 @@ func startNode(ctx *cli.Context, stack *node.Node) {
if exitWhenSynced := ctx.GlobalDuration(utils.ExitWhenSyncedFlag.Name); exitWhenSynced >= 0 { if exitWhenSynced := ctx.GlobalDuration(utils.ExitWhenSyncedFlag.Name); exitWhenSynced >= 0 {
go func() { go func() {
if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
var lightEthereum *les.LightEthereum var lightEthereum *les.LightEthereum
if err := stack.Service(&lightEthereum); err != nil { if err := stack.Service(&lightEthereum); err != nil {
utils.Fatalf("LightEthereum service not running: %v", err) utils.Fatalf("LightEthereum service not running: %v", err)
} }
<-lightEthereum.Downloader().syncedCh <-lightEthereum.Downloader().SyncedCh
log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced) log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced)
time.Sleep(exitWhenSynced) time.Sleep(exitWhenSynced)
stack.Stop() stack.Stop()
@ -350,7 +347,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
if err := stack.Service(&ethereum); err != nil { if err := stack.Service(&ethereum); err != nil {
utils.Fatalf("Ethereum service not running: %v", err) utils.Fatalf("Ethereum service not running: %v", err)
} }
<-ethereum.Downloader().syncedCh <-ethereum.Downloader().SyncedCh
log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced) log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced)
time.Sleep(exitWhenSynced) time.Sleep(exitWhenSynced)
stack.Stop() stack.Stop()

View file

@ -128,7 +128,7 @@ type Downloader struct {
bodyWakeCh chan bool // [eth/62] Channel to signal the block body fetcher of new tasks 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 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 headerProcCh chan []*types.Header // [eth/62] Channel to feed the header processor new tasks
syncedCh chan bool SyncedCh chan bool
// for stateFetcher // for stateFetcher
stateSyncStart chan *stateSync stateSyncStart chan *stateSync
@ -227,7 +227,7 @@ func New(mode SyncMode, stateDb ethdb.Database, mux *event.TypeMux, chain BlockC
syncStatsState: stateSyncStats{ syncStatsState: stateSyncStats{
processed: rawdb.ReadFastTrieProgress(stateDb), processed: rawdb.ReadFastTrieProgress(stateDb),
}, },
syncedCh: make(chan bool, 1), SyncedCh: make(chan bool, 1),
trackStateReq: make(chan *stateReq), trackStateReq: make(chan *stateReq),
} }
go dl.qosTuner() go dl.qosTuner()
@ -320,7 +320,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode
switch err { switch err {
case nil: case nil:
select { select {
case d.syncedCh <- true: case d.SyncedCh <- true:
default: default:
} }
case errBusy: case errBusy:

View file

@ -50,7 +50,7 @@ type lightFetcher struct {
lastUpdateStats *updateStatsEntry lastUpdateStats *updateStatsEntry
syncing bool syncing bool
syncDone chan *peer syncDone chan *peer
syncedCh chan bool SyncedCh chan bool
reqMu sync.RWMutex // reqMu protects access to sent header fetch requests reqMu sync.RWMutex // reqMu protects access to sent header fetch requests
requested map[uint64]fetchRequest requested map[uint64]fetchRequest
@ -117,7 +117,7 @@ func newLightFetcher(pm *ProtocolManager) *lightFetcher {
timeoutChn: make(chan uint64), timeoutChn: make(chan uint64),
requestChn: make(chan bool, 100), requestChn: make(chan bool, 100),
syncDone: make(chan *peer), syncDone: make(chan *peer),
syncedCh: make(chan bool, 1), SyncedCh: make(chan bool, 1),
maxConfirmedTd: big.NewInt(0), maxConfirmedTd: big.NewInt(0),
} }
pm.peers.notify(f) pm.peers.notify(f)
@ -448,7 +448,7 @@ func (f *lightFetcher) nextRequest() (*distReq, uint64) {
p.Log().Debug("Synchronisation started") p.Log().Debug("Synchronisation started")
f.pm.synchronise(p) f.pm.synchronise(p)
f.syncDone <- p f.syncDone <- p
f.syncedCh <- true f.SyncedCh <- true
}() }()
return nil return nil
}, },