Skip to content

Commit

Permalink
refactor: Rename function name
Browse files Browse the repository at this point in the history
  • Loading branch information
kayano committed Sep 12, 2023
1 parent 8263346 commit a3476bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ type Account struct {
Balance math.Int
}

func GetAccountsBalances(accounts []Account, rpcs map[string]string) []Account {
func GetBalances(accounts []Account, rpcs map[string]string) []Account {
num := len(accounts)

out := make(chan Account, num)
defer close(out)

for i := 0; i < num; i++ {
go func(i int) {
account, err := GetAccountBalance(accounts[i], rpcs)
account, err := GetBalance(accounts[i], rpcs)
if err != nil {
out <- Account{}

Expand All @@ -49,7 +49,7 @@ func GetAccountsBalances(accounts []Account, rpcs map[string]string) []Account {
return accountsWithBalance
}

func GetAccountBalance(account Account, rpcs map[string]string) (Account, error) {
func GetBalance(account Account, rpcs map[string]string) (Account, error) {
chain, err := chain.PrepChain(chain.Info{
ChainID: account.ChainID,
RPCAddr: rpcs[account.ChainID],
Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (wb WalletBalanceCollector) Describe(ch chan<- *prometheus.Desc) {
func (wb WalletBalanceCollector) Collect(ch chan<- prometheus.Metric) {
log.Debug("Start collecting", zap.String("metric", walletBalanceMetricName))

accounts := account.GetAccountsBalances(wb.Accounts, wb.RPCs)
accounts := account.GetBalances(wb.Accounts, wb.RPCs)

for _, a := range accounts {
// Convert to a big float to get a float64 for metrics
Expand Down

0 comments on commit a3476bf

Please sign in to comment.