Skip to content

Commit

Permalink
Add list-quorums command to CLI (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Mar 29, 2024
1 parent b294b0e commit 4087125
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions node/plugin/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ func pluginOps(ctx *cli.Context) {
return
}
log.Printf("Info: successfully updated socket, for operator ID: %x, operator address: %x, socket: %s", operatorID, sk.Address, config.Socket)
} else if config.Operation == "list-quorums" {
quorumIds, err := tx.GetRegisteredQuorumIdsForOperator(context.Background(), operatorID)
if err != nil {
log.Printf("Error: failed to get quorum(s) for operatorID: %x, operator address: %x, error: %v", operatorID, sk.Address, err)
return
}
log.Printf("Info: operator ID: %x, operator address: %x, current quorums: %v", operatorID, sk.Address, quorumIds)
} else {
log.Fatalf("Fatal: unsupported operation: %s", config.Operation)
}
Expand Down
4 changes: 2 additions & 2 deletions node/plugin/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
OperationFlag = cli.StringFlag{
Name: "operation",
Required: true,
Usage: "Supported operations: opt-in, opt-out",
Usage: "Supported operations: opt-in, opt-out, list-quorums",
EnvVar: common.PrefixEnvVar(flags.EnvVarPrefix, "OPERATION"),
}

Expand Down Expand Up @@ -136,7 +136,7 @@ func NewConfig(ctx *cli.Context) (*Config, error) {
}

op := ctx.GlobalString(OperationFlag.Name)
if op != "opt-in" && op != "opt-out" {
if op != "opt-in" && op != "opt-out" && op != "list-quorums " {
return nil, errors.New("unsupported operation type")
}

Expand Down

0 comments on commit 4087125

Please sign in to comment.