@@ -412,8 +412,8 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
412
412
proportional_millionths: forwarding_info. fee_proportional_millionths,
413
413
} ,
414
414
cltv_expiry_delta: forwarding_info. cltv_expiry_delta,
415
- htlc_minimum_msat: None ,
416
- htlc_maximum_msat: None , } ] )
415
+ htlc_minimum_msat: channel . inbound_htlc_minimum_msat ,
416
+ htlc_maximum_msat: channel . inbound_htlc_maximum_msat , } ] )
417
417
} ;
418
418
// If all channels are private, return the route hint for the highest inbound capacity channel
419
419
// per counterparty node. If channels with an higher inbound capacity than the
@@ -535,10 +535,13 @@ mod test {
535
535
536
536
// Invoice SCIDs should always use inbound SCID aliases over the real channel ID, if one is
537
537
// available.
538
+ let chan = & nodes[ 1 ] . node . list_usable_channels ( ) [ 0 ] ;
538
539
assert_eq ! ( invoice. route_hints( ) . len( ) , 1 ) ;
539
540
assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 . len( ) , 1 ) ;
540
- assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 [ 0 ] . short_channel_id,
541
- nodes[ 1 ] . node. list_usable_channels( ) [ 0 ] . inbound_scid_alias. unwrap( ) ) ;
541
+ assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 [ 0 ] . short_channel_id, chan. inbound_scid_alias. unwrap( ) ) ;
542
+
543
+ assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 [ 0 ] . htlc_minimum_msat, chan. inbound_htlc_minimum_msat) ;
544
+ assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 [ 0 ] . htlc_maximum_msat, chan. inbound_htlc_maximum_msat) ;
542
545
543
546
let payment_params = PaymentParameters :: from_node_id ( invoice. recover_payee_pub_key ( ) )
544
547
. with_features ( invoice. features ( ) . unwrap ( ) . clone ( ) )
@@ -879,6 +882,40 @@ mod test {
879
882
}
880
883
}
881
884
885
+ #[ test]
886
+ #[ cfg( feature = "std" ) ]
887
+ fn test_multi_node_hints_has_htlc_min_max_values ( ) {
888
+ let mut chanmon_cfgs = create_chanmon_cfgs ( 3 ) ;
889
+ let seed_1 = [ 42 as u8 ; 32 ] ;
890
+ let seed_2 = [ 43 as u8 ; 32 ] ;
891
+ let cross_node_seed = [ 44 as u8 ; 32 ] ;
892
+ chanmon_cfgs[ 1 ] . keys_manager . backing = PhantomKeysManager :: new ( & seed_1, 43 , 44 , & cross_node_seed) ;
893
+ chanmon_cfgs[ 2 ] . keys_manager . backing = PhantomKeysManager :: new ( & seed_2, 43 , 44 , & cross_node_seed) ;
894
+ let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
895
+ let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ None , None , None ] ) ;
896
+ let nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
897
+
898
+ create_unannounced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 100000 , 10001 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
899
+ create_unannounced_chan_between_nodes_with_value ( & nodes, 0 , 2 , 100000 , 10001 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
900
+
901
+ let payment_amt = 20_000 ;
902
+ let ( payment_hash, _payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( payment_amt) , 3600 ) . unwrap ( ) ;
903
+ let route_hints = vec ! [
904
+ nodes[ 1 ] . node. get_phantom_route_hints( ) ,
905
+ nodes[ 2 ] . node. get_phantom_route_hints( ) ,
906
+ ] ;
907
+
908
+ let invoice = :: utils:: create_phantom_invoice :: < EnforcingSigner , & test_utils:: TestKeysInterface > ( Some ( payment_amt) , Some ( payment_hash) , "test" . to_string ( ) , 3600 , route_hints, & nodes[ 1 ] . keys_manager , Currency :: BitcoinTestnet ) . unwrap ( ) ;
909
+
910
+ let chan_0_1 = & nodes[ 1 ] . node . list_usable_channels ( ) [ 0 ] ;
911
+ assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 [ 0 ] . htlc_minimum_msat, chan_0_1. inbound_htlc_minimum_msat) ;
912
+ assert_eq ! ( invoice. route_hints( ) [ 0 ] . 0 [ 0 ] . htlc_maximum_msat, chan_0_1. inbound_htlc_maximum_msat) ;
913
+
914
+ let chan_0_2 = & nodes[ 2 ] . node . list_usable_channels ( ) [ 0 ] ;
915
+ assert_eq ! ( invoice. route_hints( ) [ 1 ] . 0 [ 0 ] . htlc_minimum_msat, chan_0_2. inbound_htlc_minimum_msat) ;
916
+ assert_eq ! ( invoice. route_hints( ) [ 1 ] . 0 [ 0 ] . htlc_maximum_msat, chan_0_2. inbound_htlc_maximum_msat) ;
917
+ }
918
+
882
919
#[ test]
883
920
#[ cfg( feature = "std" ) ]
884
921
fn create_phantom_invoice_with_description_hash ( ) {
0 commit comments