From fadb26875202c18cdd8fb1bd6eaf3f965a95a314 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 10 May 2024 21:28:50 +0000 Subject: [PATCH] Drop `EventsProvider` bounds on `OnionMessageHandler`s This never really made a lot of sense from an API perspective, but was required to avoid handing the background processor an explicit `OnionMessegner`, which we are now doing. Thus, we can simply drop these bounds as unnecessary. --- lightning/src/ln/msgs.rs | 4 ++-- lightning/src/ln/peer_handler.rs | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 87e8a814d..7a6ba09c2 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -52,7 +52,7 @@ use core::fmt::Display; use crate::io::{self, Cursor, Read}; use crate::io_extras::read_to_end; -use crate::events::{EventsProvider, MessageSendEventsProvider}; +use crate::events::MessageSendEventsProvider; use crate::crypto::streams::ChaChaPolyReadAdapter; use crate::util::logger; use crate::util::ser::{LengthReadable, LengthReadableArgs, Readable, ReadableArgs, Writeable, Writer, WithoutLength, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname, TransactionU16LenLimited, BigSize}; @@ -1623,7 +1623,7 @@ pub trait RoutingMessageHandler : MessageSendEventsProvider { } /// A handler for received [`OnionMessage`]s and for providing generated ones to send. -pub trait OnionMessageHandler: EventsProvider { +pub trait OnionMessageHandler { /// Handle an incoming `onion_message` message from the given peer. fn handle_onion_message(&self, peer_node_id: &PublicKey, msg: &OnionMessage); diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index f31a8e131..81b5c8a5c 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -19,7 +19,7 @@ use bitcoin::blockdata::constants::ChainHash; use bitcoin::secp256k1::{self, Secp256k1, SecretKey, PublicKey}; use crate::sign::{NodeSigner, Recipient}; -use crate::events::{EventHandler, EventsProvider, MessageSendEvent, MessageSendEventsProvider}; +use crate::events::{MessageSendEvent, MessageSendEventsProvider}; use crate::ln::types::ChannelId; use crate::ln::features::{InitFeatures, NodeFeatures}; use crate::ln::msgs; @@ -97,9 +97,6 @@ pub trait CustomMessageHandler: wire::CustomMessageReader { /// A dummy struct which implements `RoutingMessageHandler` without storing any routing information /// or doing any processing. You can provide one of these as the route_handler in a MessageHandler. pub struct IgnoringMessageHandler{} -impl EventsProvider for IgnoringMessageHandler { - fn process_pending_events(&self, _handler: H) where H::Target: EventHandler {} -} impl MessageSendEventsProvider for IgnoringMessageHandler { fn get_and_clear_pending_msg_events(&self) -> Vec { Vec::new() } } @@ -723,8 +720,6 @@ pub trait APeerManager { type NS: Deref; /// Gets a reference to the underlying [`PeerManager`]. fn as_ref(&self) -> &PeerManager; - /// Returns the peer manager's [`OnionMessageHandler`]. - fn onion_message_handler(&self) -> &Self::OMT; } impl @@ -750,9 +745,6 @@ APeerManager for PeerManager where type NST = ::Target; type NS = NS; fn as_ref(&self) -> &PeerManager { self } - fn onion_message_handler(&self) -> &Self::OMT { - self.message_handler.onion_message_handler.deref() - } } /// A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls -- 2.39.5