Skip to content

Commit 2d9c28d

Browse files
committed
Remove deprecated logic from GetTokenAccountInfos
1 parent 700ee77 commit 2d9c28d

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

pkg/code/server/account/server.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -297,32 +297,6 @@ func (s *server) GetTokenAccountInfos(ctx context.Context, req *accountpb.GetTok
297297
func (s *server) fetchBalances(ctx context.Context, recordsByType map[commonpb.AccountType][]*common.AccountRecords) (map[string]*balanceMetadata, error) {
298298
balanceMetadataByTokenAccount := make(map[string]*balanceMetadata)
299299

300-
// Pre-privacy accounts are not supported by the new batching stuff
301-
if _, ok := recordsByType[commonpb.AccountType_LEGACY_PRIMARY_2022]; ok {
302-
tokenAccount, err := common.NewAccountFromPublicKeyString(recordsByType[commonpb.AccountType_LEGACY_PRIMARY_2022][0].General.TokenAccount)
303-
if err != nil {
304-
return nil, err
305-
}
306-
307-
quarks, err := balance.CalculateFromCache(ctx, s.data, tokenAccount)
308-
switch err {
309-
case nil:
310-
balanceMetadataByTokenAccount[tokenAccount.PublicKey().ToBase58()] = &balanceMetadata{
311-
value: quarks,
312-
source: accountpb.TokenAccountInfo_BALANCE_SOURCE_CACHE,
313-
}
314-
case balance.ErrNotManagedByCode:
315-
// Don't bother calculating a balance, the account isn't useable in Code
316-
balanceMetadataByTokenAccount[tokenAccount.PublicKey().ToBase58()] = &balanceMetadata{
317-
value: 0,
318-
source: accountpb.TokenAccountInfo_BALANCE_SOURCE_UNKNOWN,
319-
}
320-
default:
321-
return nil, err
322-
}
323-
}
324-
325-
// Post-privacy Timelock account balances can be fetched using a batched method from cache
326300
var batchedAccountRecords []*common.AccountRecords
327301
for accountType, batchAccountRecords := range recordsByType {
328302
if accountType == commonpb.AccountType_LEGACY_PRIMARY_2022 {

0 commit comments

Comments
 (0)