From 9cbfa0c21c64ea070dae1c9a00a6a682fe45e806 Mon Sep 17 00:00:00 2001 From: gop Date: Mon, 18 Sep 2023 19:47:27 -0500 Subject: [PATCH] Disable NAT for local developmental network --- cmd/go-quai/config.go | 8 ++++++-- node/defaults.go | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/go-quai/config.go b/cmd/go-quai/config.go index 631798bcbd..2b10906149 100644 --- a/cmd/go-quai/config.go +++ b/cmd/go-quai/config.go @@ -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" ) @@ -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") @@ -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, } diff --git a/node/defaults.go b/node/defaults.go index b96334589d..17944cab0a 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -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" ) @@ -46,7 +45,6 @@ var DefaultConfig = Config{ P2P: p2p.Config{ ListenAddr: ":30303", MaxPeers: 50, - NAT: nat.Any(), }, DBEngine: "", }