[][src]Trait lightning::ln::channelmonitor::ManyChannelMonitor

pub trait ManyChannelMonitor: Send + Sync {
    fn add_update_monitor(
        &self,
        funding_txo: OutPoint,
        monitor: ChannelMonitor
    ) -> Result<(), ChannelMonitorUpdateErr>;
fn fetch_pending_htlc_updated(&self) -> Vec<HTLCUpdate>; }

Simple trait indicating ability to track a set of ChannelMonitors and multiplex events between them. Generally should be implemented by keeping a local SimpleManyChannelMonitor and passing events to it, while also taking any add_update_monitor events and passing them to some remote server(s).

Note that any updates to a channel's monitor must be applied to each instance of the channel's monitor everywhere (including remote watchtowers) before this function returns. If an update occurs and a remote watchtower is left with old state, it may broadcast transactions which we have revoked, allowing our counterparty to claim all funds in the channel!

User needs to notify implementors of ManyChannelMonitor when a new block is connected or disconnected using their block_connected and block_disconnected methods. However, rather than calling these methods directly, the user should register implementors as listeners to the BlockNotifier and call the BlockNotifier's block_(dis)connected methods, which will notify all registered listeners in one go.

Required methods

fn add_update_monitor(
    &self,
    funding_txo: OutPoint,
    monitor: ChannelMonitor
) -> Result<(), ChannelMonitorUpdateErr>

Adds or updates a monitor for the given funding_txo.

Implementor must also ensure that the funding_txo outpoint is registered with any relevant ChainWatchInterfaces such that the provided monitor receives block_connected callbacks with any spends of it.

fn fetch_pending_htlc_updated(&self) -> Vec<HTLCUpdate>

Used by ChannelManager to get list of HTLC resolved onchain and which needed to be updated with success or failure backward

Loading content...

Implementors

impl ManyChannelMonitor for SimpleManyChannelMonitor<OutPoint>[src]

Loading content...