Fix binary tag value handling for e/p tags across database layer
Some checks failed
Go / build-and-release (push) Has been cancelled

- Update nostr library to v1.0.3 with improved binary tag support
- Replace tag.Value() calls with tag.ValueHex() to handle both binary and hex formats
- Add NormalizeTagValueForHash() for consistent filter tag normalization
- Update QueryPTagGraph to handle binary-encoded and hex-encoded pubkeys
- Fix tag matching in query-events.go using TagValuesMatchUsingTagMethods
- Add filter_utils.go with tag normalization helper functions
- Update delete operations in process-delete.go and neo4j/delete.go
- Fix ACL follows extraction to use ValueHex() for consistent decoding
- Add binary_tag_filter_test.go for testing tag value normalization
- Bump version to v0.30.3
This commit is contained in:
2025-11-26 21:16:46 +00:00
parent fad39ec201
commit 1810c8bef3
14 changed files with 801 additions and 63 deletions

View File

@@ -214,10 +214,11 @@ func (d *D) SaveEvent(c context.Context, ev *event.E) (
// Extract p-tag pubkeys using GetAll
pTags := ev.Tags.GetAll([]byte("p"))
for _, pTag := range pTags {
if len(pTag.T) >= 2 {
// Decode hex pubkey from p-tag
if pTag.Len() >= 2 {
// Get pubkey from p-tag, handling both binary and hex storage formats
// ValueHex() returns hex regardless of internal storage format
var ptagPubkey []byte
if ptagPubkey, err = hex.Dec(string(pTag.T[tag.Value])); err == nil && len(ptagPubkey) == 32 {
if ptagPubkey, err = hex.Dec(string(pTag.ValueHex())); err == nil && len(ptagPubkey) == 32 {
pkHex := hex.Enc(ptagPubkey)
// Skip if already added as author
if _, exists := pubkeysForGraph[pkHex]; !exists {