Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable NAT for local developmental network #1138

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cmd/go-quai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/metrics"
"github.com/dominant-strategies/go-quai/node"
"github.com/dominant-strategies/go-quai/p2p/nat"
"github.com/dominant-strategies/go-quai/params"
"github.com/naoina/toml"
)
Expand Down Expand Up @@ -103,8 +104,11 @@ func loadConfig(file string, cfg *quaiConfig) error {
return err
}

func defaultNodeConfig() node.Config {
func defaultNodeConfig(ctx *cli.Context) node.Config {
cfg := node.DefaultConfig
if !ctx.GlobalBool(utils.LocalFlag.Name) {
cfg.P2P.NAT = nat.Any()
}
cfg.Name = clientIdentifier
cfg.Version = params.VersionWithCommit(gitCommit, gitDate)
cfg.HTTPModules = append(cfg.HTTPModules, "eth")
Expand All @@ -118,7 +122,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, quaiConfig) {
// Load defaults.
cfg := quaiConfig{
Eth: ethconfig.Defaults,
Node: defaultNodeConfig(),
Node: defaultNodeConfig(ctx),
Metrics: metrics.DefaultConfig,
}

Expand Down
2 changes: 0 additions & 2 deletions node/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"runtime"

"github.com/dominant-strategies/go-quai/p2p"
"github.com/dominant-strategies/go-quai/p2p/nat"
"github.com/dominant-strategies/go-quai/rpc"
)

Expand All @@ -46,7 +45,6 @@ var DefaultConfig = Config{
P2P: p2p.Config{
ListenAddr: ":30303",
MaxPeers: 50,
NAT: nat.Any(),
},
DBEngine: "",
}
Expand Down