From 56568bdeed45296084d9d69b5c739161775d2ea5 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 27 Jun 2025 13:24:03 -0300 Subject: [PATCH] fix length checks from previous commit. --- event_easyjson.go | 6 +++--- filter_easyjson.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/event_easyjson.go b/event_easyjson.go index cb3d3fa..6284f67 100644 --- a/event_easyjson.go +++ b/event_easyjson.go @@ -28,12 +28,12 @@ func easyjsonDecodeEvent(in *jlexer.Lexer, out *Event) { switch key { case "id": b := in.UnsafeBytes() - if len(b) == 32 { + if len(b) == 64 { hex.Decode(out.ID[:], b) } case "pubkey": b := in.UnsafeBytes() - if len(b) == 32 { + if len(b) == 64 { hex.Decode(out.PubKey[:], b) } case "created_at": @@ -72,7 +72,7 @@ func easyjsonDecodeEvent(in *jlexer.Lexer, out *Event) { out.Content = in.String() case "sig": b := in.UnsafeBytes() - if len(b) == 64 { + if len(b) == 128 { hex.Decode(out.Sig[:], b) } } diff --git a/filter_easyjson.go b/filter_easyjson.go index df6e026..f9e7cc8 100644 --- a/filter_easyjson.go +++ b/filter_easyjson.go @@ -41,7 +41,7 @@ func easyjsonDecodeFilter(in *jlexer.Lexer, out *Filter) { for !in.IsDelim(']') { id := [32]byte{} b := in.UnsafeBytes() - if len(b) == 32 { + if len(b) == 64 { hex.Decode(id[:], b) } out.IDs = append(out.IDs, id) @@ -78,7 +78,7 @@ func easyjsonDecodeFilter(in *jlexer.Lexer, out *Filter) { for !in.IsDelim(']') { pk := [32]byte{} b := in.UnsafeBytes() - if len(b) == 32 { + if len(b) == 64 { hex.Decode(pk[:], b) } out.Authors = append(out.Authors, pk)