From fe060f1e4dc07be5fa32aa011a711aef470d7278 Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 10 Jan 2024 12:04:09 +0000 Subject: [PATCH] Fix key consistency --- NostrServices/Services/RedisStore.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/NostrServices/Services/RedisStore.cs b/NostrServices/Services/RedisStore.cs index e129fe8..d23a1bb 100644 --- a/NostrServices/Services/RedisStore.cs +++ b/NostrServices/Services/RedisStore.cs @@ -39,7 +39,16 @@ public class RedisStore return await _database.GetAsync(ProfileKey(id)); } - private string EventKey(NostrIdentifier id) => $"event:{id.ToBech32()}"; + private string EventKey(NostrIdentifier id) + { + if (id is NostrAddressIdentifier naddr) + { + return $"event:{naddr.Kind}:{naddr.Pubkey}:{naddr.Identifier}"; + } + + return $"event:{id.Special}"; + } + private string ProfileKey(string id) => $"profile:{id}"; } @@ -73,7 +82,7 @@ public class CompactEvent [ProtoMember(6)] public byte[] Sig { get; init; } = null!; - + [ProtoMember(7)] public long Kind { get; init; }