diff --git a/eth/backend.go b/eth/backend.go index 9bd8ba197..cbf78bbc0 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -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 } diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index deaf9e315..1d072178d 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -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 diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index 4737b2e01..5d7cb8662 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -27,6 +27,7 @@ var DefaultFlags = []cli.Flag{ SnapshotDatabaseLayoutFlag, ExternalSnapshotDownloaderAddrFlag, BatchSizeFlag, + BlockDownloaderWindowFlag, DatabaseVerbosityFlag, PrivateApiAddr, EtlBufferSizeFlag, diff --git a/turbo/cli/flags.go b/turbo/cli/flags.go index a8228dc30..4ee31caf5 100644 --- a/turbo/cli/flags.go +++ b/turbo/cli/flags.go @@ -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 {