Skip to content

Commit

Permalink
getWalletSummary out of the loop
Browse files Browse the repository at this point in the history
- Updated the code to not call getWalletSummary() with each loop iteration
  • Loading branch information
LukasKorba committed Dec 3, 2024
1 parent 35ddf87 commit db3a4b9
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ extension SaplingParametersHandlerImpl: SaplingParametersHandler {

var totalSaplingBalanceTrigger = false
var totalTransparentBalanceTrigger = false

let accountBalances = try await rustBackend.getWalletSummary()?.accountBalances

for account in accounts {
let zip32AccountIndex = Zip32AccountIndex(account.index)

let totalSaplingBalance =
try await rustBackend.getWalletSummary()?.accountBalances[zip32AccountIndex]?.saplingBalance.total().amount
?? 0
let totalSaplingBalance = accountBalances?[zip32AccountIndex]?.saplingBalance.total().amount ?? 0

if totalSaplingBalance > 0 {
totalSaplingBalanceTrigger = true
Expand Down

0 comments on commit db3a4b9

Please sign in to comment.