@@ -51,7 +51,7 @@ use bitcoin::{Address, Network, PubkeyHash, ScriptHash};
51
51
use bitcoin:: util:: address:: { Payload , WitnessVersion } ;
52
52
use bitcoin_hashes:: { Hash , sha256} ;
53
53
use lightning:: ln:: PaymentSecret ;
54
- use lightning:: ln:: features:: InvoiceFeatures ;
54
+ use lightning:: ln:: features:: Bolt11InvoiceFeatures ;
55
55
#[ cfg( any( doc, test) ) ]
56
56
use lightning:: routing:: gossip:: RoutingFees ;
57
57
use lightning:: routing:: router:: RouteHint ;
@@ -448,7 +448,7 @@ pub enum TaggedField {
448
448
PrivateRoute ( PrivateRoute ) ,
449
449
PaymentSecret ( PaymentSecret ) ,
450
450
PaymentMetadata ( Vec < u8 > ) ,
451
- Features ( InvoiceFeatures ) ,
451
+ Features ( Bolt11InvoiceFeatures ) ,
452
452
}
453
453
454
454
/// SHA-256 hash
@@ -744,7 +744,7 @@ impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, M: tb::Bool> InvoiceBui
744
744
}
745
745
self . tagged_fields . push ( TaggedField :: PaymentSecret ( payment_secret) ) ;
746
746
if !found_features {
747
- let mut features = InvoiceFeatures :: empty ( ) ;
747
+ let mut features = Bolt11InvoiceFeatures :: empty ( ) ;
748
748
features. set_variable_length_onion_required ( ) ;
749
749
features. set_payment_secret_required ( ) ;
750
750
self . tagged_fields . push ( TaggedField :: Features ( features) ) ;
@@ -770,7 +770,7 @@ impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S: tb::Bool> InvoiceBui
770
770
}
771
771
}
772
772
if !found_features {
773
- let mut features = InvoiceFeatures :: empty ( ) ;
773
+ let mut features = Bolt11InvoiceFeatures :: empty ( ) ;
774
774
features. set_payment_metadata_optional ( ) ;
775
775
self . tagged_fields . push ( TaggedField :: Features ( features) ) ;
776
776
}
@@ -1059,7 +1059,7 @@ impl RawBolt11Invoice {
1059
1059
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: PaymentMetadata ( ref x) , x)
1060
1060
}
1061
1061
1062
- pub fn features ( & self ) -> Option < & InvoiceFeatures > {
1062
+ pub fn features ( & self ) -> Option < & Bolt11InvoiceFeatures > {
1063
1063
find_extract ! ( self . known_tagged_fields( ) , TaggedField :: Features ( ref x) , x)
1064
1064
}
1065
1065
@@ -1336,7 +1336,7 @@ impl Bolt11Invoice {
1336
1336
}
1337
1337
1338
1338
/// Get the invoice features if they were included in the invoice
1339
- pub fn features ( & self ) -> Option < & InvoiceFeatures > {
1339
+ pub fn features ( & self ) -> Option < & Bolt11InvoiceFeatures > {
1340
1340
self . signed_invoice . features ( )
1341
1341
}
1342
1342
@@ -1863,7 +1863,7 @@ mod test {
1863
1863
#[ test]
1864
1864
fn test_check_feature_bits ( ) {
1865
1865
use crate :: TaggedField :: * ;
1866
- use lightning:: ln:: features:: InvoiceFeatures ;
1866
+ use lightning:: ln:: features:: Bolt11InvoiceFeatures ;
1867
1867
use secp256k1:: Secp256k1 ;
1868
1868
use secp256k1:: SecretKey ;
1869
1869
use crate :: { Bolt11Invoice , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 , PositiveTimestamp ,
@@ -1904,12 +1904,12 @@ mod test {
1904
1904
let invoice = {
1905
1905
let mut invoice = invoice_template. clone ( ) ;
1906
1906
invoice. data . tagged_fields . push ( PaymentSecret ( payment_secret) . into ( ) ) ;
1907
- invoice. data . tagged_fields . push ( Features ( InvoiceFeatures :: empty ( ) ) . into ( ) ) ;
1907
+ invoice. data . tagged_fields . push ( Features ( Bolt11InvoiceFeatures :: empty ( ) ) . into ( ) ) ;
1908
1908
invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1909
1909
} . unwrap ( ) ;
1910
1910
assert_eq ! ( Bolt11Invoice :: from_signed( invoice) , Err ( Bolt11SemanticError :: InvalidFeatures ) ) ;
1911
1911
1912
- let mut payment_secret_features = InvoiceFeatures :: empty ( ) ;
1912
+ let mut payment_secret_features = Bolt11InvoiceFeatures :: empty ( ) ;
1913
1913
payment_secret_features. set_payment_secret_required ( ) ;
1914
1914
1915
1915
// Including payment secret and feature bits
@@ -1931,7 +1931,7 @@ mod test {
1931
1931
// No payment secret or feature bits
1932
1932
let invoice = {
1933
1933
let mut invoice = invoice_template. clone ( ) ;
1934
- invoice. data . tagged_fields . push ( Features ( InvoiceFeatures :: empty ( ) ) . into ( ) ) ;
1934
+ invoice. data . tagged_fields . push ( Features ( Bolt11InvoiceFeatures :: empty ( ) ) . into ( ) ) ;
1935
1935
invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1936
1936
} . unwrap ( ) ;
1937
1937
assert_eq ! ( Bolt11Invoice :: from_signed( invoice) , Err ( Bolt11SemanticError :: NoPaymentSecret ) ) ;
@@ -2147,7 +2147,7 @@ mod test {
2147
2147
assert_eq ! ( invoice. payment_hash( ) , & sha256:: Hash :: from_slice( & [ 21 ; 32 ] [ ..] ) . unwrap( ) ) ;
2148
2148
assert_eq ! ( invoice. payment_secret( ) , & PaymentSecret ( [ 42 ; 32 ] ) ) ;
2149
2149
2150
- let mut expected_features = InvoiceFeatures :: empty ( ) ;
2150
+ let mut expected_features = Bolt11InvoiceFeatures :: empty ( ) ;
2151
2151
expected_features. set_variable_length_onion_required ( ) ;
2152
2152
expected_features. set_payment_secret_required ( ) ;
2153
2153
expected_features. set_basic_mpp_optional ( ) ;
0 commit comments