Skip to content

Commit 2c8e001

Browse files
committed
Include both node_ids in BroadcastChannelUpdate
Sadly, the lightning gossip protocol operates by always flooding peers with all the latest gossip they receive. For nodes with many peers, this can result in lots of duplicative gossip as they receive every message from every peer. As a results, some lightning implementations disable gossip with new peers after some threshold. This should mostly work as these peers expect to receive the latest gossip from their many other peers. However, in some cases an LDK node may wish to open public channels but only has a single connection to the bulk of the rest of the network - with one such peer which requests that it not receive any gossip. In that case, LDK would dutifully never send any gossip to its only connection to the outside world. We would still send gossip for channels with that peer as it would be sent as unicast gossip, but if we then open another connection to another peer which doesn't have any connection to the outside world any information on that channel wouldn't propagate. We've seen this setup on some LSPs, where they have a public node and then an LSP which only connects through that public node, but expects to open public channels to its LSP clients. In a coming commit we'll start forwarding such gossip to all peers by ignoring peer gossip limitations about all of our own channels. While other gossip has the `node_id`s of both sides of the channel explicitly in the message, `ChannelUpdate`s do not, so here we add the `node_id`s to `BroadcastChannelUpdate` giving us the information we need when we go to broadcast updates.
1 parent e42e74e commit 2c8e001

File tree

10 files changed

+77
-46
lines changed

10 files changed

+77
-46
lines changed

