@@ -502,28 +502,28 @@ impl Writeable for Route {
502
502
write_ver_prefix ! ( writer, SERIALIZATION_VERSION , MIN_SERIALIZATION_VERSION ) ;
503
503
( self . paths . len ( ) as u64 ) . write ( writer) ?;
504
504
let mut blinded_tails = Vec :: new ( ) ;
505
- for path in self . paths . iter ( ) {
505
+ for ( idx , path) in self . paths . iter ( ) . enumerate ( ) {
506
506
( path. hops . len ( ) as u8 ) . write ( writer) ?;
507
- for ( idx , hop) in path. hops . iter ( ) . enumerate ( ) {
507
+ for hop in path. hops . iter ( ) {
508
508
hop. write ( writer) ?;
509
- if let Some ( blinded_tail) = & path. blinded_tail {
510
- if blinded_tails. is_empty ( ) {
511
- blinded_tails = Vec :: with_capacity ( path. hops . len ( ) ) ;
512
- for _ in 0 ..idx {
513
- blinded_tails. push ( None ) ;
514
- }
515
- }
516
- blinded_tails. push ( Some ( blinded_tail) ) ;
517
- } else if !blinded_tails. is_empty ( ) { blinded_tails. push ( None ) ; }
518
509
}
510
+ if let Some ( blinded_tail) = & path. blinded_tail {
511
+ if blinded_tails. is_empty ( ) {
512
+ blinded_tails = Vec :: with_capacity ( path. hops . len ( ) ) ;
513
+ for _ in 0 ..idx {
514
+ blinded_tails. push ( None ) ;
515
+ }
516
+ }
517
+ blinded_tails. push ( Some ( blinded_tail) ) ;
518
+ } else if !blinded_tails. is_empty ( ) { blinded_tails. push ( None ) ; }
519
519
}
520
520
write_tlv_fields ! ( writer, {
521
521
// For compatibility with LDK versions prior to 0.0.117, we take the individual
522
522
// RouteParameters' fields and reconstruct them on read.
523
523
( 1 , self . route_params. as_ref( ) . map( |p| & p. payment_params) , option) ,
524
524
( 2 , blinded_tails, optional_vec) ,
525
525
( 3 , self . route_params. as_ref( ) . map( |p| p. final_value_msat) , option) ,
526
- ( 5 , self . route_params. as_ref( ) . map ( |p| p. max_total_routing_fee_msat) , option) ,
526
+ ( 5 , self . route_params. as_ref( ) . and_then ( |p| p. max_total_routing_fee_msat) , option) ,
527
527
} ) ;
528
528
Ok ( ( ) )
529
529
}
0 commit comments