Skip to content

Add support for option_onion_messages_only_channels - #3342

Open
t-bast wants to merge 1 commit into
masterfrom
onion-messages-only-channels
Open

Add support for option_onion_messages_only_channels#3342
t-bast wants to merge 1 commit into
masterfrom
onion-messages-only-channels

Conversation

@t-bast

@t-bast t-bast commented Aug 6, 2026

Copy link
Copy Markdown
Member

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

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
@t-bast
t-bast requested review from pm47 and sstone August 6, 2026 11:53
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) =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we check that we indeed have channels with that peer in the `Features.OnionMessagesChannelsOnly case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is Features.OnionMessagesChannelsOnly not checked here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for option_onion_messages_only_channels (feature 66/67)

3 participants