@@ -170,8 +170,8 @@ macro_rules! refund_explicit_metadata_builder_methods { () => {
170
170
Ok ( Self {
171
171
refund: RefundContents {
172
172
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 ,
175
175
} ,
176
176
secp_ctx: None ,
177
177
} )
@@ -209,8 +209,8 @@ macro_rules! refund_builder_methods { (
209
209
Ok ( Self {
210
210
refund: RefundContents {
211
211
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 ,
214
214
} ,
215
215
secp_ctx: Some ( secp_ctx) ,
216
216
} )
@@ -410,14 +410,14 @@ pub(super) struct RefundContents {
410
410
description : String ,
411
411
absolute_expiry : Option < Duration > ,
412
412
issuer : Option < String > ,
413
- paths : Option < Vec < BlindedPath > > ,
414
413
// invoice_request fields
415
414
chain : Option < ChainHash > ,
416
415
amount_msats : u64 ,
417
416
features : InvoiceRequestFeatures ,
418
417
quantity : Option < u64 > ,
419
418
payer_id : PublicKey ,
420
419
payer_note : Option < String > ,
420
+ paths : Option < Vec < BlindedPath > > ,
421
421
}
422
422
423
423
impl Refund {
@@ -734,7 +734,7 @@ impl RefundContents {
734
734
description : Some ( & self . description ) ,
735
735
features : None ,
736
736
absolute_expiry : self . absolute_expiry . map ( |duration| duration. as_secs ( ) ) ,
737
- paths : self . paths . as_ref ( ) ,
737
+ paths : None ,
738
738
issuer : self . issuer . as_ref ( ) ,
739
739
quantity_max : None ,
740
740
node_id : None ,
@@ -752,6 +752,7 @@ impl RefundContents {
752
752
quantity : self . quantity ,
753
753
payer_id : Some ( & self . payer_id ) ,
754
754
payer_note : self . payer_note . as_ref ( ) ,
755
+ paths : self . paths . as_ref ( ) ,
755
756
} ;
756
757
757
758
( payer, offer, invoice_request)
@@ -820,9 +821,12 @@ impl TryFrom<RefundTlvStream> for RefundContents {
820
821
PayerTlvStream { metadata : payer_metadata } ,
821
822
OfferTlvStream {
822
823
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
824
829
} ,
825
- InvoiceRequestTlvStream { chain, amount, features, quantity, payer_id, payer_note } ,
826
830
) = tlv_stream;
827
831
828
832
let payer = match payer_metadata {
@@ -853,6 +857,10 @@ impl TryFrom<RefundTlvStream> for RefundContents {
853
857
854
858
let absolute_expiry = absolute_expiry. map ( Duration :: from_secs) ;
855
859
860
+ if offer_paths. is_some ( ) {
861
+ return Err ( Bolt12SemanticError :: UnexpectedPaths ) ;
862
+ }
863
+
856
864
if quantity_max. is_some ( ) {
857
865
return Err ( Bolt12SemanticError :: UnexpectedQuantity ) ;
858
866
}
@@ -877,8 +885,8 @@ impl TryFrom<RefundTlvStream> for RefundContents {
877
885
} ;
878
886
879
887
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 ,
882
890
} )
883
891
}
884
892
}
@@ -980,6 +988,7 @@ mod tests {
980
988
quantity: None ,
981
989
payer_id: Some ( & payer_pubkey( ) ) ,
982
990
payer_note: None ,
991
+ paths: None ,
983
992
} ,
984
993
) ,
985
994
) ;
@@ -1173,12 +1182,12 @@ mod tests {
1173
1182
. path ( paths[ 1 ] . clone ( ) )
1174
1183
. build ( )
1175
1184
. 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 ( ) ;
1178
1186
assert_eq ! ( refund. payer_id( ) , pubkey( 42 ) ) ;
1187
+ assert_eq ! ( refund. paths( ) , paths. as_slice( ) ) ;
1179
1188
assert_ne ! ( pubkey( 42 ) , pubkey( 44 ) ) ;
1180
- assert_eq ! ( offer_tlv_stream. paths, Some ( & paths) ) ;
1181
1189
assert_eq ! ( invoice_request_tlv_stream. payer_id, Some ( & pubkey( 42 ) ) ) ;
1190
+ assert_eq ! ( invoice_request_tlv_stream. paths, Some ( & paths) ) ;
1182
1191
}
1183
1192
1184
1193
#[ test]
0 commit comments