@@ -871,7 +871,7 @@ where L::Target: Logger {
871
871
HashMap :: with_capacity ( network_nodes. len ( ) ) ;
872
872
873
873
// Keeping track of how much value we already collected across other paths. Helps to decide
874
- // when we want to stop looking for new paths.
874
+ // when we want to stop looking for new paths.
875
875
let mut already_collected_value_msat = 0 ;
876
876
877
877
for ( _, channels) in first_hop_targets. iter_mut ( ) {
@@ -4013,7 +4013,8 @@ mod tests {
4013
4013
let scorer = test_utils:: TestScorer :: with_penalty ( 0 ) ;
4014
4014
let keys_manager = test_utils:: TestKeysInterface :: new ( & [ 0u8 ; 32 ] , Network :: Testnet ) ;
4015
4015
let random_seed_bytes = keys_manager. get_secure_random_bytes ( ) ;
4016
- let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] ) . with_features ( InvoiceFeatures :: known ( ) ) ;
4016
+ let payment_params = PaymentParameters :: from_node_id ( nodes[ 2 ] )
4017
+ . with_features ( InvoiceFeatures :: known ( ) ) ;
4017
4018
4018
4019
// We need a route consisting of 3 paths:
4019
4020
// From our node to node2 via node0, node7, node1 (three paths one hop each).
@@ -4106,17 +4107,19 @@ mod tests {
4106
4107
{
4107
4108
// Attempt to route more than available results in a failure.
4108
4109
if let Err ( LightningError { err, action : ErrorAction :: IgnoreError } ) = get_route (
4109
- & our_id, & payment_params, & network_graph. read_only ( ) , None , 300_000 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) {
4110
- assert_eq ! ( err, "Failed to find a sufficient route to the given destination" ) ;
4110
+ & our_id, & payment_params, & network_graph. read_only ( ) , None , 300_000 , 42 ,
4111
+ Arc :: clone ( & logger) , & scorer, & random_seed_bytes) {
4112
+ assert_eq ! ( err, "Failed to find a sufficient route to the given destination" ) ;
4111
4113
} else { panic ! ( ) ; }
4112
4114
}
4113
4115
4114
4116
{
4115
4117
// Attempt to route while setting max_mpp_path_count to 0 results in a failure..
4116
4118
let zero_payment_params = payment_params. clone ( ) . with_max_mpp_path_count ( 0 ) ;
4117
4119
if let Err ( LightningError { err, action : ErrorAction :: IgnoreError } ) = get_route (
4118
- & our_id, & zero_payment_params, & network_graph. read_only ( ) , None , 100 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) {
4119
- assert_eq ! ( err, "Can't find an MPP route with no paths allowed." ) ;
4120
+ & our_id, & zero_payment_params, & network_graph. read_only ( ) , None , 100 , 42 ,
4121
+ Arc :: clone ( & logger) , & scorer, & random_seed_bytes) {
4122
+ assert_eq ! ( err, "Can't find an MPP route with no paths allowed." ) ;
4120
4123
} else { panic ! ( ) ; }
4121
4124
}
4122
4125
@@ -4126,15 +4129,17 @@ mod tests {
4126
4129
// to account for 1/3 of the total value, which is violated by 2 out of 3 paths.
4127
4130
let fail_payment_params = payment_params. clone ( ) . with_max_mpp_path_count ( 3 ) ;
4128
4131
if let Err ( LightningError { err, action : ErrorAction :: IgnoreError } ) = get_route (
4129
- & our_id, & fail_payment_params, & network_graph. read_only ( ) , None , 250_000 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) {
4130
- assert_eq ! ( err, "Failed to find a sufficient route to the given destination" ) ;
4132
+ & our_id, & fail_payment_params, & network_graph. read_only ( ) , None , 250_000 , 42 ,
4133
+ Arc :: clone ( & logger) , & scorer, & random_seed_bytes) {
4134
+ assert_eq ! ( err, "Failed to find a sufficient route to the given destination" ) ;
4131
4135
} else { panic ! ( ) ; }
4132
4136
}
4133
4137
4134
4138
{
4135
4139
// Now, attempt to route 250 sats (just a bit below the capacity).
4136
4140
// Our algorithm should provide us with these 3 paths.
4137
- let route = get_route ( & our_id, & payment_params, & network_graph. read_only ( ) , None , 250_000 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) . unwrap ( ) ;
4141
+ let route = get_route ( & our_id, & payment_params, & network_graph. read_only ( ) , None ,
4142
+ 250_000 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) . unwrap ( ) ;
4138
4143
assert_eq ! ( route. paths. len( ) , 3 ) ;
4139
4144
let mut total_amount_paid_msat = 0 ;
4140
4145
for path in & route. paths {
@@ -4147,7 +4152,8 @@ mod tests {
4147
4152
4148
4153
{
4149
4154
// Attempt to route an exact amount is also fine
4150
- let route = get_route ( & our_id, & payment_params, & network_graph. read_only ( ) , None , 290_000 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) . unwrap ( ) ;
4155
+ let route = get_route ( & our_id, & payment_params, & network_graph. read_only ( ) , None ,
4156
+ 290_000 , 42 , Arc :: clone ( & logger) , & scorer, & random_seed_bytes) . unwrap ( ) ;
4151
4157
assert_eq ! ( route. paths. len( ) , 3 ) ;
4152
4158
let mut total_amount_paid_msat = 0 ;
4153
4159
for path in & route. paths {
0 commit comments