Skip to content

Commit

Permalink
refactor after reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Nov 16, 2022
1 parent acd8345 commit 7f918c2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions x/ccv/provider/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) {
k.QueueValidatorUpdates(ctx)

// try sending updates to all chains
// if ccv channel is not established for consumer chain
// if CCV channel is not established for consumer chain
// the updates will remain queued until the channel is established
k.SendValidatorUpdates(ctx)
}

// sendValidatorUpdates iterates over chains and sends VSCs to
// SendValidatorUpdates iterates over chains and sends VSCs to
// consumer chains with established CCV channels
// if ccv channel is not established for consumer chain
// if CCV channel is not established for consumer chain
// the updates will remain queued until the channel is established
func (k Keeper) SendValidatorUpdates(ctx sdk.Context) {
k.IterateConsumerChains(ctx, func(ctx sdk.Context, chainID, clientID string) (stop bool) {
// check if CCV channel is establish and send
// check if CCV channel is established and send
if channelID, found := k.GetChainToChannel(ctx, chainID); found {
k.SendVSCPacketsToChain(ctx, chainID, channelID)
}
Expand All @@ -152,8 +152,8 @@ func (k Keeper) SendValidatorUpdates(ctx sdk.Context) {

// SendVSCPacketsToChain sends all queued ValidatorSetChangePackets to the specified chain
func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) {
pendingPackets := k.GetPendingVSCs(ctx, chainID)
for _, data := range pendingPackets {
pendingVSCs := k.GetPendingVSCs(ctx, chainID)
for _, data := range pendingVSCs {
// prepare to send the data to the consumer
packet, channelCap, err := utils.PrepareIBCPacketSend(
ctx,
Expand Down

0 comments on commit 7f918c2

Please sign in to comment.