pub struct ChainMonitor {
pub funding_outpoint: OutPoint,
pub state: Arc<Mutex<State>>,
/* private fields */
}
Expand description
Keep track of channel on-chain events. Note that this object has refcounted state, so is lightweight to clone.
Fields§
§funding_outpoint: OutPoint
the first funding outpoint, used to identify the channel / channel monitor
state: Arc<Mutex<State>>
the monitor state
Implementations§
Source§impl ChainMonitor
impl ChainMonitor
Sourcepub fn as_base(&self) -> ChainMonitorBase
pub fn as_base(&self) -> ChainMonitorBase
Get the base
Sourcepub fn get_state(&self) -> MutexGuard<'_, State>
pub fn get_state(&self) -> MutexGuard<'_, State>
Get the locked state
Sourcepub fn add_funding(&self, tx: &Transaction, vout: u32)
pub fn add_funding(&self, tx: &Transaction, vout: u32)
Add a funding transaction to keep track of For dual-funding
Sourcepub fn funding_depth(&self) -> u32
pub fn funding_depth(&self) -> u32
Returns the number of confirmations of the funding transaction, or zero if it wasn’t confirmed yet.
Sourcepub fn funding_double_spent_depth(&self) -> u32
pub fn funding_double_spent_depth(&self) -> u32
Returns the number of confirmations of a double-spend of the funding transaction or zero if it wasn’t double-spent.
Sourcepub fn closing_depth(&self) -> u32
pub fn closing_depth(&self) -> u32
Returns the number of confirmations of the closing transaction, or zero
Trait Implementations§
Source§impl ChainListener for ChainMonitor
impl ChainListener for ChainMonitor
Source§fn on_add_block(
&self,
txs: &[Transaction],
block_hash: &BlockHash,
) -> (Vec<OutPoint>, Vec<OutPoint>)
fn on_add_block( &self, txs: &[Transaction], block_hash: &BlockHash, ) -> (Vec<OutPoint>, Vec<OutPoint>)
A block was added via a compact proof.
The listener returns outpoints to watch in the future, and outpoints to stop watching.
Source§fn on_add_streamed_block_end(
&self,
block_hash: &BlockHash,
) -> (Vec<OutPoint>, Vec<OutPoint>)
fn on_add_streamed_block_end( &self, block_hash: &BlockHash, ) -> (Vec<OutPoint>, Vec<OutPoint>)
A block was added via streaming (see
on_block_chunk
).
The listener returns outpoints to watch in the future, and outpoints to stop watching.
The decoded block hash is also returned.Source§fn on_remove_block(
&self,
txs: &[Transaction],
block_hash: &BlockHash,
) -> (Vec<OutPoint>, Vec<OutPoint>)
fn on_remove_block( &self, txs: &[Transaction], block_hash: &BlockHash, ) -> (Vec<OutPoint>, Vec<OutPoint>)
A block was deleted via a compact proof.
The listener returns the same thing as on_add_block, so that the changes can be reverted.
The decoded block hash is also returned.
Source§impl Clone for ChainMonitor
impl Clone for ChainMonitor
Source§fn clone(&self) -> ChainMonitor
fn clone(&self) -> ChainMonitor
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl SendSync for ChainMonitor
Auto Trait Implementations§
impl Freeze for ChainMonitor
impl !RefUnwindSafe for ChainMonitor
impl Send for ChainMonitor
impl Sync for ChainMonitor
impl Unpin for ChainMonitor
impl !UnwindSafe for ChainMonitor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more