Skip to content

Commit

Permalink
Handle case where topN is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jun 12, 2024
1 parent e0098fb commit 4784943
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/ccv/provider/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ func (k Keeper) GetConsumerChain(ctx sdk.Context, chainID string) (types.Chain,
}

topN, found := k.GetTopN(ctx, chainID)
if !found {
k.Logger(ctx).Error("failed to get top N, treating as 0", "chain", chainID)
topN = 0
}

// Get the minimal power in the top N for the consumer chain
minPowerInTopN, found := k.GetMinimumPowerInTopN(ctx, chainID)
if !found {
k.Logger(ctx).Error("failed to get minimum power in top N, treating as -1", "chain", chainID)
minPowerInTopN = -1
}

Expand Down

0 comments on commit 4784943

Please sign in to comment.