@@ -490,6 +490,40 @@ where
490490 invoice_expiry_delta_secs, payment_hash, payment_secret, min_final_cltv_expiry_delta)
491491}
492492
493+ /// See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
494+ /// This version allows for providing custom [`PaymentHash`] and description hash for the invoice.
495+ ///
496+ /// This may be useful if you're building an on-chain swap or involving another protocol where
497+ /// the payment hash is also involved outside the scope of lightning and want to set the
498+ /// description hash.
499+ pub fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch_with_payment_hash < M : Deref , T : Deref , ES : Deref , NS : Deref , SP : Deref , F : Deref , R : Deref , MR : Deref , L : Deref > (
500+ channelmanager : & ChannelManager < M , T , ES , NS , SP , F , R , MR , L > , node_signer : NS , logger : L ,
501+ network : Currency , amt_msat : Option < u64 > , description_hash : Sha256 , duration_since_epoch : Duration ,
502+ invoice_expiry_delta_secs : u32 , payment_hash : PaymentHash , min_final_cltv_expiry_delta : Option < u16 > ,
503+ ) -> Result < Bolt11Invoice , SignOrCreationError < ( ) > >
504+ where
505+ M :: Target : chain:: Watch < <SP :: Target as SignerProvider >:: EcdsaSigner > ,
506+ T :: Target : BroadcasterInterface ,
507+ ES :: Target : EntropySource ,
508+ NS :: Target : NodeSigner ,
509+ SP :: Target : SignerProvider ,
510+ F :: Target : FeeEstimator ,
511+ R :: Target : Router ,
512+ MR :: Target : MessageRouter ,
513+ L :: Target : Logger ,
514+ {
515+ let payment_secret = channelmanager
516+ . create_inbound_payment_for_hash ( payment_hash, amt_msat, invoice_expiry_delta_secs,
517+ min_final_cltv_expiry_delta)
518+ . map_err ( |( ) | SignOrCreationError :: CreationError ( CreationError :: InvalidAmount ) ) ?;
519+ _create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash (
520+ channelmanager, node_signer, logger, network, amt_msat,
521+ Bolt11InvoiceDescription :: Hash ( & description_hash) ,
522+ duration_since_epoch, invoice_expiry_delta_secs, payment_hash, payment_secret,
523+ min_final_cltv_expiry_delta,
524+ )
525+ }
526+
493527/// See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
494528/// This version allows for providing a custom [`PaymentHash`] for the invoice.
495529/// This may be useful if you're building an on-chain swap or involving another protocol where
0 commit comments