@@ -170,8 +170,8 @@ macro_rules! refund_explicit_metadata_builder_methods { () => {
170170 Ok ( Self {
171171 refund: RefundContents {
172172 payer: PayerContents ( metadata) , description, absolute_expiry: None , issuer: None ,
173- paths : None , chain: None , amount_msats, features: InvoiceRequestFeatures :: empty( ) ,
174- quantity: None , payer_id, payer_note: None ,
173+ chain: None , amount_msats, features: InvoiceRequestFeatures :: empty( ) ,
174+ quantity: None , payer_id, payer_note: None , paths : None ,
175175 } ,
176176 secp_ctx: None ,
177177 } )
@@ -209,8 +209,8 @@ macro_rules! refund_builder_methods { (
209209 Ok ( Self {
210210 refund: RefundContents {
211211 payer: PayerContents ( metadata) , description, absolute_expiry: None , issuer: None ,
212- paths : None , chain: None , amount_msats, features: InvoiceRequestFeatures :: empty( ) ,
213- quantity: None , payer_id: node_id, payer_note: None ,
212+ chain: None , amount_msats, features: InvoiceRequestFeatures :: empty( ) ,
213+ quantity: None , payer_id: node_id, payer_note: None , paths : None ,
214214 } ,
215215 secp_ctx: Some ( secp_ctx) ,
216216 } )
@@ -410,14 +410,14 @@ pub(super) struct RefundContents {
410410 description : String ,
411411 absolute_expiry : Option < Duration > ,
412412 issuer : Option < String > ,
413- paths : Option < Vec < BlindedPath > > ,
414413 // invoice_request fields
415414 chain : Option < ChainHash > ,
416415 amount_msats : u64 ,
417416 features : InvoiceRequestFeatures ,
418417 quantity : Option < u64 > ,
419418 payer_id : PublicKey ,
420419 payer_note : Option < String > ,
420+ paths : Option < Vec < BlindedPath > > ,
421421}
422422
423423impl Refund {
@@ -734,7 +734,7 @@ impl RefundContents {
734734 description : Some ( & self . description ) ,
735735 features : None ,
736736 absolute_expiry : self . absolute_expiry . map ( |duration| duration. as_secs ( ) ) ,
737- paths : self . paths . as_ref ( ) ,
737+ paths : None ,
738738 issuer : self . issuer . as_ref ( ) ,
739739 quantity_max : None ,
740740 node_id : None ,
@@ -752,6 +752,7 @@ impl RefundContents {
752752 quantity : self . quantity ,
753753 payer_id : Some ( & self . payer_id ) ,
754754 payer_note : self . payer_note . as_ref ( ) ,
755+ paths : self . paths . as_ref ( ) ,
755756 } ;
756757
757758 ( payer, offer, invoice_request)
@@ -820,9 +821,12 @@ impl TryFrom<RefundTlvStream> for RefundContents {
820821 PayerTlvStream { metadata : payer_metadata } ,
821822 OfferTlvStream {
822823 chains, metadata, currency, amount : offer_amount, description,
823- features : offer_features, absolute_expiry, paths, issuer, quantity_max, node_id,
824+ features : offer_features, absolute_expiry, paths : offer_paths, issuer, quantity_max,
825+ node_id,
826+ } ,
827+ InvoiceRequestTlvStream {
828+ chain, amount, features, quantity, payer_id, payer_note, paths
824829 } ,
825- InvoiceRequestTlvStream { chain, amount, features, quantity, payer_id, payer_note } ,
826830 ) = tlv_stream;
827831
828832 let payer = match payer_metadata {
@@ -853,6 +857,10 @@ impl TryFrom<RefundTlvStream> for RefundContents {
853857
854858 let absolute_expiry = absolute_expiry. map ( Duration :: from_secs) ;
855859
860+ if offer_paths. is_some ( ) {
861+ return Err ( Bolt12SemanticError :: UnexpectedPaths ) ;
862+ }
863+
856864 if quantity_max. is_some ( ) {
857865 return Err ( Bolt12SemanticError :: UnexpectedQuantity ) ;
858866 }
@@ -877,8 +885,8 @@ impl TryFrom<RefundTlvStream> for RefundContents {
877885 } ;
878886
879887 Ok ( RefundContents {
880- payer, description, absolute_expiry, issuer, paths , chain, amount_msats, features,
881- quantity , payer_id, payer_note,
888+ payer, description, absolute_expiry, issuer, chain, amount_msats, features, quantity ,
889+ payer_id, payer_note, paths ,
882890 } )
883891 }
884892}
@@ -980,6 +988,7 @@ mod tests {
980988 quantity: None ,
981989 payer_id: Some ( & payer_pubkey( ) ) ,
982990 payer_note: None ,
991+ paths: None ,
983992 } ,
984993 ) ,
985994 ) ;
@@ -1173,12 +1182,12 @@ mod tests {
11731182 . path ( paths[ 1 ] . clone ( ) )
11741183 . build ( )
11751184 . unwrap ( ) ;
1176- let ( _, offer_tlv_stream, invoice_request_tlv_stream) = refund. as_tlv_stream ( ) ;
1177- assert_eq ! ( refund. paths( ) , paths. as_slice( ) ) ;
1185+ let ( _, _, invoice_request_tlv_stream) = refund. as_tlv_stream ( ) ;
11781186 assert_eq ! ( refund. payer_id( ) , pubkey( 42 ) ) ;
1187+ assert_eq ! ( refund. paths( ) , paths. as_slice( ) ) ;
11791188 assert_ne ! ( pubkey( 42 ) , pubkey( 44 ) ) ;
1180- assert_eq ! ( offer_tlv_stream. paths, Some ( & paths) ) ;
11811189 assert_eq ! ( invoice_request_tlv_stream. payer_id, Some ( & pubkey( 42 ) ) ) ;
1190+ assert_eq ! ( invoice_request_tlv_stream. paths, Some ( & paths) ) ;
11821191 }
11831192
11841193 #[ test]
0 commit comments