3131//! # use lightning::offers::invoice::BlindedPayInfo; 
3232//! # use lightning::blinded_path::BlindedPath; 
3333//! # 
34- //! # fn create_payment_paths() -> Vec<(BlindedPath, BlindedPayInfo )> { unimplemented!() } 
34+ //! # fn create_payment_paths() -> Vec<(BlindedPayInfo, BlindedPath )> { unimplemented!() } 
3535//! # fn create_payment_hash() -> PaymentHash { unimplemented!() } 
3636//! # 
3737//! # fn parse_invoice_request(bytes: Vec<u8>) -> Result<(), lightning::offers::parse::ParseError> { 
@@ -166,7 +166,7 @@ impl SigningPubkeyStrategy for DerivedSigningPubkey {}
166166
167167impl < ' a >  InvoiceBuilder < ' a ,  ExplicitSigningPubkey >  { 
168168	pub ( super )  fn  for_offer ( 
169- 		invoice_request :  & ' a  InvoiceRequest ,  payment_paths :  Vec < ( BlindedPath ,   BlindedPayInfo ) > , 
169+ 		invoice_request :  & ' a  InvoiceRequest ,  payment_paths :  Vec < ( BlindedPayInfo ,   BlindedPath ) > , 
170170		created_at :  Duration ,  payment_hash :  PaymentHash 
171171	)  -> Result < Self ,  SemanticError >  { 
172172		let  amount_msats = Self :: check_amount_msats ( invoice_request) ?; 
@@ -182,7 +182,7 @@ impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey> {
182182	} 
183183
184184	pub ( super )  fn  for_refund ( 
185- 		refund :  & ' a  Refund ,  payment_paths :  Vec < ( BlindedPath ,   BlindedPayInfo ) > ,  created_at :  Duration , 
185+ 		refund :  & ' a  Refund ,  payment_paths :  Vec < ( BlindedPayInfo ,   BlindedPath ) > ,  created_at :  Duration , 
186186		payment_hash :  PaymentHash ,  signing_pubkey :  PublicKey 
187187	)  -> Result < Self ,  SemanticError >  { 
188188		let  amount_msats = refund. amount_msats ( ) ; 
@@ -199,7 +199,7 @@ impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey> {
199199
200200impl < ' a >  InvoiceBuilder < ' a ,  DerivedSigningPubkey >  { 
201201	pub ( super )  fn  for_offer_using_keys ( 
202- 		invoice_request :  & ' a  InvoiceRequest ,  payment_paths :  Vec < ( BlindedPath ,   BlindedPayInfo ) > , 
202+ 		invoice_request :  & ' a  InvoiceRequest ,  payment_paths :  Vec < ( BlindedPayInfo ,   BlindedPath ) > , 
203203		created_at :  Duration ,  payment_hash :  PaymentHash ,  keys :  KeyPair 
204204	)  -> Result < Self ,  SemanticError >  { 
205205		let  amount_msats = Self :: check_amount_msats ( invoice_request) ?; 
@@ -215,7 +215,7 @@ impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey> {
215215	} 
216216
217217	pub ( super )  fn  for_refund_using_keys ( 
218- 		refund :  & ' a  Refund ,  payment_paths :  Vec < ( BlindedPath ,   BlindedPayInfo ) > ,  created_at :  Duration , 
218+ 		refund :  & ' a  Refund ,  payment_paths :  Vec < ( BlindedPayInfo ,   BlindedPath ) > ,  created_at :  Duration , 
219219		payment_hash :  PaymentHash ,  keys :  KeyPair , 
220220	)  -> Result < Self ,  SemanticError >  { 
221221		let  amount_msats = refund. amount_msats ( ) ; 
@@ -247,7 +247,7 @@ impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
247247	} 
248248
249249	fn  fields ( 
250- 		payment_paths :  Vec < ( BlindedPath ,   BlindedPayInfo ) > ,  created_at :  Duration , 
250+ 		payment_paths :  Vec < ( BlindedPayInfo ,   BlindedPath ) > ,  created_at :  Duration , 
251251		payment_hash :  PaymentHash ,  amount_msats :  u64 ,  signing_pubkey :  PublicKey 
252252	)  -> InvoiceFields  { 
253253		InvoiceFields  { 
@@ -454,7 +454,7 @@ enum InvoiceContents {
454454/// Invoice-specific fields for an `invoice` message. 
455455#[ derive( Clone ,  Debug ,  PartialEq ) ]  
456456struct  InvoiceFields  { 
457- 	payment_paths :  Vec < ( BlindedPath ,   BlindedPayInfo ) > , 
457+ 	payment_paths :  Vec < ( BlindedPayInfo ,   BlindedPath ) > , 
458458	created_at :  Duration , 
459459	relative_expiry :  Option < Duration > , 
460460	payment_hash :  PaymentHash , 
@@ -476,7 +476,7 @@ impl Invoice {
476476/// 
477477/// Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this 
478478/// privacy is lost if a public node id is used for [`Invoice::signing_pubkey`]. 
479- pub  fn  payment_paths ( & self )  -> & [ ( BlindedPath ,   BlindedPayInfo ) ]  { 
479+ pub  fn  payment_paths ( & self )  -> & [ ( BlindedPayInfo ,   BlindedPath ) ]  { 
480480		& self . contents . fields ( ) . payment_paths [ ..] 
481481	} 
482482
@@ -703,8 +703,8 @@ impl InvoiceFields {
703703		} ; 
704704
705705		InvoiceTlvStreamRef  { 
706- 			paths :  Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( path ,  _ ) | path) ) ) , 
707- 			blindedpay :  Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( _ ,  payinfo ) | payinfo) ) ) , 
706+ 			paths :  Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( _ ,  path ) | path) ) ) , 
707+ 			blindedpay :  Some ( Iterable ( self . payment_paths . iter ( ) . map ( |( payinfo ,  _ ) | payinfo) ) ) , 
708708			created_at :  Some ( self . created_at . as_secs ( ) ) , 
709709			relative_expiry :  self . relative_expiry . map ( |duration| duration. as_secs ( )  as  u32 ) , 
710710			payment_hash :  Some ( & self . payment_hash ) , 
@@ -750,13 +750,13 @@ tlv_stream!(InvoiceTlvStream, InvoiceTlvStreamRef, 160..240, {
750750} ) ; 
751751
752752type  BlindedPathIter < ' a >  = core:: iter:: Map < 
753- 	core:: slice:: Iter < ' a ,  ( BlindedPath ,   BlindedPayInfo ) > , 
754- 	for <' r > fn ( & ' r  ( BlindedPath ,   BlindedPayInfo ) )  -> & ' r  BlindedPath , 
753+ 	core:: slice:: Iter < ' a ,  ( BlindedPayInfo ,   BlindedPath ) > , 
754+ 	for <' r > fn ( & ' r  ( BlindedPayInfo ,   BlindedPath ) )  -> & ' r  BlindedPath , 
755755> ; 
756756
757757type  BlindedPayInfoIter < ' a >  = core:: iter:: Map < 
758- 	core:: slice:: Iter < ' a ,  ( BlindedPath ,   BlindedPayInfo ) > , 
759- 	for <' r > fn ( & ' r  ( BlindedPath ,   BlindedPayInfo ) )  -> & ' r  BlindedPayInfo , 
758+ 	core:: slice:: Iter < ' a ,  ( BlindedPayInfo ,   BlindedPath ) > , 
759+ 	for <' r > fn ( & ' r  ( BlindedPayInfo ,   BlindedPath ) )  -> & ' r  BlindedPayInfo , 
760760> ; 
761761
762762/// Information needed to route a payment across a [`BlindedPath`]. 
@@ -878,15 +878,15 @@ impl TryFrom<PartialInvoiceTlvStream> for InvoiceContents {
878878			} , 
879879		)  = tlv_stream; 
880880
881- 		let  payment_paths = match  ( paths ,  blindedpay )  { 
882- 			( None ,  _ )  => return  Err ( SemanticError :: MissingPaths ) , 
883- 			( _ ,   None )  => return  Err ( SemanticError :: InvalidPayInfo ) , 
884- 			( Some ( paths) ,  _ )  if  paths. is_empty ( )  => return  Err ( SemanticError :: MissingPaths ) , 
885- 			( Some ( paths ) ,  Some ( blindedpay ) )  if  paths. len ( )  != blindedpay. len ( )  => { 
881+ 		let  payment_paths = match  ( blindedpay ,  paths )  { 
882+ 			( _ ,   None )  => return  Err ( SemanticError :: MissingPaths ) , 
883+ 			( None ,  _ )  => return  Err ( SemanticError :: InvalidPayInfo ) , 
884+ 			( _ ,   Some ( paths) )  if  paths. is_empty ( )  => return  Err ( SemanticError :: MissingPaths ) , 
885+ 			( Some ( blindedpay ) ,  Some ( paths ) )  if  paths. len ( )  != blindedpay. len ( )  => { 
886886				return  Err ( SemanticError :: InvalidPayInfo ) ; 
887887			} , 
888- 			( Some ( paths ) ,  Some ( blindedpay ) )  => { 
889- 				paths . into_iter ( ) . zip ( blindedpay . into_iter ( ) ) . collect :: < Vec < _ > > ( ) 
888+ 			( Some ( blindedpay ) ,  Some ( paths ) )  => { 
889+ 				blindedpay . into_iter ( ) . zip ( paths . into_iter ( ) ) . collect :: < Vec < _ > > ( ) 
890890			} , 
891891		} ; 
892892
@@ -1052,8 +1052,8 @@ mod tests {
10521052					payer_note:  None , 
10531053				} , 
10541054				InvoiceTlvStreamRef  { 
1055- 					paths:  Some ( Iterable ( payment_paths. iter( ) . map( |( path ,  _ ) | path) ) ) , 
1056- 					blindedpay:  Some ( Iterable ( payment_paths. iter( ) . map( |( _ ,  payinfo ) | payinfo) ) ) , 
1055+ 					paths:  Some ( Iterable ( payment_paths. iter( ) . map( |( _ ,  path ) | path) ) ) , 
1056+ 					blindedpay:  Some ( Iterable ( payment_paths. iter( ) . map( |( payinfo ,  _ ) | payinfo) ) ) , 
10571057					created_at:  Some ( now. as_secs( ) ) , 
10581058					relative_expiry:  None , 
10591059					payment_hash:  Some ( & payment_hash) , 
@@ -1130,8 +1130,8 @@ mod tests {
11301130					payer_note:  None , 
11311131				} , 
11321132				InvoiceTlvStreamRef  { 
1133- 					paths:  Some ( Iterable ( payment_paths. iter( ) . map( |( path ,  _ ) | path) ) ) , 
1134- 					blindedpay:  Some ( Iterable ( payment_paths. iter( ) . map( |( _ ,  payinfo ) | payinfo) ) ) , 
1133+ 					paths:  Some ( Iterable ( payment_paths. iter( ) . map( |( _ ,  path ) | path) ) ) , 
1134+ 					blindedpay:  Some ( Iterable ( payment_paths. iter( ) . map( |( payinfo ,  _ ) | payinfo) ) ) , 
11351135					created_at:  Some ( now. as_secs( ) ) , 
11361136					relative_expiry:  None , 
11371137					payment_hash:  Some ( & payment_hash) , 
@@ -1516,7 +1516,7 @@ mod tests {
15161516
15171517		let  empty_payment_paths = vec ! [ ] ; 
15181518		let  mut  tlv_stream = invoice. as_tlv_stream ( ) ; 
1519- 		tlv_stream. 3 . paths  = Some ( Iterable ( empty_payment_paths. iter ( ) . map ( |( path ,  _ ) | path) ) ) ; 
1519+ 		tlv_stream. 3 . paths  = Some ( Iterable ( empty_payment_paths. iter ( ) . map ( |( _ ,  path ) | path) ) ) ; 
15201520
15211521		match  Invoice :: try_from ( tlv_stream. to_bytes ( ) )  { 
15221522			Ok ( _)  => panic ! ( "expected error" ) , 
@@ -1526,7 +1526,7 @@ mod tests {
15261526		let  mut  payment_paths = payment_paths ( ) ; 
15271527		payment_paths. pop ( ) ; 
15281528		let  mut  tlv_stream = invoice. as_tlv_stream ( ) ; 
1529- 		tlv_stream. 3 . blindedpay  = Some ( Iterable ( payment_paths. iter ( ) . map ( |( _ ,  payinfo ) | payinfo) ) ) ; 
1529+ 		tlv_stream. 3 . blindedpay  = Some ( Iterable ( payment_paths. iter ( ) . map ( |( payinfo ,  _ ) | payinfo) ) ) ; 
15301530
15311531		match  Invoice :: try_from ( tlv_stream. to_bytes ( ) )  { 
15321532			Ok ( _)  => panic ! ( "expected error" ) , 
0 commit comments