futr icon indicating copy to clipboard operation
futr copied to clipboard

Outbox read relays are not used for DMs

Open dtonon opened this issue 1 year ago • 5 comments

I sent a message to myself with a test account, and it's only delivered to the "preferred relay" I set up for this test account, it has not been delivered to my read relays. Without some more info for the profile, I cannot check if the app is actually fetching my correct NIP-65 list.

dtonon avatar Feb 18 '25 10:02 dtonon

probably related to https://github.com/futrnostr/futr/issues/92

prolic avatar Feb 20 '25 19:02 prolic

@dtonon I have a question about this:

NIP-17 states: "It's advisable that relays do not serve kind:1059 to clients other than the ones tagged in them. It's advisable that users choose relays that conform to these practices."

I have read this as "only send to my own preferred dm relays and the receivers preferred dm relays". why would I want to have this on any public outbox relay? Most of those are not auth relays.

prolic avatar Feb 20 '25 20:02 prolic

You are right, sorry, I was thinking about kind:10050 events, not kid:10002 ones. The problem is the same, it seems that Futr does not deliver to the recipient DMs relays, but only to the sender preferred relays.

dtonon avatar Feb 20 '25 21:02 dtonon

I'll verify this, thanks

On Thu, Feb 20, 2025, 18:14 daniele @.***> wrote:

You are right, sorry, I was thinking about kind:10050 events, not kid:10002 ones. The problem is the same, it seems that Futr does not deliver to the recipient DMs relays, but only to the sender preferred relays.

— Reply to this email directly, view it on GitHub https://github.com/futrnostr/futr/issues/80#issuecomment-2672698090, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADAJPA3MJE5AHKPH7WYFD32QZAUXAVCNFSM6AAAAABXLH4LLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSGY4TQMBZGA . You are receiving this because you commented.Message ID: @.***> [image: dtonon]dtonon left a comment (futrnostr/futr#80) https://github.com/futrnostr/futr/issues/80#issuecomment-2672698090

You are right, sorry, I was thinking about kind:10050 events, not kid:10002 ones. The problem is the same, it seems that Futr does not deliver to the recipient DMs relays, but only to the sender preferred relays.

— Reply to this email directly, view it on GitHub https://github.com/futrnostr/futr/issues/80#issuecomment-2672698090, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADAJPA3MJE5AHKPH7WYFD32QZAUXAVCNFSM6AAAAABXLH4LLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZSGY4TQMBZGA . You are receiving this because you commented.Message ID: @.***>

prolic avatar Feb 20 '25 21:02 prolic

Code wise:

    PublishGiftWrap event' senderPk recipientPk -> do
        void $ putEvent $ EventWithRelays event' Set.empty
        dmRelayList <- getDMRelays senderPk
        recipientDMRelays <- getDMRelays recipientPk

        if null dmRelayList || null recipientDMRelays
            then pure ()
            else do
                let allRelayURIs = nub $ dmRelayList ++ recipientDMRelays

                modify $ \st -> st
                    { publishStatus = Map.insert
                        (eventId event')
                        (Map.fromList [(relay, Publishing) | relay <- allRelayURIs])
                        (publishStatus st)
                    }

                existingConnections <- getConnectedRelays
                let (existingRelays, newRelays) = partition 
                        (`elem` existingConnections) 
                        allRelayURIs

                forM_ existingRelays $ \r -> writeToChannel event' r
                forM_ newRelays $ \r -> async $ do
                    connected <- connect r
                    if connected
                        then do
                            writeToChannel event' r
                            disconnect r
                        else do
                            modify $ \st' -> st'
                                { publishStatus = Map.adjust
                                    (Map.insert r (Failure "Relay server unreachable"))
                                    (eventId event')
                                    (publishStatus st')
                                }

I see it sending to all relays. I just added publish status UI for sent events, maybe this helps debugging what's going wrong.

prolic avatar Feb 21 '25 00:02 prolic

Works fine on v0.3.0, feel free to reopen if the issue persists.

prolic avatar May 29 '25 00:05 prolic