Skip to content

Commit

Permalink
testing bug fix for account delegated to dead baker
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Mar 31, 2024
1 parent d0abd85 commit 09ac95c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Sources/KukaiCoreSwift/Clients/TzKTClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,21 @@ public class TzKTClient {
return
}
}
// Inactive baker, display next reward as zero
else if previousRewardIndex == 0 {
let futureCycle = currentCycles.first
let futureReward = RewardDetails(bakerAlias: pReward?.bakerAlias,
bakerLogo: pReward?.bakerLogo,
paymentAddress: pReward?.paymentAddress ?? configToUse.address,
amount: .zero(),
cycle: futureCycle?.index ?? 0,
fee: 0,
date: futureCycle?.endDate ?? Date(),
meetsMinDelegation: pReward?.meetsMinDelegation ?? true)
DispatchQueue.main.async { completion(Result.success(AggregateRewardInformation(previousReward: pReward, estimatedPreviousReward: nil, estimatedNextReward: futureReward))) }
return
}


let lastCompleteCycle = currentCycles[TzKTClient.numberOfFutureCyclesReturned + 1]
estimatedPreviousReward = self?.rewardDetail(fromConfig: configToUse, rewards: currentDelegatorRewards, cycles: currentCycles, selectedIndex: previousRewardIndex, dateForDisplay: lastCompleteCycle.endDate ?? Date())
Expand Down

0 comments on commit 09ac95c

Please sign in to comment.