@@ -25,7 +25,7 @@ use crate::ln::channel::{Channel, ChannelError};
25
25
use crate :: ln:: { chan_utils, onion_utils} ;
26
26
use crate :: ln:: chan_utils:: { OFFERED_HTLC_SCRIPT_WEIGHT , htlc_success_tx_weight, htlc_timeout_tx_weight, HTLCOutputInCommitment } ;
27
27
use crate :: routing:: gossip:: { NetworkGraph , NetworkUpdate } ;
28
- use crate :: routing:: router:: { PaymentParameters , Route , RouteHop , RouteParameters , find_route, get_route} ;
28
+ use crate :: routing:: router:: { Path , PaymentParameters , Route , RouteHop , RouteParameters , find_route, get_route} ;
29
29
use crate :: ln:: features:: { ChannelFeatures , NodeFeatures } ;
30
30
use crate :: ln:: msgs;
31
31
use crate :: ln:: msgs:: { ChannelMessageHandler , RoutingMessageHandler , ErrorAction } ;
@@ -1035,7 +1035,7 @@ fn fake_network_test() {
1035
1035
} ) ;
1036
1036
hops[ 1 ] . fee_msat = chan_4. 1 . contents . fee_base_msat as u64 + chan_4. 1 . contents . fee_proportional_millionths as u64 * hops[ 2 ] . fee_msat as u64 / 1000000 ;
1037
1037
hops[ 0 ] . fee_msat = chan_3. 0 . contents . fee_base_msat as u64 + chan_3. 0 . contents . fee_proportional_millionths as u64 * hops[ 1 ] . fee_msat as u64 / 1000000 ;
1038
- let payment_preimage_1 = send_along_route ( & nodes[ 1 ] , Route { paths : vec ! [ hops] , payment_params : None } , & vec ! ( & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 1 ] ) [ ..] , 1000000 ) . 0 ;
1038
+ let payment_preimage_1 = send_along_route ( & nodes[ 1 ] , Route { paths : vec ! [ Path { hops, blinded_tail : None } ] , payment_params : None } , & vec ! ( & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 1 ] ) [ ..] , 1000000 ) . 0 ;
1039
1039
1040
1040
let mut hops = Vec :: with_capacity ( 3 ) ;
1041
1041
hops. push ( RouteHop {
@@ -1064,7 +1064,7 @@ fn fake_network_test() {
1064
1064
} ) ;
1065
1065
hops[ 1 ] . fee_msat = chan_2. 1 . contents . fee_base_msat as u64 + chan_2. 1 . contents . fee_proportional_millionths as u64 * hops[ 2 ] . fee_msat as u64 / 1000000 ;
1066
1066
hops[ 0 ] . fee_msat = chan_3. 1 . contents . fee_base_msat as u64 + chan_3. 1 . contents . fee_proportional_millionths as u64 * hops[ 1 ] . fee_msat as u64 / 1000000 ;
1067
- let payment_hash_2 = send_along_route ( & nodes[ 1 ] , Route { paths : vec ! [ hops] , payment_params : None } , & vec ! ( & nodes[ 3 ] , & nodes[ 2 ] , & nodes[ 1 ] ) [ ..] , 1000000 ) . 1 ;
1067
+ let payment_hash_2 = send_along_route ( & nodes[ 1 ] , Route { paths : vec ! [ Path { hops, blinded_tail : None } ] , payment_params : None } , & vec ! ( & nodes[ 3 ] , & nodes[ 2 ] , & nodes[ 1 ] ) [ ..] , 1000000 ) . 1 ;
1068
1068
1069
1069
// Claim the rebalances...
1070
1070
fail_payment ( & nodes[ 1 ] , & vec ! ( & nodes[ 3 ] , & nodes[ 2 ] , & nodes[ 1 ] ) [ ..] , payment_hash_2) ;
@@ -1805,7 +1805,7 @@ fn test_channel_reserve_holding_cell_htlcs() {
1805
1805
let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] . node . get_our_node_id ( ) , TEST_FINAL_CLTV )
1806
1806
. with_features ( nodes[ 2 ] . node . invoice_features ( ) ) . with_max_channel_saturation_power_of_half ( 0 ) ;
1807
1807
let ( mut route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params, recv_value_0, TEST_FINAL_CLTV ) ;
1808
- route. paths [ 0 ] . last_mut ( ) . unwrap ( ) . fee_msat += 1 ;
1808
+ route. paths [ 0 ] . hops . last_mut ( ) . unwrap ( ) . fee_msat += 1 ;
1809
1809
assert ! ( route. paths[ 0 ] . iter( ) . rev( ) . skip( 1 ) . all( |h| h. fee_msat == feemsat) ) ;
1810
1810
1811
1811
unwrap_send_err ! ( nodes[ 0 ] . node. send_payment( & route, our_payment_hash, & Some ( our_payment_secret) , PaymentId ( our_payment_hash. 0 ) ) , true , APIError :: ChannelUnavailable { ref err } ,
@@ -5697,7 +5697,7 @@ fn test_fail_holding_cell_htlc_upon_free() {
5697
5697
assert_eq ! ( PaymentId ( our_payment_hash. 0 ) , * payment_id. as_ref( ) . unwrap( ) ) ;
5698
5698
assert_eq ! ( our_payment_hash. clone( ) , * payment_hash) ;
5699
5699
assert_eq ! ( * payment_failed_permanently, false ) ;
5700
- assert_eq ! ( * short_channel_id, Some ( route. paths[ 0 ] [ 0 ] . short_channel_id) ) ;
5700
+ assert_eq ! ( * short_channel_id, Some ( route. paths[ 0 ] . hops [ 0 ] . short_channel_id) ) ;
5701
5701
} ,
5702
5702
_ => panic ! ( "Unexpected event" ) ,
5703
5703
}
@@ -5786,7 +5786,7 @@ fn test_free_and_fail_holding_cell_htlcs() {
5786
5786
assert_eq ! ( payment_id_2, * payment_id. as_ref( ) . unwrap( ) ) ;
5787
5787
assert_eq ! ( payment_hash_2. clone( ) , * payment_hash) ;
5788
5788
assert_eq ! ( * payment_failed_permanently, false ) ;
5789
- assert_eq ! ( * short_channel_id, Some ( route_2. paths[ 0 ] [ 0 ] . short_channel_id) ) ;
5789
+ assert_eq ! ( * short_channel_id, Some ( route_2. paths[ 0 ] . hops [ 0 ] . short_channel_id) ) ;
5790
5790
} ,
5791
5791
_ => panic ! ( "Unexpected event" ) ,
5792
5792
}
@@ -5982,7 +5982,7 @@ fn test_update_add_htlc_bolt2_sender_value_below_minimum_msat() {
5982
5982
let _chan = create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 100000 , 95000000 ) ;
5983
5983
5984
5984
let ( mut route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 100000 ) ;
5985
- route. paths [ 0 ] [ 0 ] . fee_msat = 100 ;
5985
+ route. paths [ 0 ] . hops [ 0 ] . fee_msat = 100 ;
5986
5986
5987
5987
unwrap_send_err ! ( nodes[ 0 ] . node. send_payment( & route, our_payment_hash, & Some ( our_payment_secret) , PaymentId ( our_payment_hash. 0 ) ) , true , APIError :: ChannelUnavailable { ref err } ,
5988
5988
assert!( regex:: Regex :: new( r"Cannot send less than their minimum HTLC value \(\d+\)" ) . unwrap( ) . is_match( err) ) ) ;
@@ -6000,7 +6000,7 @@ fn test_update_add_htlc_bolt2_sender_zero_value_msat() {
6000
6000
let _chan = create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 100000 , 95000000 ) ;
6001
6001
6002
6002
let ( mut route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 100000 ) ;
6003
- route. paths [ 0 ] [ 0 ] . fee_msat = 0 ;
6003
+ route. paths [ 0 ] . hops [ 0 ] . fee_msat = 0 ;
6004
6004
unwrap_send_err ! ( nodes[ 0 ] . node. send_payment( & route, our_payment_hash, & Some ( our_payment_secret) , PaymentId ( our_payment_hash. 0 ) ) , true , APIError :: ChannelUnavailable { ref err } ,
6005
6005
assert_eq!( err, "Cannot send 0-msat HTLC" ) ) ;
6006
6006
@@ -6043,7 +6043,7 @@ fn test_update_add_htlc_bolt2_sender_cltv_expiry_too_high() {
6043
6043
let payment_params = PaymentParameters :: from_node_id ( nodes[ 1 ] . node . get_our_node_id ( ) , 0 )
6044
6044
. with_features ( nodes[ 1 ] . node . invoice_features ( ) ) ;
6045
6045
let ( mut route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , payment_params, 100000000 , 0 ) ;
6046
- route. paths [ 0 ] . last_mut ( ) . unwrap ( ) . cltv_expiry_delta = 500000001 ;
6046
+ route. paths [ 0 ] . hops . last_mut ( ) . unwrap ( ) . cltv_expiry_delta = 500000001 ;
6047
6047
unwrap_send_err ! ( nodes[ 0 ] . node. send_payment( & route, our_payment_hash, & Some ( our_payment_secret) , PaymentId ( our_payment_hash. 0 ) ) , true , APIError :: InvalidRoute { ref err } ,
6048
6048
assert_eq!( err, & "Channel CLTV overflowed?" ) ) ;
6049
6049
}
@@ -6107,7 +6107,7 @@ fn test_update_add_htlc_bolt2_sender_exceed_max_htlc_value_in_flight() {
6107
6107
let ( mut route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , max_in_flight) ;
6108
6108
// Manually create a route over our max in flight (which our router normally automatically
6109
6109
// limits us to.
6110
- route. paths [ 0 ] [ 0 ] . fee_msat = max_in_flight + 1 ;
6110
+ route. paths [ 0 ] . hops [ 0 ] . fee_msat = max_in_flight + 1 ;
6111
6111
unwrap_send_err ! ( nodes[ 0 ] . node. send_payment( & route, our_payment_hash, & Some ( our_payment_secret) , PaymentId ( our_payment_hash. 0 ) ) , true , APIError :: ChannelUnavailable { ref err } ,
6112
6112
assert!( regex:: Regex :: new( r"Cannot send value that would put us over the max HTLC value in flight our peer will accept \(\d+\)" ) . unwrap( ) . is_match( err) ) ) ;
6113
6113
@@ -7578,7 +7578,7 @@ fn test_pending_claimed_htlc_no_balance_underflow() {
7578
7578
// almost-claimed HTLC as available balance.
7579
7579
let ( mut route, _, _, _) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 1 ] , 10_000 ) ;
7580
7580
route. payment_params = None ; // This is all wrong, but unnecessary
7581
- route. paths [ 0 ] [ 0 ] . pubkey = nodes[ 0 ] . node . get_our_node_id ( ) ;
7581
+ route. paths [ 0 ] . hops [ 0 ] . pubkey = nodes[ 0 ] . node . get_our_node_id ( ) ;
7582
7582
let ( _, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
7583
7583
nodes[ 1 ] . node . send_payment ( & route, payment_hash_2, & Some ( payment_secret_2) , PaymentId ( payment_hash_2. 0 ) ) . unwrap ( ) ;
7584
7584
@@ -7941,12 +7941,12 @@ fn test_simple_mpp() {
7941
7941
let ( mut route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash ! ( & nodes[ 0 ] , nodes[ 3 ] , 100000 ) ;
7942
7942
let path = route. paths [ 0 ] . clone ( ) ;
7943
7943
route. paths . push ( path) ;
7944
- route. paths [ 0 ] [ 0 ] . pubkey = nodes[ 1 ] . node . get_our_node_id ( ) ;
7945
- route. paths [ 0 ] [ 0 ] . short_channel_id = chan_1_id;
7946
- route. paths [ 0 ] [ 1 ] . short_channel_id = chan_3_id;
7947
- route. paths [ 1 ] [ 0 ] . pubkey = nodes[ 2 ] . node . get_our_node_id ( ) ;
7948
- route. paths [ 1 ] [ 0 ] . short_channel_id = chan_2_id;
7949
- route. paths [ 1 ] [ 1 ] . short_channel_id = chan_4_id;
7944
+ route. paths [ 0 ] . hops [ 0 ] . pubkey = nodes[ 1 ] . node . get_our_node_id ( ) ;
7945
+ route. paths [ 0 ] . hops [ 0 ] . short_channel_id = chan_1_id;
7946
+ route. paths [ 0 ] . hops [ 1 ] . short_channel_id = chan_3_id;
7947
+ route. paths [ 1 ] . hops [ 0 ] . pubkey = nodes[ 2 ] . node . get_our_node_id ( ) ;
7948
+ route. paths [ 1 ] . hops [ 0 ] . short_channel_id = chan_2_id;
7949
+ route. paths [ 1 ] . hops [ 1 ] . short_channel_id = chan_4_id;
7950
7950
send_along_route_with_secret ( & nodes[ 0 ] , route, & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] ] , 200_000 , payment_hash, payment_secret) ;
7951
7951
claim_payment_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] ] , false , payment_preimage) ;
7952
7952
}
@@ -9127,7 +9127,7 @@ fn test_inconsistent_mpp_params() {
9127
9127
assert_eq ! ( route. paths. len( ) , 2 ) ;
9128
9128
route. paths . sort_by ( |path_a, _| {
9129
9129
// Sort the path so that the path through nodes[1] comes first
9130
- if path_a[ 0 ] . pubkey == nodes[ 1 ] . node . get_our_node_id ( ) {
9130
+ if path_a. hops [ 0 ] . pubkey == nodes[ 1 ] . node . get_our_node_id ( ) {
9131
9131
core:: cmp:: Ordering :: Less } else { core:: cmp:: Ordering :: Greater }
9132
9132
} ) ;
9133
9133
@@ -9314,7 +9314,7 @@ fn test_double_partial_claim() {
9314
9314
assert_eq ! ( route. paths. len( ) , 2 ) ;
9315
9315
route. paths . sort_by ( |path_a, _| {
9316
9316
// Sort the path so that the path through nodes[1] comes first
9317
- if path_a[ 0 ] . pubkey == nodes[ 1 ] . node . get_our_node_id ( ) {
9317
+ if path_a. hops [ 0 ] . pubkey == nodes[ 1 ] . node . get_our_node_id ( ) {
9318
9318
core:: cmp:: Ordering :: Less } else { core:: cmp:: Ordering :: Greater }
9319
9319
} ) ;
9320
9320
0 commit comments