Skip to content

Commit

Permalink
Logs duplicate token account association and token balance (#3849)
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Li <xin.li@swirldslabs.com>
  • Loading branch information
xin-hedera committed May 24, 2022
1 parent e59776f commit 4ed267f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ protected void doParse(AccountBalanceFile accountBalanceFile) {
count = accountBalanceFile.getItems().doOnNext(accountBalance -> {
accountBalances.add(accountBalance);
for (var tokenBalance : accountBalance.getTokenBalances()) {
tokenBalances.put(tokenBalance.getId(), tokenBalance);
if (tokenBalances.putIfAbsent(tokenBalance.getId(), tokenBalance) != null) {
log.warn("Skipping duplicate token balance: {}", tokenBalance);
}
}

if (accountBalances.size() >= batchSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ public void onToken(Token token) throws ImporterException {
@Override
public void onTokenAccount(TokenAccount tokenAccount) throws ImporterException {
if (tokenAccounts.containsKey(tokenAccount.getId())) {
log.warn("Skipping duplicate token account association: {}", tokenAccount);
return;
}

Expand Down

0 comments on commit 4ed267f

Please sign in to comment.