Drop `Listen`/`Confirm`/etc from `LiquidityManager`
What changed, and why it matters
This commit removes unused on-chain tracking code from the LiquidityManager component. It is a cleanup change that simplifies the API by removing parameters and traits that were added in anticipation of future LSPS1 on-chain tracking but are no longer needed. There is no indication this fixes a security vulnerability.
No security action required. Treat as a normal API-simplifying refactor. Downstream users will need to update LiquidityManager constructor calls to remove the now-obsolete chain_source and chain_params arguments.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit drops Listen, Confirm, and Filter trait implementations and their associated generic parameters (C: Filter) and constructor arguments (chain_source, chain_params) from LiquidityManager and LiquidityManagerSync. It also updates call sites in tests, fuzzing, and the background processor to match the simplified API. The removed code was essentially scaffolding/TODO code for on-chain state tracking that was never actually used by LSPS1/LSPS2/LSPS5 handlers.
Changed components
lightning-liquidity/src/manager.rslightning-background-processor/src/lib.rslightning-liquidity/tests/common/mod.rslightning-liquidity/tests/lsps2_integration_tests.rslightning-liquidity/tests/lsps5_integration_tests.rsfuzz/src/lsps_message.rsInspect captured patch +34 / −252
diff --git a/fuzz/src/lsps_message.rs b/fuzz/src/lsps_message.rs
index 8371d1c..42feed4 100644
--- a/fuzz/src/lsps_message.rs
+++ b/fuzz/src/lsps_message.rs
@@ -82,8 +82,6 @@ pub fn do_test(data: &[u8]) {
Arc::clone(&keys_manager),
Arc::clone(&keys_manager),
Arc::clone(&manager),
- None::<Arc<dyn Filter + Send + Sync>>,
- None,
kv_store,
Arc::clone(&tx_broadcaster),
None,
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index da415c7..fc58eda 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -464,7 +464,6 @@ pub const NO_LIQUIDITY_MANAGER: Option<
NodeSigner = &(dyn lightning::sign::NodeSigner + Send + Sync),
AChannelManager = DynChannelManager,
CM = &DynChannelManager,
- C = &(dyn chain::Filter + Send + Sync),
K = &DummyKVStore,
TimeProvider = dyn lightning_liquidity::utils::time::TimeProvider + Send + Sync,
TP = &(dyn lightning_liquidity::utils::time::TimeProvider + Send + Sync),
@@ -486,7 +485,6 @@ pub const NO_LIQUIDITY_MANAGER_SYNC: Option<
NodeSigner = &(dyn lightning::sign::NodeSigner + Send + Sync),
AChannelManager = DynChannelManager,
CM = &DynChannelManager,
- C = &(dyn chain::Filter + Send + Sync),
KVStoreSync = dyn lightning::util::persist::KVStoreSync + Send + Sync,
KS = &(dyn lightning::util::persist::KVStoreSync + Send + Sync),
TimeProvider = dyn lightning_liquidity::utils::time::TimeProvider + Send + Sync,
@@ -829,7 +827,7 @@ use futures_util::{dummy_waker, Joiner, OptionalSelector, Selector, SelectorOutp
/// # type P2PGossipSync<UL> = lightning::routing::gossip::P2PGossipSync<Arc<NetworkGraph>, Arc<UL>, Arc<Logger>>;
/// # type ChannelManager<B, F, FE> = lightning::ln::channelmanager::SimpleArcChannelManager<ChainMonitor<B, F, FE>, B, FE, Logger>;
/// # type OnionMessenger<B, F, FE> = lightning::onion_message::messenger::OnionMessenger<Arc<lightning::sign::KeysManager>, Arc<lightning::sign::KeysManager>, Arc<Logger>, Arc<ChannelManager<B, F, FE>>, Arc<lightning::onion_message::messenger::DefaultMessageRouter<Arc<NetworkGraph>, Arc<Logger>, Arc<lightning::sign::KeysManager>>>, Arc<ChannelManager<B, F, FE>>, lightning::ln::peer_handler::IgnoringMessageHandler, lightning::ln::peer_handler::IgnoringMessageHandler, lightning::ln::peer_handler::IgnoringMessageHandler>;
-/// # type LiquidityManager<B, F, FE> = lightning_liquidity::LiquidityManager<Arc<lightning::sign::KeysManager>, Arc<lightning::sign::KeysManager>, Arc<ChannelManager<B, F, FE>>, Arc<F>, Arc<Store>, Arc<DefaultTimeProvider>, Arc<B>>;
+/// # type LiquidityManager<B, F, FE> = lightning_liquidity::LiquidityManager<Arc<lightning::sign::KeysManager>, Arc<lightning::sign::KeysManager>, Arc<ChannelManager<B, F, FE>>, Arc<Store>, Arc<DefaultTimeProvider>, Arc<B>>;
/// # type Scorer = RwLock<lightning::routing::scoring::ProbabilisticScorer<Arc<NetworkGraph>, Arc<Logger>>>;
/// # type PeerManager<B, F, FE, UL> = lightning::ln::peer_handler::SimpleArcPeerManager<SocketDescriptor, ChainMonitor<B, F, FE>, B, FE, Arc<UL>, Logger, F, StoreSync>;
/// # type OutputSweeper<B, D, FE, F, O> = lightning::util::sweep::OutputSweeper<Arc<B>, Arc<D>, Arc<FE>, Arc<F>, Arc<Store>, Arc<Logger>, Arc<O>>;
@@ -1898,7 +1896,7 @@ mod tests {
use core::sync::atomic::{AtomicBool, Ordering};
use lightning::chain::channelmonitor::ANTI_REORG_DELAY;
use lightning::chain::transaction::OutPoint;
- use lightning::chain::{chainmonitor, BestBlock, Confirm, Filter};
+ use lightning::chain::{chainmonitor, BestBlock, Confirm};
use lightning::events::{Event, PathFailure, ReplayEvent};
use lightning::ln::channelmanager;
use lightning::ln::channelmanager::{
@@ -2054,7 +2052,6 @@ mod tests {
Arc<KeysManager>,
Arc<KeysManager>,
Arc<ChannelManager>,
- Arc<dyn Filter + Sync + Send>,
Arc<Persister>,
DefaultTimeProvider,
Arc<test_utils::TestBroadcaster>,
@@ -2513,8 +2510,6 @@ mod tests {
Arc::clone(&keys_manager),
Arc::clone(&keys_manager),
Arc::clone(&manager),
- None,
- None,
Arc::clone(&kv_store),
Arc::clone(&tx_broadcaster),
None,
@@ -2910,10 +2905,10 @@ mod tests {
let kv_store = KVStoreSyncWrapper(kv_store_sync);
// Yes, you can unsafe { turn off the borrow checker }
- let lm_async: &'static LiquidityManager<_, _, _, _, _, _, _> = unsafe {
+ let lm_async: &'static LiquidityManager<_, _, _, _, _, _> = unsafe {
&*(nodes[0].liquidity_manager.get_lm_async()
- as *const LiquidityManager<_, _, _, _, _, _, _>)
- as &'static LiquidityManager<_, _, _, _, _, _, _>
+ as *const LiquidityManager<_, _, _, _, _, _>)
+ as &'static LiquidityManager<_, _, _, _, _, _>
};
let sweeper_async: &'static OutputSweeper<_, _, _, _, _, _, _> = unsafe {
&*(nodes[0].sweeper.sweeper_async() as *const OutputSweeper<_, _, _, _, _, _, _>)
@@ -3435,10 +3430,10 @@ mod tests {
let kv_store = KVStoreSyncWrapper(kv_store_sync);
// Yes, you can unsafe { turn off the borrow checker }
- let lm_async: &'static LiquidityManager<_, _, _, _, _, _, _> = unsafe {
+ let lm_async: &'static LiquidityManager<_, _, _, _, _, _> = unsafe {
&*(nodes[0].liquidity_manager.get_lm_async()
- as *const LiquidityManager<_, _, _, _, _, _, _>)
- as &'static LiquidityManager<_, _, _, _, _, _, _>
+ as *const LiquidityManager<_, _, _, _, _, _>)
+ as &'static LiquidityManager<_, _, _, _, _, _>
};
let sweeper_async: &'static OutputSweeper<_, _, _, _, _, _, _> = unsafe {
&*(nodes[0].sweeper.sweeper_async() as *const OutputSweeper<_, _, _, _, _, _, _>)
@@ -3662,10 +3657,10 @@ mod tests {
let (exit_sender, exit_receiver) = tokio::sync::watch::channel(());
// Yes, you can unsafe { turn off the borrow checker }
- let lm_async: &'static LiquidityManager<_, _, _, _, _, _, _> = unsafe {
+ let lm_async: &'static LiquidityManager<_, _, _, _, _, _> = unsafe {
&*(nodes[0].liquidity_manager.get_lm_async()
- as *const LiquidityManager<_, _, _, _, _, _, _>)
- as &'static LiquidityManager<_, _, _, _, _, _, _>
+ as *const LiquidityManager<_, _, _, _, _, _>)
+ as &'static LiquidityManager<_, _, _, _, _, _>
};
let sweeper_async: &'static OutputSweeper<_, _, _, _, _, _, _> = unsafe {
&*(nodes[0].sweeper.sweeper_async() as *const OutputSweeper<_, _, _, _, _, _, _>)
diff --git a/lightning-liquidity/src/manager.rs b/lightning-liquidity/src/manager.rs
index 5336e6f..45a85e7 100644
--- a/lightning-liquidity/src/manager.rs
+++ b/lightning-liquidity/src/manager.rs
@@ -43,8 +43,7 @@ use crate::utils::time::DefaultTimeProvider;
use crate::utils::time::TimeProvider;
use lightning::chain::chaininterface::BroadcasterInterface;
-use lightning::chain::{self, BestBlock, Confirm, Filter, Listen};
-use lightning::ln::channelmanager::{AChannelManager, ChainParameters};
+use lightning::ln::channelmanager::AChannelManager;
use lightning::ln::msgs::{ErrorAction, LightningError};
use lightning::ln::peer_handler::CustomMessageHandler;
use lightning::ln::wire::CustomMessageReader;
@@ -111,8 +110,6 @@ pub trait ALiquidityManager {
type AChannelManager: AChannelManager + ?Sized;
/// A type that may be dereferenced to [`Self::AChannelManager`].
type CM: Deref<Target = Self::AChannelManager> + Clone;
- /// A type implementing [`Filter`].
- type C: Filter + Clone;
/// A type implementing [`KVStore`].
type K: KVStore + Clone;
/// A type implementing [`TimeProvider`].
@@ -128,7 +125,6 @@ pub trait ALiquidityManager {
Self::EntropySource,
Self::NodeSigner,
Self::CM,
- Self::C,
Self::K,
Self::TP,
Self::BroadcasterInterface,
@@ -139,11 +135,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
K: KVStore + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > ALiquidityManager for LiquidityManager<ES, NS, CM, C, K, TP, T>
+ > ALiquidityManager for LiquidityManager<ES, NS, CM, K, TP, T>
where
CM::Target: AChannelManager,
TP::Target: TimeProvider,
@@ -152,12 +147,11 @@ where
type NodeSigner = NS;
type AChannelManager = CM::Target;
type CM = CM;
- type C = C;
type K = K;
type TimeProvider = TP::Target;
type TP = TP;
type BroadcasterInterface = T;
- fn get_lm(&self) -> &LiquidityManager<ES, NS, CM, C, K, TP, T> {
+ fn get_lm(&self) -> &LiquidityManager<ES, NS, CM, K, TP, T> {
self
}
}
@@ -175,8 +169,6 @@ pub trait ALiquidityManagerSync {
type AChannelManager: AChannelManager + ?Sized;
/// A type that may be dereferenced to [`Self::AChannelManager`].
type CM: Deref<Target = Self::AChannelManager> + Clone;
- /// A type implementing [`Filter`].
- type C: Filter + Clone;
/// A type implementing [`KVStoreSync`].
type KVStoreSync: KVStoreSync + ?Sized;
/// A type that may be dereferenced to [`Self::KVStoreSync`].
@@ -195,7 +187,6 @@ pub trait ALiquidityManagerSync {
Self::EntropySource,
Self::NodeSigner,
Self::CM,
- Self::C,
KVStoreSyncWrapper<Self::KS>,
Self::TP,
Self::BroadcasterInterface,
@@ -207,7 +198,6 @@ pub trait ALiquidityManagerSync {
Self::EntropySource,
Self::NodeSigner,
Self::CM,
- Self::C,
Self::KS,
Self::TP,
Self::BroadcasterInterface,
@@ -218,11 +208,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
KS: Deref + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > ALiquidityManagerSync for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
+ > ALiquidityManagerSync for LiquidityManagerSync<ES, NS, CM, KS, TP, T>
where
CM::Target: AChannelManager,
KS::Target: KVStoreSync,
@@ -232,7 +221,6 @@ where
type NodeSigner = NS;
type AChannelManager = CM::Target;
type CM = CM;
- type C = C;
type KVStoreSync = KS::Target;
type KS = KS;
type TimeProvider = TP::Target;
@@ -246,14 +234,13 @@ where
Self::EntropySource,
Self::NodeSigner,
Self::CM,
- Self::C,
KVStoreSyncWrapper<Self::KS>,
Self::TP,
Self::BroadcasterInterface,
> {
&self.inner
}
- fn get_lm(&self) -> &LiquidityManagerSync<ES, NS, CM, C, KS, TP, T> {
+ fn get_lm(&self) -> &LiquidityManagerSync<ES, NS, CM, KS, TP, T> {
self
}
}
@@ -281,7 +268,6 @@ pub struct LiquidityManager<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
K: KVStore + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
@@ -305,8 +291,6 @@ pub struct LiquidityManager<
lsps5_client_handler: Option<LSPS5ClientHandler<ES, K>>,
service_config: Option<LiquidityServiceConfig>,
_client_config: Option<LiquidityClientConfig>,
- best_block: RwLock<Option<BestBlock>>,
- _chain_source: Option<C>,
pending_msgs_or_needs_persist_notifier: Arc<Notifier>,
}
@@ -315,10 +299,9 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
K: KVStore + Clone,
T: BroadcasterInterface + Clone,
- > LiquidityManager<ES, NS, CM, C, K, DefaultTimeProvider, T>
+ > LiquidityManager<ES, NS, CM, K, DefaultTimeProvider, T>
where
CM::Target: AChannelManager,
{
@@ -326,9 +309,8 @@ where
///
/// Will read persisted service states from the given [`KVStore`].
pub async fn new(
- entropy_source: ES, node_signer: NS, channel_manager: CM, chain_source: Option<C>,
- chain_params: Option<ChainParameters>, kv_store: K, transaction_broadcaster: T,
- service_config: Option<LiquidityServiceConfig>,
+ entropy_source: ES, node_signer: NS, channel_manager: CM, kv_store: K,
+ transaction_broadcaster: T, service_config: Option<LiquidityServiceConfig>,
client_config: Option<LiquidityClientConfig>,
) -> Result<Self, lightning::io::Error> {
Self::new_with_custom_time_provider(
@@ -336,8 +318,6 @@ where
node_signer,
channel_manager,
transaction_broadcaster,
- chain_source,
- chain_params,
kv_store,
service_config,
client_config,
@@ -351,11 +331,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
K: KVStore + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > LiquidityManager<ES, NS, CM, C, K, TP, T>
+ > LiquidityManager<ES, NS, CM, K, TP, T>
where
CM::Target: AChannelManager,
TP::Target: TimeProvider,
@@ -370,8 +349,7 @@ where
/// [`LiquidityClientConfig`] and [`LiquidityServiceConfig`].
pub async fn new_with_custom_time_provider(
entropy_source: ES, node_signer: NS, channel_manager: CM, transaction_broadcaster: T,
- chain_source: Option<C>, chain_params: Option<ChainParameters>, kv_store: K,
- service_config: Option<LiquidityServiceConfig>,
+ kv_store: K, service_config: Option<LiquidityServiceConfig>,
client_config: Option<LiquidityClientConfig>, time_provider: TP,
) -> Result<Self, lightning::io::Error> {
let pending_msgs_or_needs_persist_notifier = Arc::new(Notifier::new());
@@ -517,8 +495,6 @@ where
lsps5_service_handler,
service_config,
_client_config: client_config,
- best_block: RwLock::new(chain_params.map(|chain_params| chain_params.best_block)),
- _chain_source: chain_source,
pending_msgs_or_needs_persist_notifier,
})
}
@@ -772,11 +748,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
K: KVStore + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > CustomMessageReader for LiquidityManager<ES, NS, CM, C, K, TP, T>
+ > CustomMessageReader for LiquidityManager<ES, NS, CM, K, TP, T>
where
CM::Target: AChannelManager,
TP::Target: TimeProvider,
@@ -799,11 +774,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
K: KVStore + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > CustomMessageHandler for LiquidityManager<ES, NS, CM, C, K, TP, T>
+ > CustomMessageHandler for LiquidityManager<ES, NS, CM, K, TP, T>
where
CM::Target: AChannelManager,
TP::Target: TimeProvider,
@@ -924,93 +898,12 @@ where
}
}
-impl<
- ES: EntropySource + Clone,
- NS: NodeSigner + Clone,
- CM: Deref + Clone,
- C: Filter + Clone,
- K: KVStore + Clone,
- TP: Deref + Clone,
- T: BroadcasterInterface + Clone,
- > Listen for LiquidityManager<ES, NS, CM, C, K, TP, T>
-where
- CM::Target: AChannelManager,
- TP::Target: TimeProvider,
-{
- fn filtered_block_connected(
- &self, header: &bitcoin::block::Header, txdata: &chain::transaction::TransactionData,
- height: u32,
- ) {
- if let Some(best_block) = self.best_block.read().unwrap().as_ref() {
- assert_eq!(best_block.block_hash, header.prev_blockhash,
- "Blocks must be connected in chain-order - the connected header must build on the last connected header");
- assert_eq!(best_block.height, height - 1,
- "Blocks must be connected in chain-order - the connected block height must be one greater than the previous height");
- }
-
- self.transactions_confirmed(header, txdata, height);
- self.best_block_updated(header, height);
- }
-
- fn blocks_disconnected(&self, fork_point: BestBlock) {
- if let Some(best_block) = self.best_block.write().unwrap().as_mut() {
- assert!(best_block.height > fork_point.height,
- "Blocks disconnected must indicate disconnection from the current best height, i.e. the new chain tip must be lower than the previous best height");
- *best_block = fork_point;
- }
-
- // TODO: Call block_disconnected on all sub-modules that require it, e.g., LSPS1MessageHandler.
- // Internally this should call transaction_unconfirmed for all transactions that were
- // confirmed at a height <= the one we now disconnected.
- }
-}
-
-impl<
- ES: EntropySource + Clone,
- NS: NodeSigner + Clone,
- CM: Deref + Clone,
- C: Filter + Clone,
- K: KVStore + Clone,
- TP: Deref + Clone,
- T: BroadcasterInterface + Clone,
- > Confirm for LiquidityManager<ES, NS, CM, C, K, TP, T>
-where
- CM::Target: AChannelManager,
- TP::Target: TimeProvider,
-{
- fn transactions_confirmed(
- &self, _header: &bitcoin::block::Header, _txdata: &chain::transaction::TransactionData,
- _height: u32,
- ) {
- // TODO: Call transactions_confirmed on all sub-modules that require it, e.g., LSPS1MessageHandler.
- }
-
- fn transaction_unconfirmed(&self, _txid: &bitcoin::Txid) {
- // TODO: Call transaction_unconfirmed on all sub-modules that require it, e.g., LSPS1MessageHandler.
- // Internally this should call transaction_unconfirmed for all transactions that were
- // confirmed at a height <= the one we now unconfirmed.
- }
-
- fn best_block_updated(&self, header: &bitcoin::block::Header, height: u32) {
- let new_best_block = BestBlock::new(header.block_hash(), height);
- *self.best_block.write().unwrap() = Some(new_best_block);
-
- // TODO: Call best_block_updated on all sub-modules that require it, e.g., LSPS1MessageHandler.
- }
-
- fn get_relevant_txids(&self) -> Vec<(bitcoin::Txid, u32, Option<bitcoin::BlockHash>)> {
- // TODO: Collect relevant txids from all sub-modules that, e.g., LSPS1MessageHandler.
- Vec::new()
- }
-}
-
/// A synchroneous wrapper around [`LiquidityManager`] to be used in contexts where async is not
/// available.
pub struct LiquidityManagerSync<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
KS: Deref + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
@@ -1019,7 +912,7 @@ pub struct LiquidityManagerSync<
KS::Target: KVStoreSync,
TP::Target: TimeProvider,
{
- inner: LiquidityManager<ES, NS, CM, C, KVStoreSyncWrapper<KS>, TP, T>,
+ inner: LiquidityManager<ES, NS, CM, KVStoreSyncWrapper<KS>, TP, T>,
}
#[cfg(feature = "time")]
@@ -1027,10 +920,9 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
KS: Deref + Clone,
T: BroadcasterInterface + Clone,
- > LiquidityManagerSync<ES, NS, CM, C, KS, DefaultTimeProvider, T>
+ > LiquidityManagerSync<ES, NS, CM, KS, DefaultTimeProvider, T>
where
CM::Target: AChannelManager,
KS::Target: KVStoreSync,
@@ -1039,9 +931,8 @@ where
///
/// Wraps [`LiquidityManager::new`].
pub fn new(
- entropy_source: ES, node_signer: NS, channel_manager: CM, chain_source: Option<C>,
- chain_params: Option<ChainParameters>, kv_store_sync: KS, transaction_broadcaster: T,
- service_config: Option<LiquidityServiceConfig>,
+ entropy_source: ES, node_signer: NS, channel_manager: CM, kv_store_sync: KS,
+ transaction_broadcaster: T, service_config: Option<LiquidityServiceConfig>,
client_config: Option<LiquidityClientConfig>,
) -> Result<Self, lightning::io::Error> {
let kv_store = KVStoreSyncWrapper(kv_store_sync);
@@ -1050,8 +941,6 @@ where
entropy_source,
node_signer,
channel_manager,
- chain_source,
- chain_params,
kv_store,
transaction_broadcaster,
service_config,
@@ -1075,11 +964,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
KS: Deref + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
+ > LiquidityManagerSync<ES, NS, CM, KS, TP, T>
where
CM::Target: AChannelManager,
KS::Target: KVStoreSync,
@@ -1089,9 +977,8 @@ where
///
/// Wraps [`LiquidityManager::new_with_custom_time_provider`].
pub fn new_with_custom_time_provider(
- entropy_source: ES, node_signer: NS, channel_manager: CM, chain_source: Option<C>,
- chain_params: Option<ChainParameters>, kv_store_sync: KS, transaction_broadcaster: T,
- service_config: Option<LiquidityServiceConfig>,
+ entropy_source: ES, node_signer: NS, channel_manager: CM, kv_store_sync: KS,
+ transaction_broadcaster: T, service_config: Option<LiquidityServiceConfig>,
client_config: Option<LiquidityClientConfig>, time_provider: TP,
) -> Result<Self, lightning::io::Error> {
let kv_store = KVStoreSyncWrapper(kv_store_sync);
@@ -1100,8 +987,6 @@ where
node_signer,
channel_manager,
transaction_broadcaster,
- chain_source,
- chain_params,
kv_store,
service_config,
client_config,
@@ -1241,11 +1126,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
KS: Deref + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > CustomMessageReader for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
+ > CustomMessageReader for LiquidityManagerSync<ES, NS, CM, KS, TP, T>
where
CM::Target: AChannelManager,
KS::Target: KVStoreSync,
@@ -1264,11 +1148,10 @@ impl<
ES: EntropySource + Clone,
NS: NodeSigner + Clone,
CM: Deref + Clone,
- C: Filter + Clone,
KS: Deref + Clone,
TP: Deref + Clone,
T: BroadcasterInterface + Clone,
- > CustomMessageHandler for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
+ > CustomMessageHandler for LiquidityManagerSync<ES, NS, CM, KS, TP, T>
where
CM::Target: AChannelManager,
KS::Target: KVStoreSync,
@@ -1302,63 +1185,3 @@ where
self.inner.peer_connected(counterparty_node_id, init_msg, inbound)
}
}
-
-impl<
- ES: EntropySource + Clone,
- NS: NodeSigner + Clone,
- CM: Deref + Clone,
- C: Filter + Clone,
- KS: Deref + Clone,
- TP: Deref + Clone,
- T: BroadcasterInterface + Clone,
- > Listen for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
-where
- CM::Target: AChannelManager,
- KS::Target: KVStoreSync,
- TP::Target: TimeProvider,
-{
- fn filtered_block_connected(
- &self, header: &bitcoin::block::Header, txdata: &chain::transaction::TransactionData,
- height: u32,
- ) {
- self.inner.filtered_block_connected(header, txdata, height)
- }
-
- fn blocks_disconnected(&self, fork_point: BestBlock) {
- self.inner.blocks_disconnected(fork_point);
- }
-}
-
-impl<
- ES: EntropySource + Clone,
- NS: NodeSigner + Clone,
- CM: Deref + Clone,
- C: Filter + Clone,
- KS: Deref + Clone,
- TP: Deref + Clone,
- T: BroadcasterInterface + Clone,
- > Confirm for LiquidityManagerSync<ES, NS, CM, C, KS, TP, T>
-where
- CM::Target: AChannelManager,
- KS::Target: KVStoreSync,
- TP::Target: TimeProvider,
-{
- fn transactions_confirmed(
- &self, header: &bitcoin::block::Header, txdata: &chain::transaction::TransactionData,
- height: u32,
- ) {
- self.inner.transactions_confirmed(header, txdata, height)
- }
-
- fn transaction_unconfirmed(&self, txid: &bitcoin::Txid) {
- self.inner.transaction_unconfirmed(txid)
- }
-
- fn best_block_updated(&self, header: &bitcoin::block::Header, height: u32) {
- self.inner.best_block_updated(header, height)
- }
-
- fn get_relevant_txids(&self) -> Vec<(bitcoin::Txid, u32, Option<bitcoin::BlockHash>)> {
- self.inner.get_relevant_txids()
- }
-}
diff --git a/lightning-liquidity/tests/common/mod.rs b/lightning-liquidity/tests/common/mod.rs
index dea9875..2716df7 100644
--- a/lightning-liquidity/tests/common/mod.rs
+++ b/lightning-liquidity/tests/common/mod.rs
@@ -3,13 +3,9 @@
use lightning_liquidity::utils::time::TimeProvider;
use lightning_liquidity::{LiquidityClientConfig, LiquidityManagerSync, LiquidityServiceConfig};
-use lightning::chain::{BestBlock, Filter};
-use lightning::ln::channelmanager::ChainParameters;
use lightning::ln::functional_test_utils::{Node, TestChannelManager};
use lightning::util::test_utils::{TestBroadcaster, TestKeysInterface, TestStore};
-use bitcoin::Network;
-
use core::ops::Deref;
use std::sync::Arc;
@@ -26,11 +22,6 @@ fn build_service_and_client_nodes<'a, 'b, 'c>(
) -> (LiquidityNode<'a, 'b, 'c>, LiquidityNode<'a, 'b, 'c>, Option<Node<'a, 'b, 'c>>) {
assert!(nodes.len() >= 2, "Need at least two nodes (service and client)");
- let chain_params = ChainParameters {
- network: Network::Testnet,
- best_block: BestBlock::from_network(Network::Testnet),
- };
-
let mut nodes_iter = nodes.into_iter();
let service_inner = nodes_iter.next().expect("missing service node");
let client_inner = nodes_iter.next().expect("missing client node");
@@ -40,8 +31,6 @@ fn build_service_and_client_nodes<'a, 'b, 'c>(
service_inner.keys_manager,
service_inner.keys_manager,
service_inner.node,
- None::<Arc<dyn Filter + Send + Sync>>,
- Some(chain_params.clone()),
service_kv_store,
service_inner.tx_broadcaster,
Some(service_config),
@@ -54,8 +43,6 @@ fn build_service_and_client_nodes<'a, 'b, 'c>(
client_inner.keys_manager,
client_inner.keys_manager,
client_inner.node,
- None::<Arc<dyn Filter + Send + Sync>>,
- Some(chain_params),
client_kv_store,
client_inner.tx_broadcaster,
None,
@@ -137,7 +124,6 @@ pub(crate) struct LiquidityNode<'a, 'b, 'c> {
&'c TestKeysInterface,
&'c TestKeysInterface,
&'a TestChannelManager<'b, 'c>,
- Arc<dyn Filter + Send + Sync>,
Arc<TestStore>,
Arc<dyn TimeProvider + Send + Sync>,
&'c TestBroadcaster,
@@ -151,7 +137,6 @@ impl<'a, 'b, 'c> LiquidityNode<'a, 'b, 'c> {
&'c TestKeysInterface,
&'c TestKeysInterface,
&'a TestChannelManager<'b, 'c>,
- Arc<dyn Filter + Send + Sync>,
Arc<TestStore>,
Arc<dyn TimeProvider + Send + Sync>,
&'c TestBroadcaster,
diff --git a/lightning-liquidity/tests/lsps2_integration_tests.rs b/lightning-liquidity/tests/lsps2_integration_tests.rs
index 33a6dd6..1c37f16 100644
--- a/lightning-liquidity/tests/lsps2_integration_tests.rs
+++ b/lightning-liquidity/tests/lsps2_integration_tests.rs
@@ -27,8 +27,7 @@ use lightning_liquidity::lsps2::utils::is_valid_opening_fee_params;
use lightning_liquidity::utils::time::{DefaultTimeProvider, TimeProvider};
use lightning_liquidity::{LiquidityClientConfig, LiquidityManagerSync, LiquidityServiceConfig};
-use lightning::chain::{BestBlock, Filter};
-use lightning::ln::channelmanager::{ChainParameters, InterceptId, MIN_FINAL_CLTV_EXPIRY_DELTA};
+use lightning::ln::channelmanager::{InterceptId, MIN_FINAL_CLTV_EXPIRY_DELTA};
use lightning::ln::functional_test_utils::{
create_chanmon_cfgs, create_node_cfgs, create_node_chanmgrs,
};
@@ -1071,19 +1070,12 @@ fn lsps2_service_handler_persistence_across_restarts() {
let nodes_restart = create_network(2, &node_cfgs, &node_chanmgrs_restart);
// Create a new LiquidityManager with the same configuration and KV store to simulate restart
- let chain_params = ChainParameters {
- network: Network::Testnet,
- best_block: BestBlock::from_network(Network::Testnet),
- };
-
let transaction_broadcaster = Arc::new(TestBroadcaster::new(Network::Testnet));
let restarted_service_lm = LiquidityManagerSync::new_with_custom_time_provider(
nodes_restart[0].keys_manager,
nodes_restart[0].keys_manager,
nodes_restart[0].node,
- None::<Arc<dyn Filter + Send + Sync>>,
- Some(chain_params),
service_kv_store,
transaction_broadcaster,
Some(service_config),
diff --git a/lightning-liquidity/tests/lsps5_integration_tests.rs b/lightning-liquidity/tests/lsps5_integration_tests.rs
index 16f20fd..6af0c13 100644
--- a/lightning-liquidity/tests/lsps5_integration_tests.rs
+++ b/lightning-liquidity/tests/lsps5_integration_tests.rs
@@ -7,9 +7,8 @@ use common::{
get_lsps_message, LSPSNodes, LiquidityNode,
};
-use lightning::chain::{BestBlock, Filter};
use lightning::events::ClosureReason;
-use lightning::ln::channelmanager::{ChainParameters, InterceptId};
+use lightning::ln::channelmanager::InterceptId;
use lightning::ln::functional_test_utils::{
check_closed_event, close_channel, create_chan_between_nodes, create_chanmon_cfgs,
create_network, create_node_cfgs, create_node_chanmgrs, Node,
@@ -43,8 +42,6 @@ use lightning_liquidity::{LiquidityClientConfig, LiquidityServiceConfig};
use lightning_types::payment::PaymentHash;
-use bitcoin::Network;
-
use std::str::FromStr;
use std::sync::{Arc, RwLock};
use std::time::Duration;
@@ -1601,18 +1598,10 @@ fn lsps5_service_handler_persistence_across_restarts() {
let node_chanmgrs_restart = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes_restart = create_network(2, &node_cfgs, &node_chanmgrs_restart);
- // Create a new LiquidityManager with the same configuration and KV store to simulate restart
- let chain_params = ChainParameters {
- network: Network::Testnet,
- best_block: BestBlock::from_network(Network::Testnet),
- };
-
let restarted_service_lm = LiquidityManagerSync::new_with_custom_time_provider(
nodes_restart[0].keys_manager,
nodes_restart[0].keys_manager,
nodes_restart[0].node,
- None::<Arc<dyn Filter + Send + Sync>>,
- Some(chain_params),
service_kv_store,
nodes_restart[0].tx_broadcaster,
Some(service_config),
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.