@@ -390,28 +390,28 @@ impl Writeable for Route {
390
390
write_ver_prefix ! ( writer, SERIALIZATION_VERSION , MIN_SERIALIZATION_VERSION ) ;
391
391
( self . paths . len ( ) as u64 ) . write ( writer) ?;
392
392
let mut blinded_tails = Vec :: new ( ) ;
393
- for path in self . paths . iter ( ) {
393
+ for ( idx , path) in self . paths . iter ( ) . enumerate ( ) {
394
394
( path. hops . len ( ) as u8 ) . write ( writer) ?;
395
- for ( idx , hop) in path. hops . iter ( ) . enumerate ( ) {
395
+ for hop in path. hops . iter ( ) {
396
396
hop. write ( writer) ?;
397
- if let Some ( blinded_tail) = & path. blinded_tail {
398
- if blinded_tails. is_empty ( ) {
399
- blinded_tails = Vec :: with_capacity ( path. hops . len ( ) ) ;
400
- for _ in 0 ..idx {
401
- blinded_tails. push ( None ) ;
402
- }
403
- }
404
- blinded_tails. push ( Some ( blinded_tail) ) ;
405
- } else if !blinded_tails. is_empty ( ) { blinded_tails. push ( None ) ; }
406
397
}
398
+ if let Some ( blinded_tail) = & path. blinded_tail {
399
+ if blinded_tails. is_empty ( ) {
400
+ blinded_tails = Vec :: with_capacity ( path. hops . len ( ) ) ;
401
+ for _ in 0 ..idx {
402
+ blinded_tails. push ( None ) ;
403
+ }
404
+ }
405
+ blinded_tails. push ( Some ( blinded_tail) ) ;
406
+ } else if !blinded_tails. is_empty ( ) { blinded_tails. push ( None ) ; }
407
407
}
408
408
write_tlv_fields ! ( writer, {
409
409
// For compatibility with LDK versions prior to 0.0.117, we take the individual
410
410
// RouteParameters' fields and reconstruct them on read.
411
411
( 1 , self . route_params. as_ref( ) . map( |p| & p. payment_params) , option) ,
412
412
( 2 , blinded_tails, optional_vec) ,
413
413
( 3 , self . route_params. as_ref( ) . map( |p| p. final_value_msat) , option) ,
414
- ( 5 , self . route_params. as_ref( ) . map ( |p| p. max_total_routing_fee_msat) , option) ,
414
+ ( 5 , self . route_params. as_ref( ) . and_then ( |p| p. max_total_routing_fee_msat) , option) ,
415
415
} ) ;
416
416
Ok ( ( ) )
417
417
}
0 commit comments