@@ -352,20 +352,20 @@ fn _create_invoice_from_channelmanager_and_duration_since_epoch<M: Deref, T: Der
352
352
. create_inbound_payment ( amt_msat, invoice_expiry_delta_secs)
353
353
. map_err ( |( ) | SignOrCreationError :: CreationError ( CreationError :: InvalidAmount ) ) ?;
354
354
_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
355
- channelmanager, keys_manager, logger, network, amt_msat, description, duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret)
355
+ channelmanager, keys_manager, logger, network, amt_msat, description, duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret, secp_context )
356
356
}
357
357
358
358
/// See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
359
359
/// This version allows for providing a custom [`PaymentHash`] for the invoice.
360
360
/// This may be useful if you're building an on-chain swap or involving another protocol where
361
361
/// the payment hash is also involved outside the scope of lightning.
362
- pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash < M : Deref , T : Deref , K : Deref , F : Deref , L : Deref > (
362
+ pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash < M : Deref , T : Deref , K : Deref , F : Deref , L : Deref , C : Signing > (
363
363
channelmanager : & ChannelManager < M , T , K , F , L > , keys_manager : K , logger : L ,
364
364
network : Currency , amt_msat : Option < u64 > , description : String , duration_since_epoch : Duration ,
365
- invoice_expiry_delta_secs : u32 , payment_hash : PaymentHash
365
+ invoice_expiry_delta_secs : u32 , payment_hash : PaymentHash , secp_context : & Secp256k1 < C >
366
366
) -> Result < Invoice , SignOrCreationError < ( ) > >
367
367
where
368
- M :: Target : chain:: Watch < <K :: Target as KeysInterface >:: Signer > ,
368
+ M :: Target : chain:: Watch < <K :: Target as SignerProvider >:: Signer > ,
369
369
T :: Target : BroadcasterInterface ,
370
370
K :: Target : KeysInterface ,
371
371
F :: Target : FeeEstimator ,
@@ -379,21 +379,22 @@ pub fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_
379
379
InvoiceDescription :: Direct (
380
380
& Description :: new ( description) . map_err ( SignOrCreationError :: CreationError ) ?,
381
381
) ,
382
- duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret
382
+ duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret, secp_context
383
383
)
384
384
}
385
385
386
- fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash < M : Deref , T : Deref , K : Deref , F : Deref , L : Deref > (
386
+ fn _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash < M : Deref , T : Deref , K : Deref , F : Deref , L : Deref , C : Signing > (
387
387
channelmanager : & ChannelManager < M , T , K , F , L > , keys_manager : K , logger : L ,
388
388
network : Currency , amt_msat : Option < u64 > , description : InvoiceDescription , duration_since_epoch : Duration ,
389
- invoice_expiry_delta_secs : u32 , payment_hash : PaymentHash , payment_secret : PaymentSecret
389
+ invoice_expiry_delta_secs : u32 , payment_hash : PaymentHash , payment_secret : PaymentSecret ,
390
+ secp_context : & Secp256k1 < C >
390
391
) -> Result < Invoice , SignOrCreationError < ( ) > >
391
392
where
392
- M :: Target : chain:: Watch < <K :: Target as KeysInterface >:: Signer > ,
393
+ M :: Target : chain:: Watch < <K :: Target as SignerProvider >:: Signer > ,
393
394
T :: Target : BroadcasterInterface ,
394
395
K :: Target : KeysInterface ,
395
396
F :: Target : FeeEstimator ,
396
- L :: Target : Logger ,
397
+ L :: Target : Logger
397
398
{
398
399
let our_node_pubkey = channelmanager. get_our_node_id ( ) ;
399
400
let channels = channelmanager. list_channels ( ) ;
@@ -723,10 +724,11 @@ mod test {
723
724
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
724
725
let payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
725
726
let payment_secret = & nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 10_000 ) , 3600 ) ;
727
+ let secp_context = Secp256k1 :: signing_only ( ) ;
726
728
let invoice = crate :: utils:: create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
727
729
& nodes[ 1 ] . node , nodes[ 1 ] . keys_manager , nodes[ 1 ] . logger , Currency :: BitcoinTestnet ,
728
730
Some ( 10_000 ) , "test" . to_string ( ) , Duration :: from_secs ( 1234567 ) , 3600 ,
729
- payment_hash
731
+ payment_hash, & secp_context
730
732
) . unwrap ( ) ;
731
733
assert_eq ! ( invoice. amount_pico_btc( ) , Some ( 100_000 ) ) ;
732
734
assert_eq ! ( invoice. min_final_cltv_expiry( ) , MIN_FINAL_CLTV_EXPIRY as u64 ) ;
0 commit comments