new event policy

This commit is contained in:
pippellia-btc
2025-07-21 18:26:30 +02:00
parent 9008982a34
commit f84c46fc1f
2 changed files with 21 additions and 8 deletions

View File

@@ -232,16 +232,11 @@ func updateWalks(ctx context.Context, db redb.RedisDB, cache *walks.CachedWalker
return nil
}
const (
followPrefix = "p"
maxFollows = 50000
)
// Parse unique pubkeys (excluding author) from the "p" tags in the event.
func ParsePubkeys(event *nostr.Event) []string {
pubkeys := make([]string, 0, min(len(event.Tags), maxFollows))
pubkeys := make([]string, 0, min(len(event.Tags), maxTags))
for _, tag := range event.Tags {
if len(pubkeys) > maxFollows {
if len(pubkeys) > maxTags {
// stop processing, list is too big
break
}
@@ -251,7 +246,7 @@ func ParsePubkeys(event *nostr.Event) []string {
}
prefix, pubkey := tag[0], tag[1]
if prefix != followPrefix {
if prefix != "p" {
continue
}