Skip to content

Commit e47e7ad

Browse files
committed
more wrapping
1 parent 72226d5 commit e47e7ad

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,6 @@ impl BackgroundProcessor {
10061006
L,
10071007
P,
10081008
ES,
1009-
FS,
10101009
>,
10111010
>
10121011
+ Send
@@ -1023,7 +1022,6 @@ impl BackgroundProcessor {
10231022
O: 'static + Deref,
10241023
K: 'static + Deref,
10251024
OS: 'static + Deref<Target = OutputSweeperSync<T, D, F, CF, K, L, O>> + Send,
1026-
FS: FutureSpawner,
10271025
>(
10281026
persister: PS, event_handler: EH, chain_monitor: M, channel_manager: CM,
10291027
onion_messenger: Option<OM>, gossip_sync: GossipSync<PGS, RGS, G, UL, L>, peer_manager: PM,

lightning/src/chain/chainmonitor.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ where
324324
P::Target: PersistSync<ChannelSigner>,
325325
ES::Target: EntropySource,
326326
{
327+
/// Create a new `ChainMonitorSync` instance.
327328
pub fn new(
328329
chain_source: Option<C>, broadcaster: T, logger: L, feeest: F, persister: P,
329330
entropy_source: ES, our_peerstorage_encryption_key: PeerStorageKey,
@@ -357,6 +358,13 @@ where
357358
pub fn list_pending_monitor_updates(&self) -> HashMap<ChannelId, Vec<u64>> {
358359
self.0.list_pending_monitor_updates()
359360
}
361+
362+
/// See [`ChainMonitor::get_monitor`].
363+
pub fn get_monitor(
364+
&self, channel_id: ChannelId,
365+
) -> Result<LockedChannelMonitor<'_, ChannelSigner>, ()> {
366+
self.0.get_monitor(channel_id)
367+
}
360368
}
361369

362370
impl<
@@ -458,6 +466,32 @@ where
458466
}
459467
}
460468

469+
impl<
470+
ChannelSigner: EcdsaChannelSigner + 'static,
471+
C: Deref,
472+
T: Deref,
473+
F: Deref,
474+
L: Deref,
475+
P: Deref,
476+
ES: Deref,
477+
> chain::Listen for ChainMonitorSync<ChannelSigner, C, T, F, L, P, ES>
478+
where
479+
C::Target: chain::Filter,
480+
T::Target: BroadcasterInterface,
481+
F::Target: FeeEstimator,
482+
L::Target: Logger,
483+
P::Target: PersistSync<ChannelSigner>,
484+
ES::Target: EntropySource,
485+
{
486+
fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) {
487+
self.0.filtered_block_connected(header, txdata, height);
488+
}
489+
490+
fn block_disconnected(&self, header: &Header, height: u32) {
491+
self.0.block_disconnected(header, height);
492+
}
493+
}
494+
461495
impl<
462496
ChannelSigner: EcdsaChannelSigner + 'static,
463497
C: Deref,

lightning/src/util/async_poll.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ pub trait FutureSpawner: Send + Sync + 'static {
131131
fn spawn<T: Future<Output = ()> + Send + 'static>(&self, future: T);
132132
}
133133

134+
/// A no-op implementation of `FutureSpawner` for synchronous contexts.
134135
pub struct FutureSpawnerSync {}
135136

136137
impl FutureSpawner for FutureSpawnerSync {

lightning/src/util/persist.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ where
685685
BI::Target: BroadcasterInterface,
686686
FE::Target: FeeEstimator,
687687
{
688+
/// Constructs a new [`MonitorUpdatingPersister`].
688689
pub fn new(
689690
kv_store: K, logger: L, maximum_pending_updates: u64, entropy_source: ES,
690691
signer_provider: SP, broadcaster: BI, fee_estimator: FE,
@@ -701,6 +702,7 @@ where
701702
Self { state: Arc::new(state) }
702703
}
703704

705+
/// Pass through to [`MonitorUpdatingPersisterState::read_all_channel_monitors_with_updates`].
704706
pub async fn read_all_channel_monitors_with_updates(
705707
&self,
706708
) -> Result<
@@ -710,11 +712,13 @@ where
710712
self.state.read_all_channel_monitors_with_updates().await
711713
}
712714

715+
/// Pass through to [`MonitorUpdatingPersisterState::cleanup_stale_updates`].
713716
pub async fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), io::Error> {
714717
self.state.cleanup_stale_updates(lazy).await
715718
}
716719
}
717720

721+
/// A synchronous version of [`MonitorUpdatingPersister`].
718722
pub struct MonitorUpdatingPersisterSync<
719723
K: Deref,
720724
L: Deref,
@@ -776,6 +780,7 @@ where
776780
BI::Target: BroadcasterInterface,
777781
FE::Target: FeeEstimator,
778782
{
783+
/// Constructs a new [`MonitorUpdatingPersisterSync`].
779784
pub fn new(
780785
kv_store: K, logger: L, maximum_pending_updates: u64, entropy_source: ES,
781786
signer_provider: SP, broadcaster: BI, fee_estimator: FE,
@@ -793,6 +798,7 @@ where
793798
Self(persister)
794799
}
795800

801+
/// An synchronous version of [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`].
796802
pub fn read_all_channel_monitors_with_updates(
797803
&self,
798804
) -> Result<
@@ -810,6 +816,7 @@ where
810816
}
811817
}
812818

819+
/// A synchronous version of [`MonitorUpdatingPersister::cleanup_stale_updates`].
813820
pub fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), io::Error> {
814821
let mut fut = Box::pin(self.0.cleanup_stale_updates(lazy));
815822
let mut waker = dummy_waker();

0 commit comments

Comments
 (0)