From f92313214204990f152a42eefe352de8b665d165 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sun, 27 Oct 2024 17:13:51 +0700 Subject: [PATCH] Update main.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- main.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index aa31098..9a8a092 100644 --- a/main.go +++ b/main.go @@ -103,17 +103,20 @@ func main() { log.Fatalf("Failed to get balances after adjustment: %v", err) } - if !lib.CheckBalancesWithinThreshold(balances, 0.10) { - totalBalance := sdkmath.ZeroInt() - for _, balance := range balances { - totalBalance = totalBalance.Add(balance) - } - if totalBalance.IsZero() { - fmt.Println("All accounts have zero balance. Proceeding without adjusting balances.") - } else { - log.Fatalf("Account balances are still not within 10%% of each other after adjustment") - } + if lib.CheckBalancesWithinThreshold(balances, 0.10) { + return } + + totalBalance := sdkmath.ZeroInt() + for _, balance := range balances { + totalBalance = totalBalance.Add(balance) + } + if totalBalance.IsZero() { + fmt.Println("All accounts have zero balance. Proceeding without adjusting balances.") + return + } + log.Fatalf("Account balances are still not within 10%% of each other after adjustment") + } } nodeURL := config.Nodes.RPC[0] // Use the first node