nbd-wtf/go-nostr

v0.17.0 can no longer post to wss://relay.damus.io

Closed this issue · 10 comments

It seems that the lib can no longer post to relay.damus.io when using commit: 0a3e898 or c42059f.

Event is simple (somewhat simplified for readability):

        ev := nostr.Event{
                PubKey:    n.public,
                CreatedAt: time.Now(),
                Kind:      nostr.KindTextNote,
                Tags:      nil,
                Content:   msg,
        }
        ev.Sign(n.private)
        result, err := r.Publish(ctx, ev)
        if err != nil {
                n.printf("publishing error %v: %v\n", r, err)
        }
        if result == nostr.PublishStatusFailed {
                n.printf("could not send: %v\n", r)
        }

This ends up traveling through nostr.PublishStatusFailed path like so: could not send: wss://relay.damus.io and the damus client does indeed not receive the message.

Running the same code (minus the time modifications required by v0.17.0) works fine.

Was hoping someone would know what is up before I spend a bunch of time digging through the code.

Did you try on 0.18.10?

Yep, it is where I started. Went from 0.16.0 to latest and worked my way back until it worked again.

go.mod excerpt

        ...
        github.com/nbd-wtf/go-nostr v0.18.10
        ...

Output from my client using the lib:

> /post this is a test
could not send: wss://nostr.wine
could not send: wss://nos.lol
could not send: wss://relay.snort.social
could not send: wss://relay.current.fyi
could not send: wss://relay.damus.io

I just published this with https://github.com/fiatjaf/nak (which is using v0.18.7):

2023-06-13-092626_609x132_scrot

You are missing the tags.

Will add a clearer error for this case.

This works. I do have one more question, did I misunderstand the NIP that tags for kind 1 are optional?

Optional means they are an empty array.

Wouldn't it then not make more sense to define tags as an array instead of a pointer?

Arrays are pointers in Go.