Fail on multiple SPL token accounts for the same mint #42

Closed
opened 2026-07-25 13:21:04 +02:00 by minimons · 0 comments
Owner

Background

SolanaBlockChainImpl.getSPLTokenHoldings(...) returns a map keyed by mint address.

If multiple token accounts exist for the same mint, the current implementation silently overwrites the previous value. This may return an incorrect and unpredictable balance.

Implementation

Detect duplicate mint addresses while building the result map.

If more than one token account is found for the same owner and mint, throw an exception containing the owner and mint addresses instead of returning an ambiguous balance.

Support for combining or selecting between multiple token accounts is out of scope.

Acceptance criteria

  • A single token account per mint preserves the existing behavior.
  • Multiple token accounts for the same mint cause a clear exception.
  • No token balance is silently overwritten.
  • The project compiles successfully.
## Background `SolanaBlockChainImpl.getSPLTokenHoldings(...)` returns a map keyed by mint address. If multiple token accounts exist for the same mint, the current implementation silently overwrites the previous value. This may return an incorrect and unpredictable balance. ## Implementation Detect duplicate mint addresses while building the result map. If more than one token account is found for the same owner and mint, throw an exception containing the owner and mint addresses instead of returning an ambiguous balance. Support for combining or selecting between multiple token accounts is out of scope. ## Acceptance criteria * A single token account per mint preserves the existing behavior. * Multiple token accounts for the same mint cause a clear exception. * No token balance is silently overwritten. * The project compiles successfully.
minimons added the enhancement label 2026-07-25 13:21:04 +02:00
minimons self-assigned this 2026-07-25 13:21:04 +02:00
minimons added this to the AssetAZ project 2026-07-25 13:21:04 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: r35157/com_r35157_nenjim-hubd-impl_ref#42