config: add block downloader window flag (#2259)

This commit is contained in:
Mark Tyneway 2021-06-30 20:14:10 -07:00 committed by GitHub
parent bfe4d97fae
commit 17adaf5f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -372,8 +372,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
backend.sentryServers = append(backend.sentryServers, server65)
backend.sentries = append(backend.sentries, remote.NewSentryClientDirect(eth.ETH65, server65))
}
blockDownloaderWindow := 65536
backend.downloadServer, err = download.NewControlServer(chainDb.RwKV(), stack.Config().NodeName(), chainConfig, genesis.Hash(), backend.engine, backend.config.NetworkID, backend.sentries, blockDownloaderWindow)
backend.downloadServer, err = download.NewControlServer(chainDb.RwKV(), stack.Config().NodeName(), chainConfig, genesis.Hash(), backend.engine, backend.config.NetworkID, backend.sentries, config.BlockDownloaderWindow)
if err != nil {
return nil, err
}

View File

@ -130,6 +130,8 @@ type Config struct {
SnapshotSeeding bool
SnapshotLayout bool
BlockDownloaderWindow int
// Address to connect to external snapshot downloader
// empty if you want to use internal bittorrent snapshot downloader
ExternalSnapshotDownloaderAddr string

View File

@ -27,6 +27,7 @@ var DefaultFlags = []cli.Flag{
SnapshotDatabaseLayoutFlag,
ExternalSnapshotDownloaderAddrFlag,
BatchSizeFlag,
BlockDownloaderWindowFlag,
DatabaseVerbosityFlag,
PrivateApiAddr,
EtlBufferSizeFlag,

View File

@ -31,6 +31,11 @@ var (
Usage: "Buffer size for ETL operations.",
Value: etl.BufferOptimalSize.String(),
}
BlockDownloaderWindowFlag = cli.IntFlag{
Name: "blockDownloaderWindow",
Usage: "Outstanding limit of block bodies being downloaded",
Value: 65536,
}
PrivateApiAddr = cli.StringFlag{
Name: "private.api.addr",
@ -144,6 +149,7 @@ func ApplyFlagsForEthConfig(ctx *cli.Context, cfg *ethconfig.Config) {
cfg.ExternalSnapshotDownloaderAddr = ctx.GlobalString(ExternalSnapshotDownloaderAddrFlag.Name)
cfg.StateStream = ctx.GlobalBool(StateStreamFlag.Name)
cfg.BlockDownloaderWindow = ctx.GlobalInt(BlockDownloaderWindowFlag.Name)
}
func ApplyFlagsForEthConfigCobra(f *pflag.FlagSet, cfg *ethconfig.Config) {
if v := f.String(StorageModeFlag.Name, StorageModeFlag.Value, StorageModeFlag.Usage); v != nil {