Files
amethyst/commons
Claude c59e9f500d perf(cashu): read concurrent maps through a view instead of copying them
Moving CashuWalletState off ConcurrentHashMap onto quartz ConcurrentMap
turned every iteration into snapshot(), a full HashMap copy on JVM: 4-8
whole-map copies per event bundle (tokens, decrypted token contents,
quotes, history, nutzaps), where the old code iterated the live views.

- quartz ConcurrentMap gains asMap(): the live, weakly consistent
  ConcurrentHashMap on JVM/Android, and the current immutable
  copy-on-write map on native. Neither copies. snapshot() stays for
  callers that need a stable copy. ConcurrentCollectionsTest covers it.
- CashuWalletState reads through asMap() everywhere it only iterates or
  looks up; its two session key-sets, which are copied into a new set
  anyway, use quartz ConcurrentSet.snapshot().
- CashuMintDirectoryState.rebuildEntries copied its announcements twice
  per rebuild; it now takes one snapshot, so both passes also see the
  same set.
- The snapshot() this branch had added to the commons ConcurrentSet is
  reverted: quartz already has a ConcurrentSet with snapshot(), which
  CashuWalletState and AccountConcordActions now use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7FuNBSKiyVecARSoE4B9P
2026-09-28 12:28:09 +00:00
..