[][src]Struct lightning::ln::channelmonitor::ChannelMonitor

pub struct ChannelMonitor { /* fields omitted */ }

A ChannelMonitor handles chain events (blocks connected and disconnected) and generates on-chain transactions to ensure no loss of funds occurs.

You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date information and are actively monitoring the chain.

Methods

impl ChannelMonitor
[src]

pub fn insert_combine(
    &mut self,
    other: ChannelMonitor
) -> Result<(), MonitorUpdateError>
[src]

Combines this ChannelMonitor with the information contained in the other ChannelMonitor. After a successful call this ChannelMonitor is up-to-date and is safe to use to monitor the chain for new blocks/transactions.

pub fn get_funding_txo(&self) -> Option<OutPoint>
[src]

Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.

pub fn get_monitored_outpoints(&self) -> Vec<(Sha256dHash, u32, &Script)>
[src]

Gets the sets of all outpoints which this ChannelMonitor expects to hear about spends of. Generally useful when deserializing as during normal operation the return values of block_connected are sufficient to ensure all relevant outpoints are being monitored (note that the get_funding_txo outpoint and transaction must also be monitored for!).

pub fn write_for_disk<W: Writer>(&self, writer: &mut W) -> Result<(), Error>
[src]

Writes this monitor into the given writer, suitable for writing to disk.

Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along the "reorg path" (ie not just starting at the same height but starting at the highest common block that appears on your best chain as well as on the chain which contains the last block hash returned) upon deserializing the object!

pub fn write_for_watchtower<W: Writer>(
    &self,
    writer: &mut W
) -> Result<(), Error>
[src]

Encodes this monitor into the given writer, suitable for sending to a remote watchtower

Note that the deserializer is only implemented for (Sha256dHash, ChannelMonitor), which tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along the "reorg path" (ie not just starting at the same height but starting at the highest common block that appears on your best chain as well as on the chain which contains the last block hash returned) upon deserializing the object!

Trait Implementations

impl Clone for ChannelMonitor
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]