From f69e7b918381d024a2f5a8d3ca65dfde2d2f9183 Mon Sep 17 00:00:00 2001 From: Joe Bowman Date: Mon, 12 Jun 2023 11:22:10 +0100 Subject: [PATCH] Apply suggestions from code review --- x/interchainstaking/keeper/delegation.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x/interchainstaking/keeper/delegation.go b/x/interchainstaking/keeper/delegation.go index d747330c2..7515927ae 100644 --- a/x/interchainstaking/keeper/delegation.go +++ b/x/interchainstaking/keeper/delegation.go @@ -282,7 +282,6 @@ func (k *Keeper) MakePerformanceDelegation(ctx sdk.Context, zone *types.Zone, va func (k *Keeper) FlushOutstandingDelegations(ctx sdk.Context, zone *types.Zone, delAddrBalance sdk.Coin) error { var pendingAmount sdk.Coins exclusionTime := ctx.BlockTime().AddDate(0, 0, -1) - var coinsToFlush sdk.Coins k.IterateZoneReceipts(ctx, zone, func(_ int64, receiptInfo types.Receipt) (stop bool) { if (receiptInfo.FirstSeen.After(exclusionTime) || receiptInfo.FirstSeen.Equal(exclusionTime)) && receiptInfo.Completed == nil { pendingAmount = pendingAmount.Add(receiptInfo.Amount...) @@ -290,9 +289,8 @@ func (k *Keeper) FlushOutstandingDelegations(ctx sdk.Context, zone *types.Zone, return false }) - var hasNeg bool - coinsToFlush, hasNeg = sdk.NewCoins(delAddrBalance).SafeSub(pendingAmount...) + coinsToFlush, hasNeg := sdk.NewCoins(delAddrBalance).SafeSub(pendingAmount...) if hasNeg || coinsToFlush.IsZero() { k.Logger(ctx).Debug("delegate account balance negative, setting outdated reciepts") k.SetReceiptsCompleted(ctx, zone, exclusionTime, ctx.BlockTime())