From ef3be707417c2bf286f20aaed392ac0eb2b157c4 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 13 Jul 2026 23:02:21 +0000 Subject: [PATCH] fix: reject kind:1059 gift wraps with empty content before caching A gift wrap with an empty content string carries no NIP-44 ciphertext, so it can never be unwrapped. Filtering it at LocalCache's ingestion choke point (justConsumeInnerInner) rejects it before the Schnorr signature check and before it takes a permanent cache slot, and keeps GiftWrapEventHandler from retrying a doomed unwrap on every batch. Locally stripped wraps (copyNoContent, used to drop the ciphertext after a successful unwrap) are assigned directly to note.event and never pass through justConsume, so they are unaffected. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_011A6iSrJJHUoz686eDnCQMV --- .../com/vitorpamplona/amethyst/model/LocalCache.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt index 58cdad1fc9..f1452106dc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/LocalCache.kt @@ -3847,7 +3847,15 @@ object LocalCache : ILocalCache, ICacheProvider { } is GiftWrapEvent -> { - consumeRegularEvent(event, relay, wasVerified) + // A wrap with an empty content carries no NIP-44 ciphertext and can + // never be unwrapped — reject it before paying for a signature check + // and a cache slot. Locally stripped copies (copyNoContent) are + // assigned straight to note.event and never pass through here. + if (event.content.isEmpty()) { + false + } else { + consumeRegularEvent(event, relay, wasVerified) + } } is GroupEvent -> {