From: Matt Corallo Date: Sat, 30 Sep 2023 17:40:42 +0000 (+0000) Subject: Switch `Simple*ChannelManager` locks around `Score` to `RwLock` X-Git-Tag: v0.0.117~5^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=refs%2Fheads%2F2023-09-writeable-rwlock;p=rust-lightning Switch `Simple*ChannelManager` locks around `Score` to `RwLock` This switches the locks used around `ProbabilisticScorer` in `Simple*ChannelManager` type aliases to `RwLock`. --- diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index efa1a4214..a33c09874 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -501,7 +501,7 @@ use core::task; /// could setup `process_events_async` like this: /// ``` /// # use lightning::io; -/// # use std::sync::{Arc, Mutex}; +/// # use std::sync::{Arc, RwLock}; /// # use std::sync::atomic::{AtomicBool, Ordering}; /// # use lightning_background_processor::{process_events_async, GossipSync}; /// # struct MyStore {} @@ -532,7 +532,7 @@ use core::task; /// # type MyNetworkGraph = lightning::routing::gossip::NetworkGraph>; /// # type MyGossipSync = lightning::routing::gossip::P2PGossipSync, Arc, Arc>; /// # type MyChannelManager = lightning::ln::channelmanager::SimpleArcChannelManager; -/// # type MyScorer = Mutex, Arc>>; +/// # type MyScorer = RwLock, Arc>>; /// /// # async fn setup_background_processing(my_persister: Arc, my_event_handler: Arc, my_chain_monitor: Arc, my_channel_manager: Arc, my_gossip_sync: Arc, my_logger: Arc, my_scorer: Arc, my_peer_manager: Arc) { /// let background_persister = Arc::clone(&my_persister); diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 3f6a2a6b2..092ebc2c5 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -803,7 +803,7 @@ pub type SimpleArcChannelManager = ChannelManager< Arc>>, Arc, - Arc>>, Arc>>>, + Arc>>, Arc>>>, ProbabilisticScoringFeeParameters, ProbabilisticScorer>>, Arc>, >>, @@ -832,7 +832,7 @@ pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, M, T, F, L> = &'e DefaultRouter< &'f NetworkGraph<&'g L>, &'g L, - &'h Mutex, &'g L>>, + &'h RwLock, &'g L>>, ProbabilisticScoringFeeParameters, ProbabilisticScorer<&'f NetworkGraph<&'g L>, &'g L> >,