handle kind 4-45 and kind2

This commit is contained in:
0ceanSlim 2024-07-24 16:54:11 -04:00
parent 990e47eb2b
commit 231fdc6aa9
2 changed files with 18 additions and 0 deletions

View File

@ -57,8 +57,14 @@ func HandleKind(ctx context.Context, evt relay.Event, ws *websocket.Conn) {
err = kinds.HandleKind0(ctx, evt, collection, ws)
case evt.Kind == 1:
err = kinds.HandleKind1(ctx, evt, collection)
case evt.Kind == 2:
err = kinds.HandleKind2Deprecated(ctx, evt, ws)
case evt.Kind == 3:
err = kinds.HandleReplaceableKind(ctx, evt, collection, ws)
case evt.Kind >= 4 && evt.Kind < 45:
err = kinds.HandleRegularKind(ctx, evt, collection)
case evt.Kind >= 1000 && evt.Kind < 10000:
err = kinds.HandleRegularKind(ctx, evt, collection)
case evt.Kind >= 10000 && evt.Kind < 20000:
err = kinds.HandleReplaceableKind(ctx, evt, collection, ws)
case evt.Kind >= 20000 && evt.Kind < 30000:

12
relay/kinds/kind2.go Normal file
View File

@ -0,0 +1,12 @@
package kinds
import (
"context"
relay "grain/relay/types"
"golang.org/x/net/websocket"
)
func HandleKind2Deprecated(ctx context.Context, evt relay.Event, ws *websocket.Conn) error {
sendNotice(ws, evt.PubKey, "kind 2 is deprecated, event not accepted to the relay, please use kind 10002 as defined in NIP-65")
return nil
}