cm/puppeth: fix crash when of ethstats specifier doesn't contain `:` (#25405)

Signed-off-by: Delweng <delweng@gmail.com>
pull/25448/head
Delweng 2 years ago committed by GitHub
parent 029059947a
commit 1af9e4f34c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      cmd/puppeth/module.go
  2. 2
      cmd/puppeth/module_explorer.go
  3. 2
      cmd/puppeth/module_faucet.go
  4. 2
      cmd/puppeth/module_node.go

@ -150,3 +150,12 @@ func checkPort(host string, port int) error {
conn.Close()
return nil
}
// getEthName gets the Ethereum Name from ethstats
func getEthName(s string) string {
n := strings.Index(s, ":")
if n >= 0 {
return s[:n]
}
return s
}

@ -104,7 +104,7 @@ func deployExplorer(client *sshClient, network string, bootnodes []string, confi
"Datadir": config.node.datadir,
"DBDir": config.dbdir,
"EthPort": config.node.port,
"EthName": config.node.ethstats[:strings.Index(config.node.ethstats, ":")],
"EthName": getEthName(config.node.ethstats),
"WebPort": config.port,
"Transformer": transformer,
})

@ -116,7 +116,7 @@ func deployFaucet(client *sshClient, network string, bootnodes []string, config
"VHost": config.host,
"ApiPort": config.port,
"EthPort": config.node.port,
"EthName": config.node.ethstats[:strings.Index(config.node.ethstats, ":")],
"EthName": getEthName(config.node.ethstats),
"CaptchaToken": config.captchaToken,
"CaptchaSecret": config.captchaSecret,
"FaucetAmount": config.amount,

@ -123,7 +123,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
"TotalPeers": config.peersTotal,
"Light": config.peersLight > 0,
"LightPeers": config.peersLight,
"Ethstats": config.ethstats[:strings.Index(config.ethstats, ":")],
"Ethstats": getEthName(config.ethstats),
"Etherbase": config.etherbase,
"GasTarget": config.gasTarget,
"GasLimit": config.gasLimit,

Loading…
Cancel
Save