fixes and tweaks from nak port work.

This commit is contained in:
fiatjaf
2025-04-21 08:35:19 -03:00
parent ee2d618285
commit 3d595039cc
10 changed files with 34 additions and 19 deletions

View File

@@ -39,8 +39,8 @@ func (rl *Relay) handleRequest(ctx context.Context, id string, eose *sync.WaitGr
func (rl *Relay) handleCountRequest(ctx context.Context, ws *WebSocket, filter nostr.Filter) uint32 {
// check if we'll reject this filter
if nil != rl.OnCountFilter {
if rejecting, msg := rl.OnCountFilter(ctx, filter); rejecting {
if nil != rl.OnCount {
if rejecting, msg := rl.OnCount(ctx, filter); rejecting {
ws.WriteJSON(nostr.NoticeEnvelope(msg))
return 0
}
@@ -65,8 +65,8 @@ func (rl *Relay) handleCountRequestWithHLL(
offset int,
) (uint32, *hyperloglog.HyperLogLog) {
// check if we'll reject this filter
if nil != rl.OnCountFilter {
if rejecting, msg := rl.OnCountFilter(ctx, filter); rejecting {
if nil != rl.OnCount {
if rejecting, msg := rl.OnCount(ctx, filter); rejecting {
ws.WriteJSON(nostr.NoticeEnvelope(msg))
return 0, nil
}