Add support for option_onion_messages_only_channels - #3342
Conversation
We now configure our onion message relay policy based on features that we activate (either `option_onion_messages_only_channels` when relaying only from peers with whom we have a channel or `option_onion_messages` when relaying from all peers). In all cases, we still apply rate limits. Fixes #3335
| case OnionMessages.DropMessage(reason) => | ||
| log.info("dropping message from {}: {}", remoteNodeId.value.toHex, reason.toString) | ||
| case OnionMessages.SendMessage(nextNode, message) if nodeParams.features.hasFeature(Features.OnionMessages) => | ||
| case OnionMessages.SendMessage(nextNode, message) if nodeParams.features.hasFeature(Features.OnionMessages) || nodeParams.features.hasFeature(Features.OnionMessagesChannelsOnly) => |
There was a problem hiding this comment.
Where do we check that we indeed have channels with that peer in the `Features.OnionMessagesChannelsOnly case?
There was a problem hiding this comment.
It is done inside MessageRelay itself (see waitForPreviousPeerForPolicyCheck and waitForNextPeerForPolicyCheck). To be honest, the whole message relay stack is a mess (it involves way too many tiny actors speaking to each other) and would benefit from a larger refactoring, at which point it probably would make more sense to verify whether we have a channel directly inside the Peer actor (by checking activeChannels for example). But I didn't want to embark on this refactoring right now 😅 , I just wanted to make sure that we supported that feature bit since it will be used by lnd and ldk soon.
| case "channels-only" => RelayChannelsOnly | ||
| case "relay-all" => RelayAll | ||
| } | ||
| val onionMessageRelayPolicy = if (features.hasFeature(Features.OnionMessages)) RelayAll else RelayChannelsOnly |
There was a problem hiding this comment.
why is Features.OnionMessagesChannelsOnly not checked here ?
We now configure our onion message relay policy based on features that we activate (either
option_onion_messages_only_channelswhen relaying only from peers with whom we have a channel oroption_onion_messageswhen relaying from all peers). In all cases, we still apply rate limits.Fixes #3335