aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-17 09:12:50 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:58 +0800
commit2818ad97f5b302f76e3296195bf8daae1868c435 (patch)
tree0e055a8dc82f8a473f877400074dffe7b811090c /cmd
parent9c9073db149d89eb31dc7c68d440b359f42fe8e9 (diff)
downloaddexon-2818ad97f5b302f76e3296195bf8daae1868c435.tar
dexon-2818ad97f5b302f76e3296195bf8daae1868c435.tar.gz
dexon-2818ad97f5b302f76e3296195bf8daae1868c435.tar.bz2
dexon-2818ad97f5b302f76e3296195bf8daae1868c435.tar.lz
dexon-2818ad97f5b302f76e3296195bf8daae1868c435.tar.xz
dexon-2818ad97f5b302f76e3296195bf8daae1868c435.tar.zst
dexon-2818ad97f5b302f76e3296195bf8daae1868c435.zip
dex: implement recovery mechanism (#258)
* dex: implement recovery mechanism The DEXON recovery protocol allows us to use the Ethereum blockchain as a fallback consensus chain to coordinate recovery. * fix
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gdex/main.go1
-rw-r--r--cmd/utils/flags.go21
2 files changed, 22 insertions, 0 deletions
diff --git a/cmd/gdex/main.go b/cmd/gdex/main.go
index dcd46e796..29b61a4ec 100644
--- a/cmd/gdex/main.go
+++ b/cmd/gdex/main.go
@@ -140,6 +140,7 @@ var (
utils.IndexerEnableFlag,
utils.IndexerPluginFlag,
utils.IndexerPluginFlagsFlag,
+ utils.RecoveryNetworkRPCFlag,
configFileFlag,
}
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index c6d60d0bb..6b0c682a7 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -664,6 +664,13 @@ var (
Usage: "External indexer plugin's flags if needed",
Value: "",
}
+
+ // Dexcon settings.
+ RecoveryNetworkRPCFlag = cli.StringFlag{
+ Name: "recovery.network-rpc",
+ Usage: "RPC URL of the recovery network",
+ Value: "https://mainnet.infura.io",
+ }
)
// MakeDataDir retrieves the currently requested data directory, terminating
@@ -1257,27 +1264,41 @@ func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) {
cfg.RPCGasCap = new(big.Int).SetUint64(ctx.GlobalUint64(RPCGlobalGasCap.Name))
}
+ cfg.RecoveryNetworkRPC = ctx.GlobalString(RecoveryNetworkRPCFlag.Name)
+
// Override any default configs for hard coded networks.
switch {
case ctx.GlobalBool(TestnetFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 238
}
+ if !ctx.GlobalIsSet(RecoveryNetworkRPCFlag.Name) {
+ cfg.RecoveryNetworkRPC = "http://rinkeby.infura.io"
+ }
cfg.Genesis = core.DefaultTestnetGenesisBlock()
case ctx.GlobalBool(TaipeiFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 239
}
+ if !ctx.GlobalIsSet(RecoveryNetworkRPCFlag.Name) {
+ cfg.RecoveryNetworkRPC = "http://rinkeby.infura.io"
+ }
cfg.Genesis = core.DefaultTaipeiGenesisBlock()
case ctx.GlobalBool(YilanFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 240
}
+ if !ctx.GlobalIsSet(RecoveryNetworkRPCFlag.Name) {
+ cfg.RecoveryNetworkRPC = "http://rinkeby.infura.io"
+ }
cfg.Genesis = core.DefaultYilanGenesisBlock()
case ctx.GlobalBool(DeveloperFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1337
}
+ if !ctx.GlobalIsSet(RecoveryNetworkRPCFlag.Name) {
+ cfg.RecoveryNetworkRPC = "http://rinkeby.infura.io"
+ }
// Create new developer account or reuse existing one
var (
developer accounts.Account