You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Re-)add handling for ChannelUpdate::message_flags
When the `htlc_maximum_msat` field was made mandatory in
`ChannelUpdate` (in b0e8b73) we
started ignoring the `message_flags` field entirely and always
writing `1`. The comment updates indicated that the `message_flags`
field was deprecated, but this is not true - only the
`htlc_maximum_msat` indicator bit was deprecated, requiring it to
be 1.
If a node creates a `channel_update` with `message_flags` bits set
other than the low bit, this will cause us to spuriously reject
the message with an invalid signature error as we will check the
message against the wrong hash.
With today's current spec this is totally fine - the only other bit
defined for `message_flags` is the `dont_forward` bit, which when
set indicates we shouldn't accept the message into our gossip store
anyway (though this may lead to spurious `warning` messages being
sent to peers). However, in the future this may mean we start
rejecting valid `channel_update`s if new bits are defiend.
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));
7921
7922
}
7922
7923
let were_node_one = self.get_our_node_id().serialize()[..] < chan.context.get_counterparty_node_id().serialize()[..];
7923
-
let msg_from_node_one = msg.contents.flags & 1 == 0;
7924
+
let msg_from_node_one = msg.contents.channel_flags & 1 == 0;
7924
7925
if were_node_one == msg_from_node_one {
7925
7926
return Ok(NotifyOption::SkipPersistNoEvents);
7926
7927
} else {
@@ -12236,8 +12237,8 @@ mod tests {
12236
12237
// update message and would always update the local fee info, even if our peer was
12237
12238
// (spuriously) forwarding us our own channel_update.
12238
12239
let as_node_one = nodes[0].node.get_our_node_id().serialize()[..] < nodes[1].node.get_our_node_id().serialize()[..];
12239
-
let as_update = if as_node_one == (chan.0.contents.flags & 1 == 0 /* chan.0 is from node one */) { &chan.0 } else { &chan.1 };
12240
-
let bs_update = if as_node_one == (chan.0.contents.flags & 1 == 0 /* chan.0 is from node one */) { &chan.1 } else { &chan.0 };
12240
+
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 };
12241
+
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 };
12241
12242
12242
12243
// First deliver each peers' own message, checking that the node doesn't need to be
12243
12244
// persisted and that its channel info remains the same.
0 commit comments