75
75
L :: Target : Logger ,
76
76
{
77
77
let description = Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?;
78
- let description = Bolt11InvoiceDescription :: Direct ( & description, ) ;
78
+ let description = Bolt11InvoiceDescription :: Direct ( description) ;
79
79
_create_phantom_invoice :: < ES , NS , L > (
80
80
amt_msat, payment_hash, description, invoice_expiry_delta_secs, phantom_route_hints,
81
81
entropy_source, node_signer, logger, network, min_final_cltv_expiry_delta, duration_since_epoch,
@@ -130,7 +130,7 @@ where
130
130
L :: Target : Logger ,
131
131
{
132
132
_create_phantom_invoice :: < ES , NS , L > (
133
- amt_msat, payment_hash, Bolt11InvoiceDescription :: Hash ( & description_hash) ,
133
+ amt_msat, payment_hash, Bolt11InvoiceDescription :: Hash ( description_hash) ,
134
134
invoice_expiry_delta_secs, phantom_route_hints, entropy_source, node_signer, logger, network,
135
135
min_final_cltv_expiry_delta, duration_since_epoch,
136
136
)
@@ -161,7 +161,7 @@ where
161
161
162
162
let invoice = match description {
163
163
Bolt11InvoiceDescription :: Direct ( description) => {
164
- InvoiceBuilder :: new ( network) . description ( description. as_inner ( ) . 0 . clone ( ) )
164
+ InvoiceBuilder :: new ( network) . description ( description. into_inner ( ) . 0 )
165
165
}
166
166
Bolt11InvoiceDescription :: Hash ( hash) => InvoiceBuilder :: new ( network) . description_hash ( hash. 0 ) ,
167
167
} ;
@@ -424,7 +424,7 @@ where
424
424
{
425
425
_create_invoice_from_channelmanager_and_duration_since_epoch (
426
426
channelmanager, node_signer, logger, network, amt_msat,
427
- Bolt11InvoiceDescription :: Hash ( & description_hash) ,
427
+ Bolt11InvoiceDescription :: Hash ( description_hash) ,
428
428
duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta,
429
429
)
430
430
}
@@ -454,7 +454,7 @@ where
454
454
_create_invoice_from_channelmanager_and_duration_since_epoch (
455
455
channelmanager, node_signer, logger, network, amt_msat,
456
456
Bolt11InvoiceDescription :: Direct (
457
- & Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
457
+ Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
458
458
) ,
459
459
duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta,
460
460
)
@@ -518,7 +518,7 @@ where
518
518
. map_err ( |( ) | SignOrCreationError :: CreationError ( CreationError :: InvalidAmount ) ) ?;
519
519
_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
520
520
channelmanager, node_signer, logger, network, amt_msat,
521
- Bolt11InvoiceDescription :: Hash ( & description_hash) ,
521
+ Bolt11InvoiceDescription :: Hash ( description_hash) ,
522
522
duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret,
523
523
min_final_cltv_expiry_delta,
524
524
)
@@ -551,7 +551,7 @@ where
551
551
_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
552
552
channelmanager, node_signer, logger, network, amt_msat,
553
553
Bolt11InvoiceDescription :: Direct (
554
- & Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
554
+ Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
555
555
) ,
556
556
duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret,
557
557
min_final_cltv_expiry_delta,
@@ -586,7 +586,7 @@ where
586
586
587
587
let invoice = match description {
588
588
Bolt11InvoiceDescription :: Direct ( description) => {
589
- InvoiceBuilder :: new ( network) . description ( description. as_inner ( ) . 0 . clone ( ) )
589
+ InvoiceBuilder :: new ( network) . description ( description. into_inner ( ) . 0 )
590
590
}
591
591
Bolt11InvoiceDescription :: Hash ( hash) => InvoiceBuilder :: new ( network) . description_hash ( hash. 0 ) ,
592
592
} ;
@@ -864,7 +864,7 @@ impl<'a, 'b, L: Deref> WithChannelDetails<'a, 'b, L> where L::Target: Logger {
864
864
mod test {
865
865
use super :: * ;
866
866
use core:: time:: Duration ;
867
- use lightning_invoice:: { Currency , Description , Bolt11InvoiceDescription , SignOrCreationError , CreationError } ;
867
+ use lightning_invoice:: { Currency , Description , Bolt11InvoiceDescriptionRef , SignOrCreationError , CreationError } ;
868
868
use bitcoin:: hashes:: { Hash , sha256} ;
869
869
use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
870
870
use crate :: sign:: PhantomKeysManager ;
@@ -921,7 +921,7 @@ mod test {
921
921
assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 10_000 ) ) ;
922
922
// If no `min_final_cltv_expiry_delta` is specified, then it should be `MIN_FINAL_CLTV_EXPIRY_DELTA`.
923
923
assert_eq ! ( invoice. min_final_cltv_expiry_delta( ) , MIN_FINAL_CLTV_EXPIRY_DELTA as u64 ) ;
924
- assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescription :: Direct ( & Description :: new( "test" . to_string( ) ) . unwrap( ) ) ) ;
924
+ assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescriptionRef :: Direct ( & Description :: new( "test" . to_string( ) ) . unwrap( ) ) ) ;
925
925
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( non_default_invoice_expiry_secs. into( ) ) ) ;
926
926
927
927
// Invoice SCIDs should always use inbound SCID aliases over the real channel ID, if one is
@@ -1009,7 +1009,7 @@ mod test {
1009
1009
) . unwrap ( ) ;
1010
1010
assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 10_000 ) ) ;
1011
1011
assert_eq ! ( invoice. min_final_cltv_expiry_delta( ) , MIN_FINAL_CLTV_EXPIRY_DELTA as u64 ) ;
1012
- assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescription :: Hash ( & Sha256 ( Sha256 :: hash( "Testing description_hash" . as_bytes( ) ) ) ) ) ;
1012
+ assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescriptionRef :: Hash ( & Sha256 ( Sha256 :: hash( "Testing description_hash" . as_bytes( ) ) ) ) ) ;
1013
1013
}
1014
1014
1015
1015
#[ test]
@@ -1026,7 +1026,7 @@ mod test {
1026
1026
) . unwrap ( ) ;
1027
1027
assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 10_000 ) ) ;
1028
1028
assert_eq ! ( invoice. min_final_cltv_expiry_delta( ) , MIN_FINAL_CLTV_EXPIRY_DELTA as u64 ) ;
1029
- assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescription :: Direct ( & Description :: new( "test" . to_string( ) ) . unwrap( ) ) ) ;
1029
+ assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescriptionRef :: Direct ( & Description :: new( "test" . to_string( ) ) . unwrap( ) ) ) ;
1030
1030
assert_eq ! ( invoice. payment_hash( ) , & sha256:: Hash :: from_slice( & payment_hash. 0 [ ..] ) . unwrap( ) ) ;
1031
1031
}
1032
1032
@@ -1379,7 +1379,7 @@ mod test {
1379
1379
} ;
1380
1380
1381
1381
assert_eq ! ( invoice. min_final_cltv_expiry_delta( ) , MIN_FINAL_CLTV_EXPIRY_DELTA as u64 ) ;
1382
- assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescription :: Direct ( & Description :: new( "test" . to_string( ) ) . unwrap( ) ) ) ;
1382
+ assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescriptionRef :: Direct ( & Description :: new( "test" . to_string( ) ) . unwrap( ) ) ) ;
1383
1383
assert_eq ! ( invoice. route_hints( ) . len( ) , 2 ) ;
1384
1384
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( non_default_invoice_expiry_secs. into( ) ) ) ;
1385
1385
assert ! ( !invoice. features( ) . unwrap( ) . supports_basic_mpp( ) ) ;
@@ -1498,7 +1498,7 @@ mod test {
1498
1498
assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 20_000 ) ) ;
1499
1499
assert_eq ! ( invoice. min_final_cltv_expiry_delta( ) , MIN_FINAL_CLTV_EXPIRY_DELTA as u64 ) ;
1500
1500
assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( non_default_invoice_expiry_secs. into( ) ) ) ;
1501
- assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescription :: Hash ( & Sha256 ( Sha256 :: hash( "Description hash phantom invoice" . as_bytes( ) ) ) ) ) ;
1501
+ assert_eq ! ( invoice. description( ) , Bolt11InvoiceDescriptionRef :: Hash ( & Sha256 ( Sha256 :: hash( "Description hash phantom invoice" . as_bytes( ) ) ) ) ) ;
1502
1502
}
1503
1503
1504
1504
#[ test]
0 commit comments