diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/mintApi/CashuMintOperations.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/mintApi/CashuMintOperations.kt index 024413a720..ca15286ab7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/mintApi/CashuMintOperations.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/mintApi/CashuMintOperations.kt @@ -687,10 +687,13 @@ class CashuMintOperations( val ys = ArrayList(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(secretByY.size)