[][src]Trait lightning::chain::chaininterface::ChainListener

pub trait ChainListener: Sync + Send {
    fn block_connected(
        &self,
        header: &BlockHeader,
        height: u32,
        txn_matched: &[&Transaction],
        indexes_of_txn_matched: &[u32]
    );
fn block_disconnected(&self, header: &BlockHeader, disconnected_height: u32); }

A trait indicating a desire to listen for events from the chain

Required methods

fn block_connected(
    &self,
    header: &BlockHeader,
    height: u32,
    txn_matched: &[&Transaction],
    indexes_of_txn_matched: &[u32]
)

Notifies a listener that a block was connected. Note that if a new transaction/outpoint is watched during a block_connected call, the block must be re-scanned with the new transaction/outpoints and block_connected should be called again with the same header and (at least) the new transactions.

Note that if non-new transaction/outpoints may be registered during a call, a second call must not happen.

This also means those counting confirmations using block_connected callbacks should watch for duplicate headers and not count them towards confirmations!

fn block_disconnected(&self, header: &BlockHeader, disconnected_height: u32)

Notifies a listener that a block was disconnected. Unlike block_connected, this must never be called twice for the same disconnect event. Height must be the one of the block which was disconnected (not new height of the best chain)

Loading content...

Implementors

impl<'a> ChainListener for ChannelManager<'a>[src]

fn block_disconnected(&self, header: &BlockHeader, _: u32)[src]

We force-close the channel without letting our counterparty participate in the shutdown

impl<'a, Key: Send + Eq + Hash> ChainListener for SimpleManyChannelMonitor<Key>[src]

Loading content...