Skip to content

Commit 098a2b6

Browse files
rjl493456442fjl
andauthored
eth: move eth.Config to a common package (#22205)
This moves the eth config definition into a separate package, eth/ethconfig. Packages eth and les can now import this common package instead of importing eth from les, reducing dependencies. Co-authored-by: Felix Lange <fjl@twurst.com>
1 parent 2812132 commit 098a2b6

22 files changed

Lines changed: 265 additions & 215 deletions

‎cmd/faucet/faucet.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ import (
4747
"github.com/ethereum/go-ethereum/common"
4848
"github.com/ethereum/go-ethereum/core"
4949
"github.com/ethereum/go-ethereum/core/types"
50-
"github.com/ethereum/go-ethereum/eth"
5150
"github.com/ethereum/go-ethereum/eth/downloader"
51+
"github.com/ethereum/go-ethereum/eth/ethconfig"
5252
"github.com/ethereum/go-ethereum/ethclient"
5353
"github.com/ethereum/go-ethereum/ethstats"
5454
"github.com/ethereum/go-ethereum/les"
@@ -247,7 +247,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*enode.Node, network ui
247247
}
248248

249249
// Assemble the Ethereum light client protocol
250-
cfg := eth.DefaultConfig
250+
cfg := ethconfig.Defaults
251251
cfg.SyncMode = downloader.LightSync
252252
cfg.NetworkId = network
253253
cfg.Genesis = genesis

‎cmd/geth/config.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"gopkg.in/urfave/cli.v1"
2828

2929
"github.com/ethereum/go-ethereum/cmd/utils"
30-
"github.com/ethereum/go-ethereum/eth"
30+
"github.com/ethereum/go-ethereum/eth/ethconfig"
3131
"github.com/ethereum/go-ethereum/internal/ethapi"
3232
"github.com/ethereum/go-ethereum/log"
3333
"github.com/ethereum/go-ethereum/metrics"
@@ -85,7 +85,7 @@ type whisperDeprecatedConfig struct {
8585
}
8686

8787
type gethConfig struct {
88-
Eth eth.Config
88+
Eth ethconfig.Config
8989
Shh whisperDeprecatedConfig
9090
Node node.Config
9191
Ethstats ethstatsConfig
@@ -121,7 +121,7 @@ func defaultNodeConfig() node.Config {
121121
func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
122122
// Load defaults.
123123
cfg := gethConfig{
124-
Eth: eth.DefaultConfig,
124+
Eth: ethconfig.Defaults,
125125
Node: defaultNodeConfig(),
126126
Metrics: metrics.DefaultConfig,
127127
}

‎cmd/utils/cmd.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"github.com/ethereum/go-ethereum/core/rawdb"
3434
"github.com/ethereum/go-ethereum/core/types"
3535
"github.com/ethereum/go-ethereum/crypto"
36-
"github.com/ethereum/go-ethereum/eth"
36+
"github.com/ethereum/go-ethereum/eth/ethconfig"
3737
"github.com/ethereum/go-ethereum/ethdb"
3838
"github.com/ethereum/go-ethereum/internal/debug"
3939
"github.com/ethereum/go-ethereum/log"
@@ -75,7 +75,7 @@ func StartNode(ctx *cli.Context, stack *node.Node) {
7575
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
7676
defer signal.Stop(sigc)
7777

78-
minFreeDiskSpace := eth.DefaultConfig.TrieDirtyCache
78+
minFreeDiskSpace := ethconfig.Defaults.TrieDirtyCache
7979
if ctx.GlobalIsSet(MinFreeDiskSpaceFlag.Name) {
8080
minFreeDiskSpace = ctx.GlobalInt(MinFreeDiskSpaceFlag.Name)
8181
} else if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {

0 commit comments

Comments
 (0)