fix(cashu): drop the JVM-only HashMap.putIfAbsent from commonMain

CashuMintOperations.checkProofStates used java.util.HashMap.putIfAbsent,
which the commonMain metadata compile rejects. The map is local and
single-threaded, so an explicit contains-then-set keeps the same
first-secret-wins behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7FuNBSKiyVecARSoE4B9P
This commit is contained in:
Claude
2026-09-28 03:45:43 +00:00
parent 290d87d9f6
commit a9572047b9
@@ -687,10 +687,13 @@ class CashuMintOperations(
val ys = ArrayList<String>(proofs.size)
proofs.forEach { proof ->
val y = Bdhke.hashToCurveCompressed(proof.secret.encodeToByteArray()).toHexKey()
// putIfAbsent: two proofs can legitimately carry the same secret
// First one wins: two proofs can legitimately carry the same secret
// (a duplicated kind:7375 the dedup pass hasn't retired yet), and
// they map to the same state anyway.
if (secretByY.putIfAbsent(y, proof.secret) == null) ys.add(y)
if (y !in secretByY) {
secretByY[y] = proof.secret
ys.add(y)
}
}
val out = HashMap<String, ProofState>(secretByY.size)