mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
cmd/geth/main, les/fletcher: added in light mode support
This commit is contained in:
parent
1492a0d9f4
commit
3ba6900b81
2 changed files with 13 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
"github.com/ethereum/go-ethereum/console"
|
"github.com/ethereum/go-ethereum/console"
|
||||||
"github.com/ethereum/go-ethereum/eth"
|
"github.com/ethereum/go-ethereum/eth"
|
||||||
|
"github.com/ethereum/go-ethereum/les"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
"github.com/ethereum/go-ethereum/internal/debug"
|
"github.com/ethereum/go-ethereum/internal/debug"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
|
@ -322,7 +323,18 @@ 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() {
|
||||||
//TODO addd in light mode support
|
//TODO addd in light mode support
|
||||||
|
log.Info("🔗 block Synced 🔗 ")
|
||||||
|
|
||||||
if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
|
if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
|
||||||
|
var lightEthereum *les.LightEthereum
|
||||||
|
if err := stack.Service(&lightEthereum); err != nil {
|
||||||
|
utils.Fatalf("LightEthereum service not running: %v", err)
|
||||||
|
}
|
||||||
|
<-lightEthereum.Downloader().SyncedCh
|
||||||
|
log.Info("Synchronisation completed, exitting", "countdown", exitWhenSynced)
|
||||||
|
time.Sleep(exitWhenSynced)
|
||||||
|
stack.Stop()
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var ethereum *eth.Ethereum
|
var ethereum *eth.Ethereum
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,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
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue