Skip to content

Commit 8d240cf

Browse files
authored
Merge pull request #3144 from TheBlueMatt/2024-06-message-flags
(Re-)add handling for `ChannelUpdate::message_flags`
2 parents c64b8e4 + 162b81f commit 8d240cf

21 files changed

+340
-188
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
10691069
events::MessageSendEvent::SendChannelReady { .. } => continue,
10701070
events::MessageSendEvent::SendAnnouncementSignatures { .. } => continue,
10711071
events::MessageSendEvent::SendChannelUpdate { ref node_id, ref msg } => {
1072-
assert_eq!(msg.contents.flags & 2, 0); // The disable bit must never be set!
1072+
assert_eq!(msg.contents.channel_flags & 2, 0); // The disable bit must never be set!
10731073
if Some(*node_id) == expect_drop_id { panic!("peer_disconnected should drop msgs bound for the disconnected peer"); }
10741074
*node_id == a_id
10751075
},
@@ -1207,7 +1207,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
12071207
// the "disabled" bit, as we should never ever have a channel which is
12081208
// disabled when we send such an update (or it may indicate channel
12091209
// force-close which we should detect as an error).
1210-
assert_eq!(msg.contents.flags & 2, 0);
1210+
assert_eq!(msg.contents.channel_flags & 2, 0);
12111211
},
12121212
_ => if out.may_fail.load(atomic::Ordering::Acquire) {
12131213
return;
@@ -1249,7 +1249,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
12491249
events::MessageSendEvent::SendChannelReady { .. } => {},
12501250
events::MessageSendEvent::SendAnnouncementSignatures { .. } => {},
12511251
events::MessageSendEvent::SendChannelUpdate { ref msg, .. } => {
1252-
assert_eq!(msg.contents.flags & 2, 0); // The disable bit must never be set!
1252+
assert_eq!(msg.contents.channel_flags & 2, 0); // The disable bit must never be set!
12531253
},
12541254
_ => {
12551255
if out.may_fail.load(atomic::Ordering::Acquire) {
@@ -1275,7 +1275,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
12751275
events::MessageSendEvent::SendChannelReady { .. } => {},
12761276
events::MessageSendEvent::SendAnnouncementSignatures { .. } => {},
12771277
events::MessageSendEvent::SendChannelUpdate { ref msg, .. } => {
1278-
assert_eq!(msg.contents.flags & 2, 0); // The disable bit must never be set!
1278+
assert_eq!(msg.contents.channel_flags & 2, 0); // The disable bit must never be set!
12791279
},
12801280
_ => {
12811281
if out.may_fail.load(atomic::Ordering::Acquire) {

fuzz/src/full_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ mod tests {
17791779

17801780
let log_entries = logger.lines.lock().unwrap();
17811781
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)) or the announced channel's counterparties: ChannelAnnouncement { node_signature_1: 3026020200b202200303030303030303030303030303030303030303030303030303030303030303, node_signature_2: 3026020200b202200202020202020202020202020202020202020202020202020202020202020202, bitcoin_signature_1: 3026020200b202200303030303030303030303030303030303030303030303030303030303030303, bitcoin_signature_2: 3026020200b202200202020202020202020202020202020202020202020202020202020202020202, contents: UnsignedChannelAnnouncement { features: [], chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, node_id_1: NodeId(030303030303030303030303030303030303030303030303030303030303030303), node_id_2: NodeId(020202020202020202020202020202020202020202020202020202020202020202), bitcoin_key_1: NodeId(030303030303030303030303030303030303030303030303030303030303030303), bitcoin_key_2: NodeId(020202020202020202020202020202020202020202020202020202020202020202), excess_data: [] } }".to_string())), Some(&1));
1782-
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)): ChannelUpdate { signature: 3026020200a602200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedChannelUpdate { chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, timestamp: 44, flags: 0, cltv_expiry_delta: 40, htlc_minimum_msat: 0, htlc_maximum_msat: 100000000, fee_base_msat: 0, fee_proportional_millionths: 0, excess_data: [] } }".to_string())), Some(&1));
1782+
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)): ChannelUpdate { signature: 3026020200a602200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedChannelUpdate { chain_hash: 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000, short_channel_id: 42, timestamp: 44, message_flags: 1, channel_flags: 0, cltv_expiry_delta: 40, htlc_minimum_msat: 0, htlc_maximum_msat: 100000000, fee_base_msat: 0, fee_proportional_millionths: 0, excess_data: [] } }".to_string())), Some(&1));
17831783
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Sending message to all peers except Some(PublicKey(0000000000000000000000000000000000000000000000000000000000000002ff00000000000000000000000000000000000000000000000000000000000002)) or the announced node: NodeAnnouncement { signature: 302502012802200303030303030303030303030303030303030303030303030303030303030303, contents: UnsignedNodeAnnouncement { features: [], timestamp: 43, node_id: NodeId(030303030303030303030303030303030303030303030303030303030303030303), rgb: [0, 0, 0], alias: NodeAlias([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), addresses: [], excess_address_data: [], excess_data: [] } }".to_string())), Some(&1));
17841784
}
17851785
}

