Skip to content

Commit

Permalink
make balances faster
Browse files Browse the repository at this point in the history
  • Loading branch information
maebeam committed Sep 1, 2021
1 parent 300af30 commit 5520ae4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/block_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -8693,10 +8693,15 @@ func (bav *UtxoView) Preload(bitcloutBlock *MsgBitCloutBlock) error {
}

// Set real entries for all the profiles that actually exist
result := bav.Postgres.GetProfilesForPublicKeys(publicKeys)
for _, profile := range result {
profiles := bav.Postgres.GetProfilesForPublicKeys(publicKeys)
for _, profile := range profiles {
bav.setProfileMappings(profile)
}

balances := bav.Postgres.GetBalancesBatch(publicKeys)
for _, balance := range balances {
bav.PublicKeyToBitcloutBalanceNanos[MakePkMapKey(balance.PublicKey.ToBytes())] = balance.BalanceNanos
}
}

// One iteration for everything else
Expand Down

0 comments on commit 5520ae4

Please sign in to comment.