* fix pow

* only pow with nonse
This commit is contained in:
callebtc
2025-09-14 05:01:34 +02:00
committed by GitHub
parent deba156711
commit b96bf180f9
3 changed files with 24 additions and 7 deletions
@@ -78,6 +78,7 @@ class GeohashMessageHandler(
if (isTeleportPresence) return@launch
val senderName = repo.displayNameForNostrPubkeyUI(event.pubkey)
val hasNonce = try { NostrProofOfWork.hasNonce(event) } catch (_: Exception) { false }
val msg = BitchatMessage(
id = event.id,
sender = senderName,
@@ -88,7 +89,9 @@ class GeohashMessageHandler(
senderPeerID = "nostr:${event.pubkey.take(8)}",
mentions = null,
channel = "#$subscribedGeohash",
powDifficulty = try { NostrProofOfWork.calculateDifficulty(event.id).takeIf { it > 0 } } catch (_: Exception) { null }
powDifficulty = try {
if (hasNonce) NostrProofOfWork.calculateDifficulty(event.id).takeIf { it > 0 } else null
} catch (_: Exception) { null }
)
withContext(Dispatchers.Main) { messageManager.addChannelMessage("geo:$subscribedGeohash", msg) }
} catch (e: Exception) {