7575 L :: Target : Logger ,
7676{
7777 let description = Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?;
78- let description = Bolt11InvoiceDescription :: Direct ( & description, ) ;
78+ let description = Bolt11InvoiceDescription :: Direct ( description) ;
7979 _create_phantom_invoice :: < ES , NS , L > (
8080 amt_msat, payment_hash, description, invoice_expiry_delta_secs, phantom_route_hints,
8181 entropy_source, node_signer, logger, network, min_final_cltv_expiry_delta, duration_since_epoch,
@@ -130,7 +130,7 @@ where
130130 L :: Target : Logger ,
131131{
132132 _create_phantom_invoice :: < ES , NS , L > (
133- amt_msat, payment_hash, Bolt11InvoiceDescription :: Hash ( & description_hash) ,
133+ amt_msat, payment_hash, Bolt11InvoiceDescription :: Hash ( description_hash) ,
134134 invoice_expiry_delta_secs, phantom_route_hints, entropy_source, node_signer, logger, network,
135135 min_final_cltv_expiry_delta, duration_since_epoch,
136136 )
@@ -161,7 +161,7 @@ where
161161
162162 let invoice = match description {
163163 Bolt11InvoiceDescription :: Direct ( description) => {
164- InvoiceBuilder :: new ( network) . description ( description. as_inner ( ) . 0 . clone ( ) )
164+ InvoiceBuilder :: new ( network) . description ( description. into_inner ( ) . 0 )
165165 }
166166 Bolt11InvoiceDescription :: Hash ( hash) => InvoiceBuilder :: new ( network) . description_hash ( hash. 0 ) ,
167167 } ;
@@ -424,7 +424,7 @@ where
424424{
425425 _create_invoice_from_channelmanager_and_duration_since_epoch (
426426 channelmanager, node_signer, logger, network, amt_msat,
427- Bolt11InvoiceDescription :: Hash ( & description_hash) ,
427+ Bolt11InvoiceDescription :: Hash ( description_hash) ,
428428 duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta,
429429 )
430430}
@@ -454,7 +454,7 @@ where
454454 _create_invoice_from_channelmanager_and_duration_since_epoch (
455455 channelmanager, node_signer, logger, network, amt_msat,
456456 Bolt11InvoiceDescription :: Direct (
457- & Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
457+ Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
458458 ) ,
459459 duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta,
460460 )
@@ -518,7 +518,7 @@ where
518518 . map_err ( |( ) | SignOrCreationError :: CreationError ( CreationError :: InvalidAmount ) ) ?;
519519 _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
520520 channelmanager, node_signer, logger, network, amt_msat,
521- Bolt11InvoiceDescription :: Hash ( & description_hash) ,
521+ Bolt11InvoiceDescription :: Hash ( description_hash) ,
522522 duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret,
523523 min_final_cltv_expiry_delta,
524524 )
@@ -551,7 +551,7 @@ where
551551 _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
552552 channelmanager, node_signer, logger, network, amt_msat,
553553 Bolt11InvoiceDescription :: Direct (
554- & Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
554+ Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
555555 ) ,
556556 duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret,
557557 min_final_cltv_expiry_delta,
@@ -586,7 +586,7 @@ where
586586
587587 let invoice = match description {
588588 Bolt11InvoiceDescription :: Direct ( description) => {
589- InvoiceBuilder :: new ( network) . description ( description. as_inner ( ) . 0 . clone ( ) )
589+ InvoiceBuilder :: new ( network) . description ( description. into_inner ( ) . 0 )
590590 }
591591 Bolt11InvoiceDescription :: Hash ( hash) => InvoiceBuilder :: new ( network) . description_hash ( hash. 0 ) ,
592592 } ;
@@ -864,7 +864,7 @@ impl<'a, 'b, L: Deref> WithChannelDetails<'a, 'b, L> where L::Target: Logger {
864864mod test {
865865 use super :: * ;
866866 use core:: time:: Duration ;
867- use lightning_invoice:: { Currency , Description , Bolt11InvoiceDescription , SignOrCreationError , CreationError } ;
867+ use lightning_invoice:: { Currency , Description , Bolt11InvoiceDescriptionRef , SignOrCreationError , CreationError } ;
868868 use bitcoin:: hashes:: { Hash , sha256} ;
869869 use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
870870 use crate :: sign:: PhantomKeysManager ;
@@ -921,7 +921,7 @@ mod test {
921921 assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 10_000 ) ) ;
922922 // If no `min_final_cltv_expiry_delta` is specified, then it should be `MIN_FINAL_CLTV_EXPIRY_DELTA`.
923923 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( ) ) ) ;
925925 assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( non_default_invoice_expiry_secs. into( ) ) ) ;
926926
927927 // Invoice SCIDs should always use inbound SCID aliases over the real channel ID, if one is
@@ -1009,7 +1009,7 @@ mod test {
10091009 ) . unwrap ( ) ;
10101010 assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 10_000 ) ) ;
10111011 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( ) ) ) ) ) ;
10131013 }
10141014
10151015 #[ test]
@@ -1026,7 +1026,7 @@ mod test {
10261026 ) . unwrap ( ) ;
10271027 assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 10_000 ) ) ;
10281028 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( ) ) ) ;
10301030 assert_eq ! ( invoice. payment_hash( ) , & sha256:: Hash :: from_slice( & payment_hash. 0 [ ..] ) . unwrap( ) ) ;
10311031 }
10321032
@@ -1379,7 +1379,7 @@ mod test {
13791379 } ;
13801380
13811381 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( ) ) ) ;
13831383 assert_eq ! ( invoice. route_hints( ) . len( ) , 2 ) ;
13841384 assert_eq ! ( invoice. expiry_time( ) , Duration :: from_secs( non_default_invoice_expiry_secs. into( ) ) ) ;
13851385 assert ! ( !invoice. features( ) . unwrap( ) . supports_basic_mpp( ) ) ;
@@ -1498,7 +1498,7 @@ mod test {
14981498 assert_eq ! ( invoice. amount_milli_satoshis( ) , Some ( 20_000 ) ) ;
14991499 assert_eq ! ( invoice. min_final_cltv_expiry_delta( ) , MIN_FINAL_CLTV_EXPIRY_DELTA as u64 ) ;
15001500 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( ) ) ) ) ) ;
15021502 }
15031503
15041504 #[ test]
0 commit comments