fuzz/src/msg_targets/gen_target.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ GEN_TEST lightning::ln::msgs::ChannelReestablish test_msg_simple ""
3939

4040
GEN_TEST lightning::ln::msgs::DecodedOnionErrorPacket test_msg ""
4141

42+
# Gossip messages need to use `test_msg_exact` to ensure that messages
43+
# round-trip exactly when doing signature validation.
4244
GEN_TEST lightning::ln::msgs::ChannelAnnouncement test_msg_exact ""
4345
GEN_TEST lightning::ln::msgs::NodeAnnouncement test_msg_exact ""
46+
GEN_TEST lightning::ln::msgs::ChannelUpdate test_msg_exact ""
47+
4448
GEN_TEST lightning::ln::msgs::QueryShortChannelIds test_msg ""
4549
GEN_TEST lightning::ln::msgs::ReplyChannelRange test_msg ""
4650

4751
GEN_TEST lightning::ln::msgs::ErrorMessage test_msg_hole ", 32, 2"
4852
GEN_TEST lightning::ln::msgs::WarningMessage test_msg_hole ", 32, 2"
49-
GEN_TEST lightning::ln::msgs::ChannelUpdate test_msg_hole ", 108, 1"
5053

5154
GEN_TEST lightning::ln::channel_state::ChannelDetails test_msg_simple ""
5255

fuzz/src/msg_targets/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ pub mod msg_channel_reestablish;
2525
pub mod msg_decoded_onion_error_packet;
2626
pub mod msg_channel_announcement;
2727
pub mod msg_node_announcement;
28+
pub mod msg_channel_update;
2829
pub mod msg_query_short_channel_ids;
2930
pub mod msg_reply_channel_range;
3031
pub mod msg_error_message;
3132
pub mod msg_warning_message;
32-
pub mod msg_channel_update;
3333
pub mod msg_channel_details;
3434
pub mod msg_open_channel_v2;
3535
pub mod msg_accept_channel_v2;

fuzz/src/msg_targets/msg_channel_update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ use crate::utils::test_logger;
1717

1818
#[inline]
1919
pub fn msg_channel_update_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
20-
test_msg_hole!(lightning::ln::msgs::ChannelUpdate, data, 108, 1);
20+
test_msg_exact!(lightning::ln::msgs::ChannelUpdate, data);
2121
}
2222

2323
#[no_mangle]
2424
pub extern "C" fn msg_channel_update_run(data: *const u8, datalen: usize) {
2525
let data = unsafe { std::slice::from_raw_parts(data, datalen) };
26-
test_msg_hole!(lightning::ln::msgs::ChannelUpdate, data, 108, 1);
26+
test_msg_exact!(lightning::ln::msgs::ChannelUpdate, data);
2727
}

lightning-rapid-gossip-sync/src/processing.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ where
370370
chain_hash,
371371
short_channel_id,
372372
timestamp: backdated_timestamp,
373-
flags: standard_channel_flags,
373+
message_flags: 1, // Only must_be_one
374+
channel_flags: standard_channel_flags,
374375
cltv_expiry_delta: default_cltv_expiry_delta,
375376
htlc_minimum_msat: default_htlc_minimum_msat,
376377
htlc_maximum_msat: default_htlc_maximum_msat,

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ fn test_monitor_update_fail_reestablish() {
11301130
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &as_reestablish);
11311131
assert_eq!(
11321132
get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id())
1133-
.contents.flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
1133+
.contents.channel_flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
11341134

11351135
nodes[1].node.get_and_clear_pending_msg_events(); // Free the holding cell
11361136
check_added_monitors!(nodes[1], 1);
@@ -1151,13 +1151,13 @@ fn test_monitor_update_fail_reestablish() {
11511151
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &bs_reestablish);
11521152
assert_eq!(
11531153
get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id())
1154-
.contents.flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
1154+
.contents.channel_flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
11551155

