+ fn remove_channel_in_nodes(nodes: &mut HashMap<PublicKey, NodeInfo>, chan: &ChannelInfo, short_channel_id: u64) {
+ macro_rules! remove_from_node {
+ ($node_id: expr) => {
+ if let Entry::Occupied(mut entry) = nodes.entry($node_id) {
+ entry.get_mut().channels.retain(|chan_id| {
+ short_channel_id != *NetworkMap::get_short_id(chan_id)
+ });
+ if entry.get().channels.is_empty() {
+ entry.remove_entry();
+ }
+ } else {
+ panic!("Had channel that pointed to unknown node (ie inconsistent network map)!");
+ }
+ }
+ }
+ remove_from_node!(chan.one_to_two.src_node_id);
+ remove_from_node!(chan.two_to_one.src_node_id);
+ }
+