Introduce SendOnlyMessageHandler trait#3922
Merged
tnull merged 1 commit intolightningdevkit:mainfrom Jul 11, 2025
Merged
Conversation
|
I've assigned @joostjager as a reviewer! |
joostjager
reviewed
Jul 10, 2025
Contributor
joostjager
left a comment
There was a problem hiding this comment.
Not much to comment on here.
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
joostjager
reviewed
Jul 10, 2025
Previously, we introduced a new `send_only_message_handler: BaseMessageHandler` field to `MessageHandler`, which we expect to only ever be implemented by `ChainMonitor`. However, given that more objects implement `BaseMessageHandler`, the API allowed to plugin different objects, such as `ChannelManager`, resulting in unexpected behavior. Here, we resolve this by introducing a new super trait `SendOnlyMessageHandler` that is only implemented by `ChainMonitor`.
3da1368 to
1e99cdb
Compare
Contributor
Author
|
Force-pushed the following fixup: > git diff-tree -U2 3da136849 1e99cdbdd
diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs
index 8a7febe4c..da5cdf7c9 100644
--- a/lightning/src/ln/msgs.rs
+++ b/lightning/src/ln/msgs.rs
@@ -2180,5 +2180,5 @@ pub trait OnionMessageHandler: BaseMessageHandler {
/// A handler which can only be used to send messages.
///
-/// This is mostly implemented by [`ChainMonitor`].
+/// This is implemented by [`ChainMonitor`].
///
/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor |
joostjager
approved these changes
Jul 10, 2025
Contributor
Author
|
Given we recently decided to more often merge with 1 review for simple changes, I'm going to land this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, we introduced a new
send_only_message_handler: BaseMessageHandlerfield toMessageHandler, which we expect to only ever be implemented byChainMonitor.However, given that more objects implement
BaseMessageHandler, the API allowed to plugin different objects, such asChannelManager, resulting in unexpected behavior.Here, we resolve this by introducing a new super trait
SendOnlyMessageHandlerthat is only implemented byChainMonitor.(cc @adi2011)