@@ -413,14 +413,17 @@ macro_rules! invoice_builder_methods {
413
413
payment_paths: Vec <BlindedPaymentPath >, created_at: Duration ,
414
414
payment_hash: PaymentHash , amount_msats: u64 , signing_pubkey: PublicKey ,
415
415
) -> InvoiceFields {
416
+ let mut features = Bolt12InvoiceFeatures :: empty( ) ;
417
+ features. set_attributable_failures_optional( ) ;
418
+
416
419
InvoiceFields {
417
420
payment_paths,
418
421
created_at,
419
422
relative_expiry: None ,
420
423
payment_hash,
421
424
amount_msats,
422
425
fallbacks: None ,
423
- features: Bolt12InvoiceFeatures :: empty ( ) ,
426
+ features,
424
427
signing_pubkey,
425
428
#[ cfg( test) ]
426
429
experimental_baz: None ,
@@ -1878,7 +1881,10 @@ mod tests {
1878
1881
assert ! ( !unsigned_invoice. is_expired( ) ) ;
1879
1882
assert_eq ! ( unsigned_invoice. payment_hash( ) , payment_hash) ;
1880
1883
assert ! ( unsigned_invoice. fallbacks( ) . is_empty( ) ) ;
1881
- assert_eq ! ( unsigned_invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty( ) ) ;
1884
+
1885
+ let mut expected_features = Bolt12InvoiceFeatures :: empty ( ) ;
1886
+ expected_features. set_attributable_failures_optional ( ) ;
1887
+ assert_eq ! ( unsigned_invoice. invoice_features( ) , & expected_features) ;
1882
1888
1883
1889
match UnsignedBolt12Invoice :: try_from ( buffer) {
1884
1890
Err ( e) => panic ! ( "error parsing unsigned invoice: {:?}" , e) ,
@@ -1926,7 +1932,7 @@ mod tests {
1926
1932
assert ! ( !invoice. is_expired( ) ) ;
1927
1933
assert_eq ! ( invoice. payment_hash( ) , payment_hash) ;
1928
1934
assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
1929
- assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty ( ) ) ;
1935
+ assert_eq ! ( invoice. invoice_features( ) , & expected_features ) ;
1930
1936
assert ! ( !invoice. is_for_refund_without_paths( ) ) ;
1931
1937
1932
1938
let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
@@ -1974,7 +1980,7 @@ mod tests {
1974
1980
payment_hash: Some ( & payment_hash) ,
1975
1981
amount: Some ( 1000 ) ,
1976
1982
fallbacks: None ,
1977
- features: None ,
1983
+ features: Some ( & expected_features ) ,
1978
1984
node_id: Some ( & recipient_pubkey( ) ) ,
1979
1985
message_paths: None ,
1980
1986
} ,
@@ -2009,6 +2015,9 @@ mod tests {
2009
2015
let mut buffer = Vec :: new ( ) ;
2010
2016
invoice. write ( & mut buffer) . unwrap ( ) ;
2011
2017
2018
+ let mut expected_features = Bolt12InvoiceFeatures :: empty ( ) ;
2019
+ expected_features. set_attributable_failures_optional ( ) ;
2020
+
2012
2021
assert_eq ! ( invoice. bytes, buffer. as_slice( ) ) ;
2013
2022
assert_eq ! ( invoice. payer_metadata( ) , & [ 1 ; 32 ] ) ;
2014
2023
assert_eq ! ( invoice. offer_chains( ) , None ) ;
@@ -2034,7 +2043,7 @@ mod tests {
2034
2043
assert ! ( !invoice. is_expired( ) ) ;
2035
2044
assert_eq ! ( invoice. payment_hash( ) , payment_hash) ;
2036
2045
assert ! ( invoice. fallbacks( ) . is_empty( ) ) ;
2037
- assert_eq ! ( invoice. invoice_features( ) , & Bolt12InvoiceFeatures :: empty ( ) ) ;
2046
+ assert_eq ! ( invoice. invoice_features( ) , & expected_features ) ;
2038
2047
assert ! ( invoice. is_for_refund_without_paths( ) ) ;
2039
2048
2040
2049
let message = TaggedHash :: from_valid_tlv_stream_bytes ( SIGNATURE_TAG , & invoice. bytes ) ;
@@ -2077,7 +2086,7 @@ mod tests {
2077
2086
payment_hash: Some ( & payment_hash) ,
2078
2087
amount: Some ( 1000 ) ,
2079
2088
fallbacks: None ,
2080
- features: None ,
2089
+ features: Some ( & expected_features ) ,
2081
2090
node_id: Some ( & recipient_pubkey( ) ) ,
2082
2091
message_paths: None ,
2083
2092
} ,
@@ -2501,6 +2510,7 @@ mod tests {
2501
2510
2502
2511
let mut features = Bolt12InvoiceFeatures :: empty ( ) ;
2503
2512
features. set_basic_mpp_optional ( ) ;
2513
+ features. set_attributable_failures_optional ( ) ;
2504
2514
2505
2515
let invoice = OfferBuilder :: new ( recipient_pubkey ( ) )
2506
2516
. amount_msats ( 1000 )
@@ -2838,6 +2848,7 @@ mod tests {
2838
2848
Ok ( invoice) => {
2839
2849
let mut features = Bolt12InvoiceFeatures :: empty ( ) ;
2840
2850
features. set_basic_mpp_optional ( ) ;
2851
+ features. set_attributable_failures_optional ( ) ;
2841
2852
assert_eq ! ( invoice. invoice_features( ) , & features) ;
2842
2853
} ,
2843
2854
Err ( e) => panic ! ( "error parsing invoice: {:?}" , e) ,
0 commit comments