Skip to content

Commit 74828d2

Browse files
committed
Separate ChannelAnnouncement and ChannelUpdate broadcast conditions
When a `ChannelUpdate` message is generated for broadcast as a part of a `BroadcastChannelAnnouncement` event, it may be newer than our previous `ChannelUpdate` and need to be broadcast. However, if the `ChannelAnnouncement` had already been seen we wouldn't re-broadcast either message as the `handle_channel_announcement` call would fail, short-circuiting the condition to broadcast both. Instead, we split the broadcast of each message as well as the conditional so that we always attempt to handle each message and update our local graph state, then broadcast the message if its update was processed successfully.
1 parent ef86a3e commit 74828d2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
13511351
},
13521352
MessageSendEvent::BroadcastChannelAnnouncement { msg, update_msg } => {
13531353
log_debug!(self.logger, "Handling BroadcastChannelAnnouncement event in peer_handler for short channel id {}", msg.contents.short_channel_id);
1354-
if self.message_handler.route_handler.handle_channel_announcement(&msg).is_ok() && self.message_handler.route_handler.handle_channel_update(&update_msg).is_ok() {
1354+
if self.message_handler.route_handler.handle_channel_announcement(&msg).is_ok() {
13551355
self.forward_broadcast_msg(peers, &wire::Message::ChannelAnnouncement(msg), None);
1356+
}
1357+
if self.message_handler.route_handler.handle_channel_update(&update_msg).is_ok() {
13561358
self.forward_broadcast_msg(peers, &wire::Message::ChannelUpdate(update_msg), None);
13571359
}
13581360
},

0 commit comments

Comments
 (0)