forked from cerc-io/laconicd-deprecated
add custom ip list to cmd (#545)
* add custom ip list to cmd * fix errs * fix lint * change to StringSlice
This commit is contained in:
parent
712a5bad61
commit
64b18b556f
@ -50,6 +50,7 @@ var (
|
||||
flagStartingIPAddress = "starting-ip-address"
|
||||
flagCoinDenom = "coin-denom"
|
||||
flagKeyAlgo = "algo"
|
||||
flagIPAddrs = "ip-addrs"
|
||||
)
|
||||
|
||||
const nodeDirPerm = 0755
|
||||
@ -78,13 +79,14 @@ Note, strict routability for addresses is turned off in the config file.`,
|
||||
nodeDaemonHome, _ := cmd.Flags().GetString(flagNodeDaemonHome)
|
||||
nodeCLIHome, _ := cmd.Flags().GetString(flagNodeCLIHome)
|
||||
startingIPAddress, _ := cmd.Flags().GetString(flagStartingIPAddress)
|
||||
ipAddresses, _ := cmd.Flags().GetStringSlice(flagIPAddrs)
|
||||
numValidators, _ := cmd.Flags().GetInt(flagNumValidators)
|
||||
coinDenom, _ := cmd.Flags().GetString(flagCoinDenom)
|
||||
algo, _ := cmd.Flags().GetString(flagKeyAlgo)
|
||||
|
||||
return InitTestnet(
|
||||
cmd, config, cdc, mbm, genAccIterator, outputDir, chainID, coinDenom, minGasPrices,
|
||||
nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress, keyringBackend, algo, numValidators,
|
||||
nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress, ipAddresses, keyringBackend, algo, numValidators,
|
||||
)
|
||||
},
|
||||
}
|
||||
@ -95,6 +97,7 @@ Note, strict routability for addresses is turned off in the config file.`,
|
||||
cmd.Flags().String(flagNodeDaemonHome, "ethermintd", "Home directory of the node's daemon configuration")
|
||||
cmd.Flags().String(flagNodeCLIHome, "ethermintcli", "Home directory of the node's cli configuration")
|
||||
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")
|
||||
cmd.Flags().StringSlice(flagIPAddrs, []string{}, "List of IP addresses to use (i.e. `192.168.0.1,172.168.0.1` results in persistent peers list ID0@192.168.0.1:46656, ID1@172.168.0.1)")
|
||||
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
|
||||
cmd.Flags().String(flagCoinDenom, ethermint.AttoPhoton, "Coin denomination used for staking, governance, mint, crisis and evm parameters")
|
||||
cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", ethermint.AttoPhoton), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01aphoton,0.001stake)")
|
||||
@ -117,7 +120,8 @@ func InitTestnet(
|
||||
nodeDirPrefix,
|
||||
nodeDaemonHome,
|
||||
nodeCLIHome,
|
||||
startingIPAddress,
|
||||
startingIPAddress string,
|
||||
ipAddresses []string,
|
||||
keyringBackend,
|
||||
algo string,
|
||||
numValidators int,
|
||||
@ -135,6 +139,10 @@ func InitTestnet(
|
||||
return err
|
||||
}
|
||||
|
||||
if len(ipAddresses) != 0 {
|
||||
numValidators = len(ipAddresses)
|
||||
}
|
||||
|
||||
nodeIDs := make([]string, numValidators)
|
||||
valPubKeys := make([]tmcrypto.PubKey, numValidators)
|
||||
|
||||
@ -169,11 +177,17 @@ func InitTestnet(
|
||||
|
||||
config.Moniker = nodeDirName
|
||||
|
||||
ip, err := getIP(i, startingIPAddress)
|
||||
var ip string
|
||||
var err error
|
||||
if len(ipAddresses) == 0 {
|
||||
ip, err = getIP(i, startingIPAddress)
|
||||
if err != nil {
|
||||
_ = os.RemoveAll(outputDir)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
ip = ipAddresses[i]
|
||||
}
|
||||
|
||||
nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(config)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user