+ { // Route to 1 via 2 and 3 because our channel to 1 is disabled
+ let route = router.get_route(&node1, None, &Vec::new(), 100, 42).unwrap();
+ assert_eq!(route.paths[0].len(), 3);
+
+ assert_eq!(route.paths[0][0].pubkey, node2);
+ assert_eq!(route.paths[0][0].short_channel_id, 2);
+ assert_eq!(route.paths[0][0].fee_msat, 200);
+ assert_eq!(route.paths[0][0].cltv_expiry_delta, (4 << 8) | 1);
+ assert_eq!(route.paths[0][0].node_features.le_flags(), &id_to_feature_flags!(2));
+ assert_eq!(route.paths[0][0].channel_features.le_flags(), &id_to_feature_flags!(2));
+
+ assert_eq!(route.paths[0][1].pubkey, node3);
+ assert_eq!(route.paths[0][1].short_channel_id, 4);
+ assert_eq!(route.paths[0][1].fee_msat, 100);
+ assert_eq!(route.paths[0][1].cltv_expiry_delta, (3 << 8) | 2);
+ assert_eq!(route.paths[0][1].node_features.le_flags(), &id_to_feature_flags!(3));
+ assert_eq!(route.paths[0][1].channel_features.le_flags(), &id_to_feature_flags!(4));
+
+ assert_eq!(route.paths[0][2].pubkey, node1);
+ assert_eq!(route.paths[0][2].short_channel_id, 3);
+ assert_eq!(route.paths[0][2].fee_msat, 100);
+ assert_eq!(route.paths[0][2].cltv_expiry_delta, 42);
+ assert_eq!(route.paths[0][2].node_features.le_flags(), &id_to_feature_flags!(1));
+ assert_eq!(route.paths[0][2].channel_features.le_flags(), &id_to_feature_flags!(3));
+ }
+
+ { // If we specify a channel to node8, that overrides our local channel view and that gets used
+ let our_chans = vec![channelmanager::ChannelDetails {
+ channel_id: [0; 32],
+ short_channel_id: Some(42),
+ remote_network_id: node8.clone(),
+ counterparty_features: InitFeatures::from_le_bytes(vec![0b11]),
+ channel_value_satoshis: 0,
+ user_id: 0,
+ outbound_capacity_msat: 0,
+ inbound_capacity_msat: 0,
+ is_live: true,
+ }];
+ let route = router.get_route(&node3, Some(&our_chans), &Vec::new(), 100, 42).unwrap();
+ assert_eq!(route.paths[0].len(), 2);
+
+ assert_eq!(route.paths[0][0].pubkey, node8);
+ assert_eq!(route.paths[0][0].short_channel_id, 42);
+ assert_eq!(route.paths[0][0].fee_msat, 200);
+ assert_eq!(route.paths[0][0].cltv_expiry_delta, (13 << 8) | 1);
+ assert_eq!(route.paths[0][0].node_features.le_flags(), &vec![0b11]);
+ assert_eq!(route.paths[0][0].channel_features.le_flags(), &Vec::new()); // No feature flags will meet the relevant-to-channel conversion
+
+ assert_eq!(route.paths[0][1].pubkey, node3);
+ assert_eq!(route.paths[0][1].short_channel_id, 13);
+ assert_eq!(route.paths[0][1].fee_msat, 100);
+ assert_eq!(route.paths[0][1].cltv_expiry_delta, 42);
+ assert_eq!(route.paths[0][1].node_features.le_flags(), &id_to_feature_flags!(3));
+ assert_eq!(route.paths[0][1].channel_features.le_flags(), &id_to_feature_flags!(13));