+ // Regenerate inbound fees for all channels. The live-updating of these has been broken in
+ // various ways historically, so this ensures that we have up-to-date limits.
+ for (node_id, node) in nodes.iter_mut() {
+ let mut best_fees = RoutingFees { base_msat: u32::MAX, proportional_millionths: u32::MAX };
+ for channel in node.channels.iter() {
+ if let Some(chan) = channels.get(channel) {
+ let dir_opt = if *node_id == chan.node_one { &chan.two_to_one } else { &chan.one_to_two };
+ if let Some(dir) = dir_opt {
+ best_fees.base_msat = cmp::min(best_fees.base_msat, dir.fees.base_msat);
+ best_fees.proportional_millionths = cmp::min(best_fees.proportional_millionths, dir.fees.proportional_millionths);
+ }
+ } else { return Err(DecodeError::InvalidValue); }
+ }
+ node.lowest_inbound_channel_fees = Some(best_fees);
+ }
+