-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify common message handler traits into one trait #3594
base: main
Are you sure you want to change the base?
Unify common message handler traits into one trait #3594
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Unfortunately currently breaks RUSTFLAGS=--cfg=async_payments
7289b80
to
6562669
Compare
Oops, fixed. |
Unfortunately
|
6562669
to
3fcd949
Compare
Grr, I really need to fix the CI script so I can run it locally top-to-bottom :/ |
Gonna at least wait for #3575 and maybe one of the followups for it. Should be pretty straightforward to rebase this. |
Needs a rebase now that the dependent PR was merged |
Instead of having each `*MessageHandler` implement the same `peer_connected`, `peer_disconnected`, `provided_init_features`, and `provided_node_features` methods, here we pull them all out into one common trait and make all the message handlers extend it. Since `get_and_clear_pending_msg_events` was also common we also move that into the same trait, dropping the `MessageSendEventsProvider` trait. Best reviewed with `--color-moved`
`MessageSendEvent` got placed in the `events` module next to `Event` but it really doesn't make a whole lot of sense to be there (despite the superficially similar name). `MessageSendEvent`s aren't really "events" so much as simply queued messages, handled by the `PeerManager` rather than the user. Further, they're used entirely by structs implementing the traits in `ln::msgs` and basically define an enum over `ln::msgs` structs. Thus, it only really makes sense to have them in `ln::msgs`, which we do here.
3fcd949
to
d663e08
Compare
Rebased, I think we can land this now. |
Instead of having each
*MessageHandler
implement the samepeer_connected
,peer_disconnected
,provided_init_features
,and
provided_node_features
methods, here we pull them all outinto one common trait and make all the message handlers extend it.
Since
get_and_clear_pending_msg_events
was also common we alsomove that into the same trait, dropping the
MessageSendEventsProvider
trait.As requested by @tnull.