relayer
relayer copied to clipboard
Change accept event return type
Currently the onAccept event returns a Boolean. What about changing it type to error or some new type. This could help implement nip20.
Maybe creating a new type "Command result" will be more correct. If u agree I can do it.
Let me do it myself, I'll look at this better.
Well, if u need help with something just assign me some issues and I will try when have time available 👌
I just came across this issue after opening a PR: https://github.com/fiatjaf/relayer/pull/13
I see that there are still a few places in handlers.go
where we return a message via s.WriteJSON([]interface{}{"OK", evt.ID, false,
... perhaps I should refactor that code (within my PR) to return that custom error in CheckSignature
and DeleteEvent
(somewhere else?) and handle it similarly as I handle it here.
Note that I'm not programming in go often so if my code it shit and this should be done differently, let me know on my PR.
Ah, I see that CheckSignature
and DeleteEvent
are func in nbd-wtf
lib. Would it make sense to move the errors.go
code from this PR into nbd-wtf
?
How is going?
I am confused.
need help?
agreed that:
(r *Relay) AcceptEvent(*nostr.Event) bool
could be changed to
(r *Relay) AcceptEvent(*nostr.Event) error
in interfaces.go, to allow for better messaging of why the event was not accepted (e.g., duplicate event, too big, etc).