Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Dec 19, 2023
1 parent 4ded800 commit 9e6e482
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
10 changes: 8 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -709,20 +711,24 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
}
};

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<dyn RoutingMessageHandler + Sync + Send>,
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<dyn RoutingMessageHandler + Sync + Send>,
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!");
Expand Down
10 changes: 7 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::sync::{Arc, Mutex, RwLock};

pub(crate) type ChainMonitor<K> = chainmonitor::ChainMonitor<
InMemorySigner,
Arc<EsploraSyncClient<Arc<FilesystemLogger>>>,
Arc<ChainSource>,
Arc<Broadcaster>,
Arc<FeeEstimator>,
Arc<FilesystemLogger>,
Expand All @@ -37,10 +37,14 @@ pub(crate) type PeerManager<K> = lightning::ln::peer_handler::PeerManager<
Arc<dyn RoutingMessageHandler + Send + Sync>,
Arc<OnionMessenger>,
Arc<FilesystemLogger>,
IgnoringMessageHandler,
Arc<LiquidityManager<K>>,
Arc<KeysManager>,
>;

pub(crate) type ChainSource = EsploraSyncClient<Arc<FilesystemLogger>>;

pub(crate) type LiquidityManager<K> = lightning_liquidity::LiquidityManager<Arc<KeysManager>, Arc<ChannelManager<K>>, Arc<ChainSource>>;

pub(crate) type ChannelManager<K> = lightning::ln::channelmanager::ChannelManager<
Arc<ChainMonitor<K>>,
Arc<Broadcaster>,
Expand Down Expand Up @@ -122,7 +126,7 @@ impl lightning::onion_message::MessageRouter for FakeMessageRouter {
pub(crate) type Sweeper<K> = OutputSweeper<
Arc<Broadcaster>,
Arc<FeeEstimator>,
Arc<EsploraSyncClient<Arc<FilesystemLogger>>>,
Arc<ChainSource>,
Arc<K>,
Arc<FilesystemLogger>,
>;
Expand Down

0 comments on commit 9e6e482

Please sign in to comment.