diff --git a/Cargo.toml b/Cargo.toml index 26de80123..64ec7264e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,9 @@ lightning-persister = { version = "0.0.118" } lightning-background-processor = { version = "0.0.118", features = ["futures"] } lightning-rapid-gossip-sync = { version = "0.0.118" } lightning-transaction-sync = { version = "0.0.118", features = ["esplora-async-https"] } +#lightning-liquidity = { git = "https://github.com/lightningdevkit/lightning-liquidity", branch="main", features = ["std"] } +#lightning-liquidity = { git = "https://github.com/lightningdevkit/lightning-liquidity.git", rev = "d89690914577a8e820c63fe0510b51107c890197" } +lightning-liquidity = { path = "../lightning-liquidity", features = ["std"] } # lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main", features = ["std"] } # lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch="main" } diff --git a/src/builder.rs b/src/builder.rs index a44a05f0c..2ce89cad4 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -40,6 +40,8 @@ use lightning_persister::fs_store::FilesystemStore; use lightning_transaction_sync::EsploraSyncClient; +use lightning_liquidity::{LiquidityManager, LiquidityClientConfig}; + #[cfg(any(vss, vss_test))] use crate::io::vss_store::VssStore; use bdk::bitcoin::secp256k1::Secp256k1; @@ -709,20 +711,24 @@ fn build_with_store_internal( } }; + let liquidity_client_config = None; + + let liquidity_manager = Arc::new(LiquidityManager::new(Arc::clone(&keys_manager), Arc::clone(&channel_manager), Some(Arc::clone(&tx_sync)), None, None, liquidity_client_config)); + let msg_handler = match gossip_source.as_gossip_sync() { GossipSync::P2P(p2p_gossip_sync) => MessageHandler { chan_handler: Arc::clone(&channel_manager), route_handler: Arc::clone(&p2p_gossip_sync) as Arc, onion_message_handler: onion_messenger, - custom_message_handler: IgnoringMessageHandler {}, + custom_message_handler: Arc::clone(&liquidity_manager), }, GossipSync::Rapid(_) => MessageHandler { chan_handler: Arc::clone(&channel_manager), route_handler: Arc::new(IgnoringMessageHandler {}) as Arc, onion_message_handler: onion_messenger, - custom_message_handler: IgnoringMessageHandler {}, + custom_message_handler: Arc::clone(&liquidity_manager), }, GossipSync::None => { unreachable!("We must always have a gossip sync!"); diff --git a/src/types.rs b/src/types.rs index 4edba65c3..fce4c6f9a 100644 --- a/src/types.rs +++ b/src/types.rs @@ -24,7 +24,7 @@ use std::sync::{Arc, Mutex, RwLock}; pub(crate) type ChainMonitor = chainmonitor::ChainMonitor< InMemorySigner, - Arc>>, + Arc, Arc, Arc, Arc, @@ -37,10 +37,14 @@ pub(crate) type PeerManager = lightning::ln::peer_handler::PeerManager< Arc, Arc, Arc, - IgnoringMessageHandler, + Arc>, Arc, >; +pub(crate) type ChainSource = EsploraSyncClient>; + +pub(crate) type LiquidityManager = lightning_liquidity::LiquidityManager, Arc>, Arc>; + pub(crate) type ChannelManager = lightning::ln::channelmanager::ChannelManager< Arc>, Arc, @@ -122,7 +126,7 @@ impl lightning::onion_message::MessageRouter for FakeMessageRouter { pub(crate) type Sweeper = OutputSweeper< Arc, Arc, - Arc>>, + Arc, Arc, Arc, >;