@@ -3708,6 +3708,48 @@ where
37083708 secp_ctx.clone(), message_router, FlowConfigs::new()
37093709 );
37103710
3711+ Self::new_inner(
3712+ secp_ctx, fee_est, chain_monitor, tx_broadcaster, router, flow,
3713+ logger, entropy_source, node_signer, signer_provider, config, params,
3714+ current_timestamp
3715+ )
3716+
3717+ }
3718+
3719+ /// Similar to [`ChannelManager::new`], but allows providing a custom [`OffersMessageFlow`] implementation.
3720+ ///
3721+ /// This is useful if you want more control over how BOLT12 offer-related messages are handled,
3722+ /// including support for custom [`FlowConfigs`] to conditionally trigger [`OfferEvents`] that you
3723+ /// can handle asynchronously via your own logic.
3724+ ///
3725+ /// Use this method when:
3726+ /// - You want to initialize [`ChannelManager`] with a non-default [`OffersMessageFlow`] implementation.
3727+ /// - You need fine-grained control over BOLT12 event generation or message flow behavior.
3728+ ///
3729+ /// [`FlowConfigs`]: crate::offers::flow::FlowConfigs
3730+ /// [`OfferEvents`]: crate::offers::flow::OfferEvents
3731+ #[rustfmt::skip]
3732+ pub fn new_with_flow(
3733+ fee_est: F, chain_monitor: M, tx_broadcaster: T, router: R, flow: OffersMessageFlow<MR>,
3734+ logger: L, entropy_source: ES, node_signer: NS, signer_provider: SP, config: UserConfig,
3735+ params: ChainParameters, current_timestamp: u32,
3736+ ) -> Self {
3737+ let mut secp_ctx = Secp256k1::new();
3738+ secp_ctx.seeded_randomize(&entropy_source.get_secure_random_bytes());
3739+
3740+ Self::new_inner(
3741+ secp_ctx, fee_est, chain_monitor, tx_broadcaster, router, flow,
3742+ logger, entropy_source, node_signer, signer_provider, config, params,
3743+ current_timestamp
3744+ )
3745+ }
3746+
3747+ #[rustfmt::skip]
3748+ fn new_inner(
3749+ secp_ctx: Secp256k1<secp256k1::All>, fee_est: F, chain_monitor: M, tx_broadcaster: T, router: R,
3750+ flow: OffersMessageFlow<MR>, logger: L, entropy_source: ES, node_signer: NS,
3751+ signer_provider: SP, config: UserConfig, params: ChainParameters, current_timestamp: u32
3752+ ) -> Self {
37113753 ChannelManager {
37123754 default_configuration: config.clone(),
37133755 chain_hash: ChainHash::using_genesis_block(params.network),
@@ -3727,10 +3769,10 @@ where
37273769 pending_intercepted_htlcs: Mutex::new(new_hash_map()),
37283770 short_to_chan_info: FairRwLock::new(new_hash_map()),
37293771
3730- our_network_pubkey,
3772+ our_network_pubkey: node_signer.get_node_id(Recipient::Node).unwrap() ,
37313773 secp_ctx,
37323774
3733- inbound_payment_key: expanded_inbound_key ,
3775+ inbound_payment_key: node_signer.get_inbound_payment_key() ,
37343776 fake_scid_rand_bytes: entropy_source.get_secure_random_bytes(),
37353777
37363778 probing_cookie_secret: entropy_source.get_secure_random_bytes(),
0 commit comments