cmd, eth, les: enable serving light clients when non-synced (#22250)

This PR adds a more CLI flag, so that the les-server can serve light clients even the local node is not synced yet.

This functionality is needed in some testing environments(e.g. hive). After launching the les server, no more blocks will be imported so the node is always marked as "non-synced".
This commit is contained in:
gary rong
2021-02-25 20:55:07 +08:00
committed by GitHub
parent 96d9306413
commit 378e961d85
6 changed files with 21 additions and 1 deletions

View File

@ -269,6 +269,10 @@ var (
Name: "light.nopruning",
Usage: "Disable ancient light chain data pruning",
}
LightNoSyncServeFlag = cli.BoolFlag{
Name: "light.nosyncserve",
Usage: "Enables serving light clients before syncing",
}
// Ethash settings
EthashCacheDirFlag = DirectoryFlag{
Name: "ethash.cachedir",
@ -1042,6 +1046,9 @@ func setLes(ctx *cli.Context, cfg *ethconfig.Config) {
if ctx.GlobalIsSet(LightNoPruneFlag.Name) {
cfg.LightNoPrune = ctx.GlobalBool(LightNoPruneFlag.Name)
}
if ctx.GlobalIsSet(LightNoSyncServeFlag.Name) {
cfg.LightNoSyncServe = ctx.GlobalBool(LightNoSyncServeFlag.Name)
}
}
// MakeDatabaseHandles raises out the number of allowed file handles per process