Struct lightning::chain::chainmonitor::ChainMonitor [−][src]
An implementation of chain::Watch
for monitoring channels.
Connected and disconnected blocks must be provided to ChainMonitor
as documented by
chain::Watch
. May be used in conjunction with ChannelManager
to monitor channels locally
or used independently to monitor channels remotely. See the module-level documentation for
details.
Fields
monitors: RwLock<HashMap<OutPoint, ChannelMonitor<ChannelSigner>>>
The monitors
Implementations
impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> ChainMonitor<ChannelSigner, C, T, F, L, P> where
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
[src]
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
pub fn block_connected(
&self,
header: &BlockHeader,
txdata: &TransactionData<'_>,
height: u32
)
[src]
&self,
header: &BlockHeader,
txdata: &TransactionData<'_>,
height: u32
)
Dispatches to per-channel monitors, which are responsible for updating their on-chain view
of a channel and reacting accordingly based on transactions in the connected block. See
ChannelMonitor::block_connected
for details. Any HTLCs that were resolved on chain will
be returned by chain::Watch::release_pending_monitor_events
.
Calls back to chain::Filter
if any monitor indicated new outputs to watch. Subsequent
calls must not exclude any transactions matching the new outputs nor any in-block
descendants of such transactions. It is not necessary to re-fetch the block to obtain
updated txdata
.
pub fn block_disconnected(&self, header: &BlockHeader, disconnected_height: u32)
[src]
Dispatches to per-channel monitors, which are responsible for updating their on-chain view
of a channel based on the disconnected block. See ChannelMonitor::block_disconnected
for
details.
pub fn new(
chain_source: Option<C>,
broadcaster: T,
logger: L,
feeest: F,
persister: P
) -> Self
[src]
chain_source: Option<C>,
broadcaster: T,
logger: L,
feeest: F,
persister: P
) -> Self
Creates a new ChainMonitor
used to watch on-chain activity pertaining to channels.
When an optional chain source implementing chain::Filter
is provided, the chain monitor
will call back to it indicating transactions and outputs of interest. This allows clients to
pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
always need to fetch full blocks absent another means for determining which blocks contain
transactions relevant to the watched channels.
Trait Implementations
impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> EventsProvider for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
[src]
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
fn get_and_clear_pending_events(&self) -> Vec<Event>
[src]
impl<ChannelSigner: Sign, C: Deref + Send + Sync, T: Deref + Send + Sync, F: Deref + Send + Sync, L: Deref + Send + Sync, P: Deref + Send + Sync> Listen for ChainMonitor<ChannelSigner, C, T, F, L, P> where
ChannelSigner: Sign,
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
[src]
ChannelSigner: Sign,
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
fn block_connected(&self, block: &Block, height: u32)
[src]
fn block_disconnected(&self, header: &BlockHeader, height: u32)
[src]
impl<ChannelSigner: Sign, C: Deref + Sync + Send, T: Deref + Sync + Send, F: Deref + Sync + Send, L: Deref + Sync + Send, P: Deref + Sync + Send> Watch<ChannelSigner> for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
[src]
C::Target: Filter,
T::Target: BroadcasterInterface,
F::Target: FeeEstimator,
L::Target: Logger,
P::Target: Persist<ChannelSigner>,
fn watch_channel(
&self,
funding_outpoint: OutPoint,
monitor: ChannelMonitor<ChannelSigner>
) -> Result<(), ChannelMonitorUpdateErr>
[src]
&self,
funding_outpoint: OutPoint,
monitor: ChannelMonitor<ChannelSigner>
) -> Result<(), ChannelMonitorUpdateErr>
Adds the monitor that watches the channel referred to by the given outpoint.
Calls back to chain::Filter
with the funding transaction and outputs to watch.
Note that we persist the given ChannelMonitor
while holding the ChainMonitor
monitors lock.
fn update_channel(
&self,
funding_txo: OutPoint,
update: ChannelMonitorUpdate
) -> Result<(), ChannelMonitorUpdateErr>
[src]
&self,
funding_txo: OutPoint,
update: ChannelMonitorUpdate
) -> Result<(), ChannelMonitorUpdateErr>
Note that we persist the given ChannelMonitor
update while holding the
ChainMonitor
monitors lock.
fn release_pending_monitor_events(&self) -> Vec<MonitorEvent>
[src]
Auto Trait Implementations
impl<ChannelSigner, C, T, F, L, P> RefUnwindSafe for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C: RefUnwindSafe,
F: RefUnwindSafe,
L: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
C: RefUnwindSafe,
F: RefUnwindSafe,
L: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<ChannelSigner, C, T, F, L, P> Send for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C: Send,
F: Send,
L: Send,
P: Send,
T: Send,
C: Send,
F: Send,
L: Send,
P: Send,
T: Send,
impl<ChannelSigner, C, T, F, L, P> Sync for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C: Sync,
F: Sync,
L: Sync,
P: Sync,
T: Sync,
C: Sync,
F: Sync,
L: Sync,
P: Sync,
T: Sync,
impl<ChannelSigner, C, T, F, L, P> Unpin for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C: Unpin,
ChannelSigner: Unpin,
F: Unpin,
L: Unpin,
P: Unpin,
T: Unpin,
C: Unpin,
ChannelSigner: Unpin,
F: Unpin,
L: Unpin,
P: Unpin,
T: Unpin,
impl<ChannelSigner, C, T, F, L, P> UnwindSafe for ChainMonitor<ChannelSigner, C, T, F, L, P> where
C: UnwindSafe,
F: UnwindSafe,
L: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
C: UnwindSafe,
F: UnwindSafe,
L: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,