node: fix showDetails in testnet mode

Change-Id: Ie93fb68bc31de67e1b009b758c29bcdd275394f9
This commit is contained in:
Leo 2021-12-09 23:21:20 +01:00 committed by Leopold Schabel
parent 864e983e04
commit e15f712955
1 changed files with 12 additions and 2 deletions

View File

@ -62,9 +62,19 @@ func runListNodes(cmd *cobra.Command, args []string) {
log.Printf("%d nodes in guardian state set", len(nodes))
// Check if any node is sending Ropsten metrics
var isTestnet bool
for _, node := range nodes {
for _, network := range node.RawHeartbeat.Networks {
if vaa.ChainID(network.Id) == vaa.ChainIDEthereumRopsten {
isTestnet = true
}
}
}
w := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
if *testnetMode {
if isTestnet {
// Include Ropsten in testnet mode
if showDetails {
_, _ = w.Write([]byte("Node key\tGuardian key\tNode name\tVersion\tLast seen\tUptime\tSolana\tEthereum\tTerra\tBSC\tPolygon\tAvalanche\tRopsten\n"))
@ -100,7 +110,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
}
}
if *testnetMode {
if isTestnet {
if showDetails {
fmt.Fprintf(w,
"%s\t%s\t%s\t%s\t%s\t%s\t%s %d (%d)\t%s %d (%d)\t%s %d (%d)\t%s %d (%d)\t%s %d (%d)\t%s %d (%d)\t%s %d (%d)\n",