Skip to content

Commit a0aa071

Browse files
authored
Merge pull request ethereum#14732 from ethersphere/swarm-remove-ethapi
cmd/swarm: Exit if --ethapi is set
2 parents 41318f3 + c7041fe commit a0aa071

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

cmd/swarm/main.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ var (
100100
Name: "sync",
101101
Usage: "Swarm Syncing enabled (default true)",
102102
}
103-
EthAPIFlag = cli.StringFlag{
104-
Name: "ethapi",
105-
Usage: "DEPRECATED: please use --ens-api and --swap-api",
106-
}
107103
EnsAPIFlag = cli.StringFlag{
108104
Name: "ens-api",
109105
Usage: "URL of the Ethereum API provider to use for ENS record lookups",
@@ -142,6 +138,12 @@ var (
142138
Name: "corsdomain",
143139
Usage: "Domain on which to send Access-Control-Allow-Origin header (multiple domains can be supplied separated by a ',')",
144140
}
141+
142+
// the following flags are deprecated and should be removed in the future
143+
DeprecatedEthAPIFlag = cli.StringFlag{
144+
Name: "ethapi",
145+
Usage: "DEPRECATED: please use --ens-api and --swap-api",
146+
}
145147
)
146148

147149
var defaultNodeConfig = node.DefaultConfig
@@ -266,7 +268,6 @@ Cleans database of corrupted entries.
266268
utils.PasswordFileFlag,
267269
// bzzd-specific flags
268270
CorsStringFlag,
269-
EthAPIFlag,
270271
EnsAPIFlag,
271272
EnsAddrFlag,
272273
SwarmConfigPathFlag,
@@ -285,6 +286,8 @@ Cleans database of corrupted entries.
285286
SwarmUploadDefaultPath,
286287
SwarmUpFromStdinFlag,
287288
SwarmUploadMimeType,
289+
//deprecated flags
290+
DeprecatedEthAPIFlag,
288291
}
289292
app.Flags = append(app.Flags, debug.Flags...)
290293
app.Before = func(ctx *cli.Context) error {
@@ -319,6 +322,11 @@ func version(ctx *cli.Context) error {
319322
}
320323

321324
func bzzd(ctx *cli.Context) error {
325+
// exit if the deprecated --ethapi flag is set
326+
if ctx.GlobalString(DeprecatedEthAPIFlag.Name) != "" {
327+
utils.Fatalf("--ethapi is no longer a valid command line flag, please use --ens-api and/or --swap-api.")
328+
}
329+
322330
cfg := defaultNodeConfig
323331
utils.SetNodeConfig(ctx, &cfg)
324332
stack, err := node.New(&cfg)
@@ -408,21 +416,12 @@ func registerBzzService(ctx *cli.Context, stack *node.Node) {
408416
swapEnabled := ctx.GlobalBool(SwarmSwapEnabledFlag.Name)
409417
syncEnabled := ctx.GlobalBoolT(SwarmSyncEnabledFlag.Name)
410418

411-
ethapi := ctx.GlobalString(EthAPIFlag.Name)
412-
if ethapi != "" {
413-
log.Warn("DEPRECATED: --ethapi is deprecated and will be removed in a future version, please use --ens-api and --swap-api")
414-
}
415-
416419
swapapi := ctx.GlobalString(SwarmSwapAPIFlag.Name)
417420
if swapEnabled && swapapi == "" {
418421
utils.Fatalf("SWAP is enabled but --swap-api is not set")
419422
}
420423

421424
ensapi := ctx.GlobalString(EnsAPIFlag.Name)
422-
// use the deprecated --ethapi if --ens-api is not set
423-
if ensapi == "" {
424-
ensapi = ethapi
425-
}
426425
ensAddr := ctx.GlobalString(EnsAddrFlag.Name)
427426

428427
cors := ctx.GlobalString(CorsStringFlag.Name)

cmd/swarm/run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func newTestNode(t *testing.T, dir string) *testNode {
194194
"--nodiscover",
195195
"--datadir", dir,
196196
"--ipcpath", conf.IPCPath,
197-
"--ethapi", "",
197+
"--ens-api", "",
198198
"--bzzaccount", account.Address.String(),
199199
"--bzznetworkid", "321",
200200
"--bzzport", httpPort,

swarm/dev/scripts/boot-cluster.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ start_swarm_node() {
208208
--bootnodes "${BOOTNODE_URL}"
209209
--datadir "${dir}"
210210
--identity "${name}"
211-
--ethapi "${GETH_RPC_URL}"
211+
--ens-api "${GETH_RPC_URL}"
212212
--bzznetworkid "321"
213213
--bzzaccount "${address}"
214214
--password "${dir}/password"

0 commit comments

Comments
 (0)