Skip to content

Commit ee124fa

Browse files
committed
f rename
1 parent a9c5301 commit ee124fa

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ use bitcoin::hashes::{HashEngine, Hash};
4242

4343
/// A dummy struct which implements `RoutingMessageHandler` without storing any routing information
4444
/// or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
45-
pub struct DummyRouteHandler{}
46-
impl MessageSendEventsProvider for DummyRouteHandler {
45+
struct IgnoringMessageHandler{}
46+
impl MessageSendEventsProvider for IgnoringMessageHandler {
4747
fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent> { Vec::new() }
4848
}
49-
impl RoutingMessageHandler for DummyRouteHandler {
49+
impl RoutingMessageHandler for IgnoringMessageHandler {
5050
fn handle_node_announcement(&self, _msg: &msgs::NodeAnnouncement) -> Result<bool, LightningError> { Ok(false) }
5151
fn handle_channel_announcement(&self, _msg: &msgs::ChannelAnnouncement) -> Result<bool, LightningError> { Ok(false) }
5252
fn handle_channel_update(&self, _msg: &msgs::ChannelUpdate) -> Result<bool, LightningError> { Ok(false) }
@@ -60,18 +60,18 @@ impl RoutingMessageHandler for DummyRouteHandler {
6060
fn handle_query_channel_range(&self, _their_node_id: &PublicKey, _msg: msgs::QueryChannelRange) -> Result<(), LightningError> { Ok(()) }
6161
fn handle_query_short_channel_ids(&self, _their_node_id: &PublicKey, _msg: msgs::QueryShortChannelIds) -> Result<(), LightningError> { Ok(()) }
6262
}
63-
impl Deref for DummyRouteHandler {
64-
type Target = DummyRouteHandler;
63+
impl Deref for IgnoringMessageHandler {
64+
type Target = IgnoringMessageHandler;
6565
fn deref(&self) -> &Self { self }
6666
}
6767

6868
/// A dummy struct which implements `ChannelMessageHandler` without having any channels.
6969
/// You can provide one of these as the route_handler in a MessageHandler.
70-
pub struct DummyChannelHandler {
70+
struct ErroringMessageHandler {
7171
message_queue: Mutex<Vec<MessageSendEvent>>
7272
}
73-
impl DummyChannelHandler {
74-
/// Constructs a new DummyChannelHandler
73+
impl ErroringMessageHandler {
74+
/// Constructs a new ErroringMessageHandler
7575
pub fn new() -> Self {
7676
Self { message_queue: Mutex::new(Vec::new()) }
7777
}
@@ -84,70 +84,70 @@ impl DummyChannelHandler {
8484
});
8585
}
8686
}
87-
impl MessageSendEventsProvider for DummyChannelHandler {
87+
impl MessageSendEventsProvider for ErroringMessageHandler {
8888
fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent> {
8989
let mut res = Vec::new();
9090
mem::swap(&mut res, &mut self.message_queue.lock().unwrap());
9191
res
9292
}
9393
}
94-
impl ChannelMessageHandler for DummyChannelHandler {
94+
impl ChannelMessageHandler for ErroringMessageHandler {
9595
// Any messages which are related to a specific channel generate an error message to let the
9696
// peer know we don't care about channels.
9797
fn handle_open_channel(&self, their_node_id: &PublicKey, _their_features: InitFeatures, msg: &msgs::OpenChannel) {
98-
DummyChannelHandler::push_error(self, their_node_id, msg.temporary_channel_id);
98+
ErroringMessageHandler::push_error(self, their_node_id, msg.temporary_channel_id);
9999
}
100100
fn handle_accept_channel(&self, their_node_id: &PublicKey, _their_features: InitFeatures, msg: &msgs::AcceptChannel) {
101-
DummyChannelHandler::push_error(self, their_node_id, msg.temporary_channel_id);
101+
ErroringMessageHandler::push_error(self, their_node_id, msg.temporary_channel_id);
102102
}
103103
fn handle_funding_created(&self, their_node_id: &PublicKey, msg: &msgs::FundingCreated) {
104-
DummyChannelHandler::push_error(self, their_node_id, msg.temporary_channel_id);
104+
ErroringMessageHandler::push_error(self, their_node_id, msg.temporary_channel_id);
105105
}
106106
fn handle_funding_signed(&self, their_node_id: &PublicKey, msg: &msgs::FundingSigned) {
107-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
107+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
108108
}
109109
fn handle_funding_locked(&self, their_node_id: &PublicKey, msg: &msgs::FundingLocked) {
110-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
110+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
111111
}
112112
fn handle_shutdown(&self, their_node_id: &PublicKey, _their_features: &InitFeatures, msg: &msgs::Shutdown) {
113-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
113+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
114114
}
115115
fn handle_closing_signed(&self, their_node_id: &PublicKey, msg: &msgs::ClosingSigned) {
116-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
116+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
117117
}
118118
fn handle_update_add_htlc(&self, their_node_id: &PublicKey, msg: &msgs::UpdateAddHTLC) {
119-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
119+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
120120
}
121121
fn handle_update_fulfill_htlc(&self, their_node_id: &PublicKey, msg: &msgs::UpdateFulfillHTLC) {
122-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
122+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
123123
}
124124
fn handle_update_fail_htlc(&self, their_node_id: &PublicKey, msg: &msgs::UpdateFailHTLC) {
125-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
125+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
126126
}
127127
fn handle_update_fail_malformed_htlc(&self, their_node_id: &PublicKey, msg: &msgs::UpdateFailMalformedHTLC) {
128-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
128+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
129129
}
130130
fn handle_commitment_signed(&self, their_node_id: &PublicKey, msg: &msgs::CommitmentSigned) {
131-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
131+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
132132
}
133133
fn handle_revoke_and_ack(&self, their_node_id: &PublicKey, msg: &msgs::RevokeAndACK) {
134-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
134+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
135135
}
136136
fn handle_update_fee(&self, their_node_id: &PublicKey, msg: &msgs::UpdateFee) {
137-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
137+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
138138
}
139139
fn handle_announcement_signatures(&self, their_node_id: &PublicKey, msg: &msgs::AnnouncementSignatures) {
140-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
140+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
141141
}
142142
fn handle_channel_reestablish(&self, their_node_id: &PublicKey, msg: &msgs::ChannelReestablish) {
143-
DummyChannelHandler::push_error(self, their_node_id, msg.channel_id);
143+
ErroringMessageHandler::push_error(self, their_node_id, msg.channel_id);
144144
}
145145
fn peer_disconnected(&self, _their_node_id: &PublicKey, _no_connection_possible: bool) {}
146146
fn peer_connected(&self, _their_node_id: &PublicKey, _msg: &msgs::Init) {}
147147
fn handle_error(&self, _their_node_id: &PublicKey, _msg: &msgs::ErrorMessage) {}
148148
}
149-
impl Deref for DummyChannelHandler {
150-
type Target = DummyChannelHandler;
149+
impl Deref for ErroringMessageHandler {
150+
type Target = ErroringMessageHandler;
151151
fn deref(&self) -> &Self { self }
152152
}
153153

@@ -156,10 +156,10 @@ pub struct MessageHandler<CM: Deref, RM: Deref> where
156156
CM::Target: ChannelMessageHandler,
157157
RM::Target: RoutingMessageHandler {
158158
/// A message handler which handles messages specific to channels. Usually this is just a
159-
/// ChannelManager object or a DummyChannelHandler.
159+
/// ChannelManager object or a ErroringMessageHandler.
160160
pub chan_handler: CM,
161161
/// A message handler which handles messages updating our knowledge of the network channel
162-
/// graph. Usually this is just a NetGraphMsgHandlerMonitor object or a DummyRouteHandler.
162+
/// graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
163163
pub route_handler: RM,
164164
}
165165

0 commit comments

Comments
 (0)