From 650c1fe00180ea98671beaa4c6009d5fe0232077 Mon Sep 17 00:00:00 2001 From: Fynn Date: Thu, 24 Aug 2023 15:31:31 +0800 Subject: [PATCH] check secondary sp in gvg --- x/virtualgroup/keeper/msg_server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/virtualgroup/keeper/msg_server.go b/x/virtualgroup/keeper/msg_server.go index 727e8613a..8c1ba7b36 100644 --- a/x/virtualgroup/keeper/msg_server.go +++ b/x/virtualgroup/keeper/msg_server.go @@ -70,6 +70,10 @@ func (k msgServer) CreateGlobalVirtualGroup(goCtx context.Context, req *types.Ms if !found { return nil, sdkerrors.Wrapf(sptypes.ErrStorageProviderNotFound, "secondary sp not found, ID: %d", id) } + if !ssp.IsInService() && !ssp.IsInMaintenance() { + return nil, sptypes.ErrStorageProviderNotInService.Wrapf("sp in GVG is not in service or in maintenance, status: %s", sp.Status.String()) + } + secondarySpIds = append(secondarySpIds, ssp.Id) gvgStatisticsWithinSP := k.GetOrCreateGVGStatisticsWithinSP(ctx, ssp.Id) gvgStatisticsWithinSP.SecondaryCount++