11561156
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &as_reestablish);
11571157
check_added_monitors!(nodes[1], 0);
11581158
assert_eq!(
11591159
get_event_msg!(nodes[1], MessageSendEvent::SendChannelUpdate, nodes[0].node.get_our_node_id())
1160-
.contents.flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
1160+
.contents.channel_flags & 2, 0); // The "disabled" bit should be unset as we just reconnected
11611161

11621162
chanmon_cfgs[1].persister.set_update_ret(ChannelMonitorUpdateStatus::Completed);
11631163
let (outpoint, latest_update, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_1.2).unwrap().clone();

lightning/src/ln/channel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9895,7 +9895,8 @@ mod tests {
98959895
chain_hash,
98969896
short_channel_id: 0,
98979897
timestamp: 0,
9898-
flags: 0,
9898+
message_flags: 1, // Only must_be_one
9899+
channel_flags: 0,
98999900
cltv_expiry_delta: 100,
99009901
htlc_minimum_msat: 5,
99019902
htlc_maximum_msat: MAX_VALUE_MSAT,

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,7 +3506,7 @@ where
35063506
// peer has been disabled for some time), return `channel_disabled`,
35073507
// otherwise return `temporary_channel_failure`.
35083508
let chan_update_opt = self.get_channel_update_for_onion(next_packet.outgoing_scid, chan).ok();
3509-
if chan_update_opt.as_ref().map(|u| u.contents.flags & 2 == 2).unwrap_or(false) {
3509+
if chan_update_opt.as_ref().map(|u| u.contents.channel_flags & 2 == 2).unwrap_or(false) {
35103510
return Err(("Forwarding channel has been disconnected for some time.", 0x1000 | 20, chan_update_opt));
35113511
} else {
35123512
return Err(("Forwarding channel is not in a ready state.", 0x1000 | 7, chan_update_opt));
@@ -3785,7 +3785,8 @@ where
37853785
chain_hash: self.chain_hash,
37863786
short_channel_id,
37873787
timestamp: chan.context.get_update_time_counter(),
3788-
flags: (!were_node_one) as u8 | ((!enabled as u8) << 1),
3788+
message_flags: 1, // Only must_be_one
3789+
channel_flags: (!were_node_one) as u8 | ((!enabled as u8) << 1),
37893790
cltv_expiry_delta: chan.context.get_cltv_expiry_delta(),
37903791
htlc_minimum_msat: chan.context.get_counterparty_htlc_minimum_msat(),
37913792
htlc_maximum_msat: chan.context.get_announced_htlc_max_msat(),
@@ -7921,7 +7922,7 @@ where
79217922
return Err(MsgHandleErrInternal::send_err_msg_no_close("Got a channel_update for a channel from the wrong node - it shouldn't know about our private channels!".to_owned(), chan_id));
79227923
}
79237924
let were_node_one = self.get_our_node_id().serialize()[..] < chan.context.get_counterparty_node_id().serialize()[..];
7924-
let msg_from_node_one = msg.contents.flags & 1 == 0;
7925+
let msg_from_node_one = msg.contents.channel_flags & 1 == 0;
79257926
if were_node_one == msg_from_node_one {
79267927
return Ok(NotifyOption::SkipPersistNoEvents);
79277928
} else {
@@ -12262,8 +12263,8 @@ mod tests {
1226212263
// update message and would always update the local fee info, even if our peer was
1226312264
// (spuriously) forwarding us our own channel_update.
1226412265
let as_node_one = nodes[0].node.get_our_node_id().serialize()[..] < nodes[1].node.get_our_node_id().serialize()[..];
12265-
let as_update = if as_node_one == (chan.0.contents.flags & 1 == 0 /* chan.0 is from node one */) { &chan.0 } else { &chan.1 };
12266-
let bs_update = if as_node_one == (chan.0.contents.flags & 1 == 0 /* chan.0 is from node one */) { &chan.1 } else { &chan.0 };
12266+
let as_update = if as_node_one == (chan.0.contents.channel_flags & 1 == 0 /* chan.0 is from node one */) { &chan.0 } else { &chan.1 };
12267+
let bs_update = if as_node_one == (chan.0.contents.channel_flags & 1 == 0 /* chan.0 is from node one */) { &chan.1 } else { &chan.0 };
1226712268

1226812269
// First deliver each peers' own message, checking that the node doesn't need to be
1226912270
// persisted and that its channel info remains the same.

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ macro_rules! get_closing_signed_broadcast {
15541554
assert!(events.len() == 1 || events.len() == 2);
15551555
(match events[events.len() - 1] {
15561556
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
1557-
assert_eq!(msg.contents.flags & 2, 2);
1557+
assert_eq!(msg.contents.channel_flags & 2, 2);
15581558
msg.clone()
15591559
},
15601560
_ => panic!("Unexpected event"),
@@ -1613,7 +1613,7 @@ pub fn check_closed_broadcast(node: &Node, num_channels: usize, with_error_msg:
16131613
msg_events.into_iter().filter_map(|msg_event| {
16141614
match msg_event {
16151615
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
1616-
assert_eq!(msg.contents.flags & 2, 2);
1616+
assert_eq!(msg.contents.channel_flags & 2, 2);
16171617
None
16181618
},
16191619
MessageSendEvent::HandleError { action: msgs::ErrorAction::SendErrorMessage { msg }, node_id: _ } => {

lightning/src/ln/functional_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7405,7 +7405,7 @@ fn test_announce_disable_channels() {
74057405
for e in msg_events {
74067406
match e {
74077407
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
7408-
assert_eq!(msg.contents.flags & (1<<1), 1<<1); // The "channel disabled" bit should be set
7408+
assert_eq!(msg.contents.channel_flags & (1<<1), 1<<1); // The "channel disabled" bit should be set
74097409
// Check that each channel gets updated exactly once
74107410
if chans_disabled.insert(msg.contents.short_channel_id, msg.contents.timestamp).is_some() {
74117411
panic!("Generated ChannelUpdate for wrong chan!");
@@ -7452,7 +7452,7 @@ fn test_announce_disable_channels() {
74527452
for e in msg_events {
74537453
match e {
74547454
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
7455-
assert_eq!(msg.contents.flags & (1<<1), 0); // The "channel disabled" bit should be off
7455+
assert_eq!(msg.contents.channel_flags & (1<<1), 0); // The "channel disabled" bit should be off
74567456
match chans_disabled.remove(&msg.contents.short_channel_id) {
74577457
// Each update should have a higher timestamp than the previous one, replacing
74587458
// the old one.
@@ -9398,13 +9398,13 @@ fn test_error_chans_closed() {
93989398
assert_eq!(events.len(), 2);
93999399
match events[0] {
94009400
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
9401-
assert_eq!(msg.contents.flags & 2, 2);
9401+
assert_eq!(msg.contents.channel_flags & 2, 2);
94029402
},
94039403
_ => panic!("Unexpected event"),
94049404
}
94059405
match events[1] {
94069406
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
9407-
assert_eq!(msg.contents.flags & 2, 2);
9407+
assert_eq!(msg.contents.channel_flags & 2, 2);
94089408
},
94099409
_ => panic!("Unexpected event"),
94109410
}

lightning/src/ln/msgs.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,11 @@ pub struct UnsignedChannelUpdate {
12441244
pub short_channel_id: u64,
12451245
/// A strictly monotonic announcement counter, with gaps allowed, specific to this channel
12461246
pub timestamp: u32,
1247-
/// Channel flags
1248-
pub flags: u8,
1247+
/// Flags pertaining to this message.
1248+
pub message_flags: u8,
1249+
/// Flags pertaining to the channel, including to which direction in the channel this update
1250+
/// applies and whether the direction is currently able to forward HTLCs.
1251+
pub channel_flags: u8,
12491252
/// The number of blocks such that if:
12501253
/// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
12511254
/// then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
@@ -2896,13 +2899,13 @@ impl_writeable!(ChannelAnnouncement, {
28962899

28972900
impl Writeable for UnsignedChannelUpdate {
28982901
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
2899-
// `message_flags` used to indicate presence of `htlc_maximum_msat`, but was deprecated in the spec.
2900-
const MESSAGE_FLAGS: u8 = 1;
29012902
self.chain_hash.write(w)?;
29022903
self.short_channel_id.write(w)?;
29032904
self.timestamp.write(w)?;
2904-
let all_flags = self.flags as u16 | ((MESSAGE_FLAGS as u16) << 8);
2905-
all_flags.write(w)?;
2905+
// Thw low bit of message_flags used to indicate the presence of `htlc_maximum_msat`, and
2906+
// now must be set
2907+
(self.message_flags | 1).write(w)?;
2908+
self.channel_flags.write(w)?;
29062909
self.cltv_expiry_delta.write(w)?;
29072910
self.htlc_minimum_msat.write(w)?;
29082911
self.fee_base_msat.write(w)?;
@@ -2915,22 +2918,26 @@ impl Writeable for UnsignedChannelUpdate {
29152918

29162919
impl Readable for UnsignedChannelUpdate {
29172920
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
2918-
Ok(Self {
2921+
let res = Self {
29192922
chain_hash: Readable::read(r)?,
29202923
short_channel_id: Readable::read(r)?,
29212924
timestamp: Readable::read(r)?,
2922-
flags: {
2923-
let flags: u16 = Readable::read(r)?;
2924-
// Note: we ignore the `message_flags` for now, since it was deprecated by the spec.
2925-
flags as u8
2926-
},
2925+
message_flags: Readable::read(r)?,
2926+
channel_flags: Readable::read(r)?,
29272927
cltv_expiry_delta: Readable::read(r)?,
29282928
htlc_minimum_msat: Readable::read(r)?,
29292929
fee_base_msat: Readable::read(r)?,
29302930
fee_proportional_millionths: Readable::read(r)?,
29312931
htlc_maximum_msat: Readable::read(r)?,
29322932
excess_data: read_to_end(r)?,
2933-
})
2933+
};
2934+
if res.message_flags & 1 != 1 {
2935+
// The `must_be_one` flag should be set (historically it indicated the presence of the
2936+
// `htlc_maximum_msat` field, which is now required).
2937+
Err(DecodeError::InvalidValue)
2938+
} else {
2939+
Ok(res)
2940+
}
29342941
}
29352942
}
29362943

@@ -3526,7 +3533,8 @@ mod tests {
35263533
chain_hash: ChainHash::using_genesis_block(Network::Bitcoin),
35273534
short_channel_id: 2316138423780173,
35283535
timestamp: 20190119,
3529-
flags: if direction { 1 } else { 0 } | if disable { 1 << 1 } else { 0 },
3536+
message_flags: 1, // Only must_be_one
3537+
channel_flags: if direction { 1 } else { 0 } | if disable { 1 << 1 } else { 0 },
35303538
cltv_expiry_delta: 144,
35313539
htlc_minimum_msat: 1000000,
35323540
htlc_maximum_msat: 131355275467161,

lightning/src/ln/onion_route_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ impl msgs::ChannelUpdate {
238238
chain_hash: ChainHash::from(BlockHash::hash(&vec![0u8][..]).as_ref()),
239239
short_channel_id,
240240
timestamp: 0,
241-
flags: 0,
241+
message_flags: 1, // Only must_be_one
242+
channel_flags: 0,
242243
cltv_expiry_delta: 0,
243244
htlc_minimum_msat: 0,
244245
htlc_maximum_msat: msgs::MAX_VALUE_MSAT,

lightning/src/ln/priv_short_conf_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ fn test_scid_alias_returned() {
508508
chain_hash: ChainHash::using_genesis_block(Network::Testnet),
509509
short_channel_id: last_hop[0].inbound_scid_alias.unwrap(),
510510
timestamp: 21,
511-
flags: 1,
511+
message_flags: 1, // Only must_be_one
512+
channel_flags: 1,
512513
cltv_expiry_delta: accept_forward_cfg.channel_config.cltv_expiry_delta,
513514
htlc_minimum_msat: 1_000,
514515
htlc_maximum_msat: 1_000_000, // Defaults to 10% of the channel value

lightning/src/ln/shutdown_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ fn do_test_shutdown_rebroadcast(recv_count: u8) {
577577
node_0_2nd_shutdown
578578
} else {
579579
let node_0_chan_update = get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id());
580-
assert_eq!(node_0_chan_update.contents.flags & 2, 0); // "disabled" flag must not be set as we just reconnected.
580+
assert_eq!(node_0_chan_update.contents.channel_flags & 2, 0); // "disabled" flag must not be set as we just reconnected.
581581
nodes[0].node.handle_shutdown(&nodes[1].node.get_our_node_id(), &node_1_2nd_shutdown);
582582
get_event_msg!(nodes[0], MessageSendEvent::SendShutdown, nodes[1].node.get_our_node_id())
583583
};
@@ -1188,7 +1188,7 @@ fn do_test_closing_signed_reinit_timeout(timeout_step: TimeoutStep) {
11881188
assert_eq!(events.len(), 1);
11891189
match events[0] {
11901190
MessageSendEvent::BroadcastChannelUpdate { ref msg } => {
1191-
assert_eq!(msg.contents.flags & 2, 2);
1191+
assert_eq!(msg.contents.channel_flags & 2, 2);
11921192
},
11931193
_ => panic!("Unexpected event"),
11941194
}

0 commit comments

Comments
 (0)