Skip to content

Commit

Permalink
fix(nodemgr): offline pool wasn't indexing pool id in bounds check.
Browse files Browse the repository at this point in the history
  • Loading branch information
pbennett committed Oct 11, 2024
1 parent bb0f527 commit 0c8262e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nodemgr/poolcmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,14 @@ func PayoutPool(ctx context.Context, command *cli.Command) error {
func OfflinePool(ctx context.Context, command *cli.Command) error {
var info = App.retiClient.Info()
poolID := command.Uint("pool")
if int(poolID) >= len(info.Pools) {
if int(poolID) > len(info.Pools) {
return fmt.Errorf("pool num:%d not valid for pool id", poolID)
}
signerAddr, _ := types.DecodeAddress(info.Config.Manager)

return App.retiClient.GoOffline(info.Pools[poolID-1].PoolAppId, signerAddr)
err := App.retiClient.GoOffline(info.Pools[poolID-1].PoolAppId, signerAddr)
if err == nil {
misc.Infof(App.logger, "Pool %d, app id:%d is now offline", poolID, info.Pools[poolID-1].PoolAppId)
}
return err
}

0 comments on commit 0c8262e

Please sign in to comment.