node/cmd: list missing guardians in list-nodes

Change-Id: I12e2aacbeb37c0bae5ad1e796e009a1c7b2312e1
This commit is contained in:
Leo 2021-08-10 16:36:24 +02:00
parent e9491d25f8
commit 08e70a5aaf
1 changed files with 22 additions and 0 deletions

View File

@ -78,6 +78,14 @@ func runListNodes(cmd *cobra.Command, args []string) {
log.Fatalf("failed to list nodes: %v", err)
}
gs, err := c.GetCurrentGuardianSet(ctx, &publicrpcv1.GetCurrentGuardianSetRequest{})
if err != nil {
log.Fatalf("failed to list current guardian get: %v", err)
}
log.Printf("current guardian set index: %d (%d guardians)",
gs.GuardianSet.Index, len(gs.GuardianSet.Addresses))
nodes := lastHeartbeats.Entries
sort.Slice(nodes, func(i, j int) bool {
@ -121,4 +129,18 @@ func runListNodes(cmd *cobra.Command, args []string) {
}
w.Flush()
fmt.Print("\n")
for _, addr := range gs.GuardianSet.Addresses {
var found bool
for _, h := range nodes {
if h.VerifiedGuardianAddr == addr {
found = true
}
}
if !found {
fmt.Printf("Missing guardian: %s\n", addr)
}
}
}