- // let our_channels = channel_manager.list_usable_channels();
- // let network_graph = router.network_graph.read().unwrap();
- // let network_channels = network_graph.get_channels();
- // for channel in our_channels {
- // let short_channel_id_opt = channel.short_channel_id;
- // if short_channel_id_opt.is_none() {
- // continue
- // }
-
- // let short_channel_id = short_channel_id_opt.unwrap();
- // let channel_routing_info_opt = network_channels.get(&short_channel_id);
- // if channel_routing_info_opt.is_none() {
- // continue
- // }
-
- // let channel_routing_info = channel_routing_info_opt.unwrap();
- // let mut counterparty = channel_routing_info.node_two;
- // let mut counterparty_chan_fees_opt = channel_routing_info.one_to_two.as_ref();
- // if channel_routing_info.node_two != our_node_pubkey { // e.g. if our counterparty is node_one
- // counterparty = channel_routing_info.node_one;
- // counterparty_chan_fees_opt = channel_routing_info.two_to_one.as_ref();
- // }
- // if counterparty_chan_fees_opt.is_none() {
- // continue
- // }
-
- // let counterparty_chan_fees = counterparty_chan_fees_opt.unwrap();
- // invoice = invoice.route(vec![
- // lightning_invoice::RouteHop {
- // short_channel_id: short_channel_id.to_be_bytes(),
- // cltv_expiry_delta: counterparty_chan_fees.cltv_expiry_delta,
- // fee_base_msat: counterparty_chan_fees.fees.base_msat,
- // fee_proportional_millionths: counterparty_chan_fees.fees.proportional_millionths,
- // pubkey: counterparty,
- // }
- // ]);
- // }
+ let our_channels = channel_manager.list_usable_channels();
+ for channel in our_channels {
+ let short_channel_id = match channel.short_channel_id {
+ Some(id) => id.to_be_bytes(),
+ None => continue
+ };
+ let forwarding_info = match channel.counterparty_forwarding_info {
+ Some(info) => info,
+ None => continue,
+ };
+ println!("VMW: adding routehop, info.fee base: {}", forwarding_info.fee_base_msat);
+ invoice = invoice.route(vec![
+ lightning_invoice::RouteHop {
+ pubkey: channel.remote_network_id,
+ short_channel_id,
+ fee_base_msat: forwarding_info.fee_base_msat,
+ fee_proportional_millionths: forwarding_info.fee_proportional_millionths,
+ cltv_expiry_delta: forwarding_info.cltv_expiry_delta,
+ }
+ ]);
+ }