aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-17 09:12:50 +0800
committerJimmy Hu <jimmy.hu@dexon.org>2019-03-17 09:12:50 +0800
commit6091c2de57fee155e5d7f512b326bde53c84c04e (patch)
tree7625cec0e792068b5945d3dda9bb4998457df7b4 /cmd
parent8ff31f980a7e169dda85cd77f88f56d03788a135 (diff)
downloaddexon-6091c2de57fee155e5d7f512b326bde53c84c04e.tar.gz
dexon-6091c2de57fee155e5d7f512b326bde53c84c04e.tar.zst
dexon-6091c2de57fee155e5d7f512b326bde53c84c04e.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 46c48d254..ed3a19d1f 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 53d5e75cb..9f1080f45 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -659,6 +659,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
@@ -1249,27 +1256,41 @@ func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) {
cfg.EVMInterpreter = ctx.GlobalString(EVMInterpreterFlag.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