Skip to content
This repository was archived by the owner on Nov 30, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions client/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var (
flagStartingIPAddress = "starting-ip-address"
flagCoinDenom = "coin-denom"
flagKeyAlgo = "algo"
flagIPAddrs = "ip-addrs"
)

const nodeDirPerm = 0755
Expand Down Expand Up @@ -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,
)
},
}
Expand All @@ -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 [email protected]:46656, [email protected]: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 [email protected]:46656, [email protected])")
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)")
Expand All @@ -117,7 +120,8 @@ func InitTestnet(
nodeDirPrefix,
nodeDaemonHome,
nodeCLIHome,
startingIPAddress,
startingIPAddress string,
ipAddresses []string,
keyringBackend,
algo string,
numValidators int,
Expand All @@ -135,6 +139,10 @@ func InitTestnet(
return err
}

if len(ipAddresses) != 0 {
numValidators = len(ipAddresses)
}

nodeIDs := make([]string, numValidators)
valPubKeys := make([]tmcrypto.PubKey, numValidators)

Expand Down Expand Up @@ -169,10 +177,16 @@ func InitTestnet(

config.Moniker = nodeDirName

ip, err := getIP(i, startingIPAddress)
if err != nil {
_ = os.RemoveAll(outputDir)
return err
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)
Expand Down