]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Also set `user_channel_id` when its overridden
authorElias Rohrer <ero@tnull.de>
Wed, 16 Nov 2022 14:20:31 +0000 (15:20 +0100)
committerElias Rohrer <ero@tnull.de>
Wed, 16 Nov 2022 17:50:40 +0000 (18:50 +0100)
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs

index 121c1d4c66c36cb64f21df76823f5d24ace0e97a..420547fb20e6c0cc590f72f41a7261139caf189f 100644 (file)
@@ -4639,7 +4639,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
                                        }
                                        channel_state.pending_msg_events.push(events::MessageSendEvent::SendAcceptChannel {
                                                node_id: counterparty_node_id.clone(),
-                                               msg: channel.accept_inbound_channel(0),
+                                               msg: channel.accept_inbound_channel(user_channel_id),
                                        });
                                } else {
                                        let mut pending_events = self.pending_events.lock().unwrap();
index d6a3f35ccd2f9317cd9c2521342791a081a905c6..adc21cd02691d123afcb7bea5153c9f251e26366 100644 (file)
@@ -751,10 +751,12 @@ pub fn create_chan_between_nodes_with_value_init<'a, 'b, 'c>(node_a: &Node<'a, '
        let create_chan_id = node_a.node.create_channel(node_b.node.get_our_node_id(), channel_value, push_msat, 42, None).unwrap();
        let open_channel_msg = get_event_msg!(node_a, MessageSendEvent::SendOpenChannel, node_b.node.get_our_node_id());
        assert_eq!(open_channel_msg.temporary_channel_id, create_chan_id);
+       assert_eq!(node_a.node.list_channels().iter().find(|channel| channel.channel_id == create_chan_id).unwrap().user_channel_id, 42);
        node_b.node.handle_open_channel(&node_a.node.get_our_node_id(), a_flags, &open_channel_msg);
        let accept_channel_msg = get_event_msg!(node_b, MessageSendEvent::SendAcceptChannel, node_a.node.get_our_node_id());
        assert_eq!(accept_channel_msg.temporary_channel_id, create_chan_id);
        node_a.node.handle_accept_channel(&node_b.node.get_our_node_id(), b_flags, &accept_channel_msg);
+       assert_ne!(node_b.node.list_channels().iter().find(|channel| channel.channel_id == create_chan_id).unwrap().user_channel_id, 0);
 
        sign_funding_transaction(node_a, node_b, channel_value, create_chan_id)
 }