lightning/src/ln/channel_open_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,7 @@ pub fn test_funding_and_commitment_tx_confirm_same_block() {
23372337
} else {
23382338
panic!();
23392339
}
2340-
if let MessageSendEvent::BroadcastChannelUpdate { ref msg } = msg_events.remove(0) {
2340+
if let MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } = msg_events.remove(0) {
23412341
assert_eq!(msg.contents.channel_flags & 2, 2);
23422342
} else {
23432343
panic!();

lightning/src/ln/channelmanager.rs

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ use crate::onion_message::messenger::{
111111
MessageRouter, MessageSendInstructions, Responder, ResponseInstruction,
112112
};
113113
use crate::onion_message::offers::{OffersMessage, OffersMessageHandler};
114+
use crate::routing::gossip::NodeId;
114115
use crate::routing::router::{
115116
BlindedTail, FixedRouter, InFlightHtlcs, Path, Payee, PaymentParameters, Route,
116117
RouteParameters, RouteParametersConfig, Router,
@@ -942,7 +943,7 @@ impl Into<LocalHTLCFailureReason> for FailureCode {
942943
struct MsgHandleErrInternal {
943944
err: msgs::LightningError,
944945
closes_channel: bool,
945-
shutdown_finish: Option<(ShutdownResult, Option<msgs::ChannelUpdate>)>,
946+
shutdown_finish: Option<(ShutdownResult, Option<(msgs::ChannelUpdate, NodeId, NodeId)>)>,
946947
tx_abort: Option<msgs::TxAbort>,
947948
}
948949
impl MsgHandleErrInternal {
@@ -966,7 +967,7 @@ impl MsgHandleErrInternal {
966967

967968
fn from_finish_shutdown(
968969
err: String, channel_id: ChannelId, shutdown_res: ShutdownResult,
969-
channel_update: Option<msgs::ChannelUpdate>,
970+
channel_update: Option<(msgs::ChannelUpdate, NodeId, NodeId)>,
970971
) -> Self {
971972
let err_msg = msgs::ErrorMessage { channel_id, data: err.clone() };
972973
let action = if shutdown_res.monitor_update.is_some() {
@@ -3244,10 +3245,10 @@ macro_rules! handle_error {
32443245
log_error!(logger, "Closing channel: {}", err.err);
32453246

32463247
$self.finish_close_channel(shutdown_res);
3247-
if let Some(update) = update_option {
3248+
if let Some((update, node_id_1, node_id_2)) = update_option {
32483249
let mut pending_broadcast_messages = $self.pending_broadcast_messages.lock().unwrap();
32493250
pending_broadcast_messages.push(MessageSendEvent::BroadcastChannelUpdate {
3250-
msg: update
3251+
msg: update, node_id_1, node_id_2
32513252
});
32523253
}
32533254
} else {
@@ -3574,7 +3575,7 @@ macro_rules! handle_monitor_update_completion {
35743575
// channel_update later through the announcement_signatures process for public
35753576
// channels, but there's no reason not to just inform our counterparty of our fees
35763577
// now.
3577-
if let Ok(msg) = $self.get_channel_update_for_unicast($chan) {
3578+
if let Ok((msg, _, _)) = $self.get_channel_update_for_unicast($chan) {
35783579
Some(MessageSendEvent::SendChannelUpdate {
35793580
node_id: counterparty_node_id,
35803581
msg,
@@ -5137,7 +5138,7 @@ where
51375138
/// [`internal_closing_signed`]: Self::internal_closing_signed
51385139
fn get_channel_update_for_broadcast(
51395140
&self, chan: &FundedChannel<SP>,
5140-
) -> Result<msgs::ChannelUpdate, LightningError> {
5141+
) -> Result<(msgs::ChannelUpdate, NodeId, NodeId), LightningError> {
51415142
if !chan.context.should_announce() {
51425143
return Err(LightningError {
51435144
err: "Cannot broadcast a channel_update for a private channel".to_owned(),
@@ -5171,7 +5172,9 @@ where
51715172
/// [`channel_update`]: msgs::ChannelUpdate
51725173
/// [`internal_closing_signed`]: Self::internal_closing_signed
51735174
#[rustfmt::skip]
5174-
fn get_channel_update_for_unicast(&self, chan: &FundedChannel<SP>) -> Result<msgs::ChannelUpdate, LightningError> {
5175+
fn get_channel_update_for_unicast(
5176+
&self, chan: &FundedChannel<SP>,
5177+
) -> Result<(msgs::ChannelUpdate, NodeId, NodeId), LightningError> {
51755178
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
51765179
log_trace!(logger, "Attempting to generate channel update for channel {}", chan.context.channel_id());
51775180
let short_channel_id = match chan.funding.get_short_channel_id().or(chan.context.latest_inbound_scid_alias()) {
@@ -5181,7 +5184,9 @@ where
51815184

51825185
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
51835186
log_trace!(logger, "Generating channel update for channel {}", chan.context.channel_id());
5184-
let were_node_one = self.our_network_pubkey.serialize()[..] < chan.context.get_counterparty_node_id().serialize()[..];
5187+
let our_node_id = NodeId::from_pubkey(&self.our_network_pubkey);
5188+
let their_node_id = NodeId::from_pubkey(&chan.context.get_counterparty_node_id());
5189+
let were_node_one = our_node_id < their_node_id;
51855190
let enabled = chan.context.is_enabled();
51865191

51875192
let unsigned = msgs::UnsignedChannelUpdate {
@@ -5203,10 +5208,14 @@ where
52035208
// channel.
52045209
let sig = self.node_signer.sign_gossip_message(msgs::UnsignedGossipMessage::ChannelUpdate(&unsigned)).unwrap();
52055210

5206-
Ok(msgs::ChannelUpdate {
5207-
signature: sig,
5208-
contents: unsigned
5209-
})
5211+
Ok((
5212+
msgs::ChannelUpdate {
5213+
signature: sig,
5214+
contents: unsigned
5215+
},
5216+
if were_node_one { our_node_id } else { their_node_id },
5217+
if were_node_one { their_node_id } else { our_node_id },
5218+
))
52105219
}
52115220

52125221
#[cfg(any(test, feature = "_externalize_tests"))]
@@ -6649,11 +6658,11 @@ where
66496658
continue;
66506659
}
66516660
if let Some(channel) = channel.as_funded() {
6652-
if let Ok(msg) = self.get_channel_update_for_broadcast(channel) {
6661+
if let Ok((msg, node_id_1, node_id_2)) = self.get_channel_update_for_broadcast(channel) {
66536662
let mut pending_broadcast_messages = self.pending_broadcast_messages.lock().unwrap();
6654-
pending_broadcast_messages.push(MessageSendEvent::BroadcastChannelUpdate { msg });
6663+
pending_broadcast_messages.push(MessageSendEvent::BroadcastChannelUpdate { msg, node_id_1, node_id_2 });
66556664
} else if peer_state.is_connected {
6656-
if let Ok(msg) = self.get_channel_update_for_unicast(channel) {
6665+
if let Ok((msg, _, _)) = self.get_channel_update_for_unicast(channel) {
66576666
peer_state.pending_msg_events.push(MessageSendEvent::SendChannelUpdate {
66586667
node_id: channel.context.get_counterparty_node_id(),
66596668
msg,
@@ -8177,10 +8186,10 @@ where
81778186
n += 1;
81788187
if n >= DISABLE_GOSSIP_TICKS {
81798188
funded_chan.set_channel_update_status(ChannelUpdateStatus::Disabled);
8180-
if let Ok(update) = self.get_channel_update_for_broadcast(&funded_chan) {
8189+
if let Ok((update, node_id_1, node_id_2)) = self.get_channel_update_for_broadcast(&funded_chan) {
81818190
let mut pending_broadcast_messages = self.pending_broadcast_messages.lock().unwrap();
81828191
pending_broadcast_messages.push(MessageSendEvent::BroadcastChannelUpdate {
8183-
msg: update
8192+
msg: update, node_id_1, node_id_2
81848193
});
81858194
}
81868195
should_persist = NotifyOption::DoPersist;
@@ -8192,10 +8201,10 @@ where
81928201
n += 1;
81938202
if n >= ENABLE_GOSSIP_TICKS {
81948203
funded_chan.set_channel_update_status(ChannelUpdateStatus::Enabled);
8195-
if let Ok(update) = self.get_channel_update_for_broadcast(&funded_chan) {
8204+
if let Ok((update, node_id_1, node_id_2)) = self.get_channel_update_for_broadcast(&funded_chan) {
81968205
let mut pending_broadcast_messages = self.pending_broadcast_messages.lock().unwrap();
81978206
pending_broadcast_messages.push(MessageSendEvent::BroadcastChannelUpdate {
8198-
msg: update
8207+
msg: update, node_id_1, node_id_2
81998208
});
82008209
}
82018210
should_persist = NotifyOption::DoPersist;
@@ -10821,7 +10830,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1082110830
// channel_update here if the channel is not public, i.e. we're not sending an
1082210831
// announcement_signatures.
1082310832
log_trace!(logger, "Sending private initial channel_update for our counterparty on channel {}", chan.context.channel_id());
10824-
if let Ok(msg) = self.get_channel_update_for_unicast(chan) {
10833+
if let Ok((msg, _, _)) = self.get_channel_update_for_unicast(chan) {
1082510834
peer_state.pending_msg_events.push(MessageSendEvent::SendChannelUpdate {
1082610835
node_id: counterparty_node_id.clone(),
1082710836
msg,
@@ -11620,7 +11629,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1162011629
msg: try_channel_entry!(self, peer_state, res, chan_entry),
1162111630
// Note that announcement_signatures fails if the channel cannot be announced,
1162211631
// so get_channel_update_for_broadcast will never fail by the time we get here.
11623-
update_msg: Some(self.get_channel_update_for_broadcast(chan).unwrap()),
11632+
update_msg: Some(self.get_channel_update_for_broadcast(chan).unwrap().0),
1162411633
});
1162511634
} else {
1162611635
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
@@ -11729,7 +11738,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1172911738
// If the channel is in a usable state (ie the channel is not being shut
1173011739
// down), send a unicast channel_update to our counterparty to make sure
1173111740
// they have the latest channel parameters.
11732-
if let Ok(msg) = self.get_channel_update_for_unicast(chan) {
11741+
if let Ok((msg, _, _)) = self.get_channel_update_for_unicast(chan) {
1173311742
channel_update = Some(MessageSendEvent::SendChannelUpdate {
1173411743
node_id: chan.context.get_counterparty_node_id(),
1173511744
msg,
@@ -14340,7 +14349,7 @@ where
1434014349
send_channel_ready!(self, pending_msg_events, funded_channel, channel_ready);
1434114350
if funded_channel.context.is_usable() && peer_state.is_connected {
1434214351
log_trace!(logger, "Sending channel_ready with private initial channel_update for our counterparty on channel {}", channel_id);
14343-
if let Ok(msg) = self.get_channel_update_for_unicast(funded_channel) {
14352+
if let Ok((msg, _, _)) = self.get_channel_update_for_unicast(funded_channel) {
1434414353
pending_msg_events.push(MessageSendEvent::SendChannelUpdate {
1434514354
node_id: funded_channel.context.get_counterparty_node_id(),
1434614355
msg,
@@ -14433,7 +14442,7 @@ where
1443314442
// if the channel cannot be announced, so
1443414443
// get_channel_update_for_broadcast will never fail
1443514444
// by the time we get here.
14436-
update_msg: Some(self.get_channel_update_for_broadcast(funded_channel).unwrap()),
14445+
update_msg: Some(self.get_channel_update_for_broadcast(funded_channel).unwrap().0),
1443714446
});
1443814447
}
1443914448
}

lightning/src/ln/functional_test_utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ macro_rules! get_closing_signed_broadcast {
21822182
assert!(events.len() == 1 || events.len() == 2);
21832183
(
21842184
match events[events.len() - 1] {
2185-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
2185+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
21862186
assert_eq!(msg.contents.channel_flags & 2, 2);
21872187
msg.clone()
21882188
},
@@ -2253,7 +2253,7 @@ pub fn check_closed_broadcast(
22532253
.into_iter()
22542254
.filter_map(|msg_event| {
22552255
match msg_event {
2256-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
2256+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
22572257
assert_eq!(msg.contents.channel_flags & 2, 2);
22582258
None
22592259
},
@@ -4875,7 +4875,7 @@ pub fn handle_announce_close_broadcast_events<'a, 'b, 'c>(
48754875
let events_1 = nodes[a].node.get_and_clear_pending_msg_events();
48764876
assert_eq!(events_1.len(), 2);
48774877
let as_update = match events_1[1] {
4878-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => msg.clone(),
4878+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => msg.clone(),
48794879
_ => panic!("Unexpected event"),
48804880
};
48814881
match events_1[0] {
@@ -4912,7 +4912,7 @@ pub fn handle_announce_close_broadcast_events<'a, 'b, 'c>(
49124912
let events_2 = nodes[b].node.get_and_clear_pending_msg_events();
49134913
assert_eq!(events_2.len(), if needs_err_handle { 1 } else { 2 });
49144914
let bs_update = match events_2.last().unwrap() {
4915-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => msg.clone(),
4915+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => msg.clone(),
49164916
_ => panic!("Unexpected event"),
49174917
};
49184918
if !needs_err_handle {

lightning/src/ln/functional_tests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ pub fn channel_monitor_network_test() {
717717
let events = nodes[3].node.get_and_clear_pending_msg_events();
718718
assert_eq!(events.len(), 2);
719719
let close_chan_update_1 = match events[1] {
720-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => msg.clone(),
720+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => msg.clone(),
721721
_ => panic!("Unexpected event"),
722722
};
723723
match events[0] {
@@ -752,7 +752,7 @@ pub fn channel_monitor_network_test() {
752752
let events = nodes[4].node.get_and_clear_pending_msg_events();
753753
assert_eq!(events.len(), 2);
754754
let close_chan_update_2 = match events[1] {
755-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => msg.clone(),
755+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => msg.clone(),
756756
_ => panic!("Unexpected event"),
757757
};
758758
match events[0] {
@@ -2167,7 +2167,7 @@ fn do_test_commitment_revoked_fail_backward_exhaustive(
21672167

21682168
// Ensure that the last remaining message event is the BroadcastChannelUpdate msg for chan_2
21692169
match events[0] {
2170-
MessageSendEvent::BroadcastChannelUpdate { msg: msgs::ChannelUpdate { .. } } => {},
2170+
MessageSendEvent::BroadcastChannelUpdate { msg: msgs::ChannelUpdate { .. }, .. } => {},
21712171
_ => panic!("Unexpected event"),
21722172
}
21732173

@@ -6026,7 +6026,7 @@ pub fn test_announce_disable_channels() {
60266026
let mut chans_disabled = new_hash_map();
60276027
for e in msg_events {
60286028
match e {
6029-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
6029+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
60306030
assert_eq!(msg.contents.channel_flags & (1 << 1), 1 << 1); // The "channel disabled" bit should be set
60316031
// Check that each channel gets updated exactly once
60326032
if chans_disabled
@@ -6077,7 +6077,7 @@ pub fn test_announce_disable_channels() {
60776077
assert_eq!(msg_events.len(), 3);
60786078
for e in msg_events {
60796079
match e {
6080-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
6080+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
60816081
assert_eq!(msg.contents.channel_flags & (1 << 1), 0); // The "channel disabled" bit should be off
60826082
match chans_disabled.remove(&msg.contents.short_channel_id) {
60836083
// Each update should have a higher timestamp than the previous one, replacing
@@ -7995,13 +7995,13 @@ pub fn test_error_chans_closed() {
79957995
let events = nodes[0].node.get_and_clear_pending_msg_events();
79967996
assert_eq!(events.len(), 2);
79977997
match events[0] {
7998-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
7998+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
79997999
assert_eq!(msg.contents.channel_flags & 2, 2);
80008000
},
80018001
_ => panic!("Unexpected event"),
80028002
}
80038003
match events[1] {
8004-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
8004+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
80058005
assert_eq!(msg.contents.channel_flags & 2, 2);
80068006
},
80078007
_ => panic!("Unexpected event"),

lightning/src/ln/msgs.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,16 @@ pub enum MessageSendEvent {
19171917
BroadcastChannelUpdate {
19181918
/// The channel_update which should be sent.
19191919
msg: ChannelUpdate,
1920+
/// The node_id of the first endpoint of the channel.
1921+
///
1922+
/// This is not used in the message broadcast, but rather is useful for deciding which
1923+
/// peer(s) to send the update to.
1924+
node_id_1: NodeId,
1925+
/// The node_id of the second endpoint of the channel.
1926+
///
1927+
/// This is not used in the message broadcast, but rather is useful for deciding which
1928+
/// peer(s) to send the update to.
1929+
node_id_2: NodeId,
19201930
},
19211931
/// Used to indicate that a node_announcement should be broadcast to all peers.
19221932
BroadcastNodeAnnouncement {

lightning/src/ln/onion_route_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ fn do_test_onion_failure_stale_channel_update(announce_for_forwarding: bool) {
16621662
return None;
16631663
}
16641664
let new_update = match &events[0] {
1665-
MessageSendEvent::BroadcastChannelUpdate { msg } => {
1665+
MessageSendEvent::BroadcastChannelUpdate { msg, .. } => {
16661666
assert!(announce_for_forwarding);
16671667
msg.clone()
16681668
},

lightning/src/ln/peer_handler.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,7 +3164,7 @@ where
31643164
}
31653165
}
31663166
},
3167-
MessageSendEvent::BroadcastChannelUpdate { msg } => {
3167+
MessageSendEvent::BroadcastChannelUpdate { msg, .. } => {
31683168
log_debug!(self.logger, "Handling BroadcastChannelUpdate event in peer_handler for contents {:?}", msg.contents);
31693169
match route_handler.handle_channel_update(None, &msg) {
31703170
Ok(_)
@@ -4409,8 +4409,6 @@ mod tests {
44094409

44104410
#[test]
44114411
fn test_forward_while_syncing() {
4412-
use crate::ln::peer_handler::tests::test_utils::get_dummy_channel_update;
4413-
44144412
// Test forwarding new channel announcements while we're doing syncing.
44154413
let cfgs = create_peermgr_cfgs(2);
44164414
cfgs[0].routing_handler.request_full_sync.store(true, Ordering::Release);
@@ -4457,11 +4455,19 @@ mod tests {
44574455
// At this point we should have sent channel announcements up to roughly SCID 150. Now
44584456
// build an updated update for SCID 100 and SCID 5000 and make sure only the one for SCID
44594457
// 100 gets forwarded
4460-
let msg_100 = get_dummy_channel_update(100);
4461-
let msg_ev_100 = MessageSendEvent::BroadcastChannelUpdate { msg: msg_100.clone() };
4458+
let msg_100 = test_utils::get_dummy_channel_update(100);
4459+
let msg_ev_100 = MessageSendEvent::BroadcastChannelUpdate {
4460+
msg: msg_100.clone(),
4461+
node_id_1: NodeId::from_slice(&[2; 33]).unwrap(),
4462+
node_id_2: NodeId::from_slice(&[3; 33]).unwrap(),
4463+
};
44624464

4463-
let msg_5000 = get_dummy_channel_update(5000);
4464-
let msg_ev_5000 = MessageSendEvent::BroadcastChannelUpdate { msg: msg_5000 };
4465+
let msg_5000 = test_utils::get_dummy_channel_update(5000);
4466+
let msg_ev_5000 = MessageSendEvent::BroadcastChannelUpdate {
4467+
msg: msg_5000,
4468+
node_id_1: NodeId::from_slice(&[2; 33]).unwrap(),
4469+
node_id_2: NodeId::from_slice(&[3; 33]).unwrap(),
4470+
};
44654471

44664472
fd_a.hang_writes.store(true, Ordering::Relaxed);
44674473

lightning/src/ln/shutdown_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ fn do_test_closing_signed_reinit_timeout(timeout_step: TimeoutStep) {
14021402
let events = nodes[1].node.get_and_clear_pending_msg_events();
14031403
assert_eq!(events.len(), 1);
14041404
match events[0] {
1405-
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
1405+
MessageSendEvent::BroadcastChannelUpdate { ref msg, .. } => {
14061406
assert_eq!(msg.contents.channel_flags & 2, 2);
14071407
},
14081408
_ => panic!("Unexpected event"),

lightning/src/routing/gossip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ where
394394
*update_msg = None;
395395
}
396396
},
397-
MessageSendEvent::BroadcastChannelUpdate { msg } => {
397+
MessageSendEvent::BroadcastChannelUpdate { msg, .. } => {
398398
if msg.contents.excess_data.len() > MAX_EXCESS_BYTES_FOR_RELAY {
399399
return;
400400
}

lightning/src/routing/utxo.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ impl UtxoFuture {
233233
// Note that we ignore errors as we don't disconnect peers anyway, so there's nothing to do
234234
// with them.
235235
let resolver = UtxoResolver(result);
236+
let (node_id_1, node_id_2) = match &announcement {
237+
ChannelAnnouncement::Full(signed_msg) => (signed_msg.contents.node_id_1, signed_msg.contents.node_id_2),
238+
ChannelAnnouncement::Unsigned(msg) => (msg.node_id_1, msg.node_id_2),
239+
};
236240
match announcement {
237241
ChannelAnnouncement::Full(signed_msg) => {
238242
if graph.update_channel_from_announcement(&signed_msg, &Some(&resolver)).is_ok() {
@@ -270,6 +274,8 @@ impl UtxoFuture {
270274
if graph.update_channel(&signed_msg).is_ok() {
271275
res[res_idx] = Some(MessageSendEvent::BroadcastChannelUpdate {
272276
msg: signed_msg,
277+
node_id_1,
278+
node_id_2,
273279
});
274280
res_idx += 1;
275281
}

0 commit comments

Comments
 (0)