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

pub trait ChainWatchInterface: Sync + Send {
    fn install_watch_tx(&self, txid: &Sha256dHash, script_pub_key: &Script);
fn install_watch_outpoint(
        &self,
        outpoint: (Sha256dHash, u32),
        out_script: &Script
    );
fn watch_all_txn(&self);
fn register_listener(&self, listener: Weak<dyn ChainListener>);
fn get_chain_utxo(
        &self,
        genesis_hash: Sha256dHash,
        unspent_tx_output_identifier: u64
    ) -> Result<(Script, u64), ChainError>; }

An interface to request notification of certain scripts as they appear the chain.

Note that all of the functions implemented here must be reentrant-safe (obviously - they're called from inside the library in response to ChainListener events, P2P events, or timer events).

Required methods

fn install_watch_tx(&self, txid: &Sha256dHash, script_pub_key: &Script)

Provides a txid/random-scriptPubKey-in-the-tx which much be watched for.

fn install_watch_outpoint(
    &self,
    outpoint: (Sha256dHash, u32),
    out_script: &Script
)

Provides an outpoint which must be watched for, providing any transactions which spend the given outpoint.

fn watch_all_txn(&self)

Indicates that a listener needs to see all transactions.

fn register_listener(&self, listener: Weak<dyn ChainListener>)

Register the given listener to receive events. Only a weak pointer is provided and the registration should be freed once that pointer expires.

fn get_chain_utxo(
    &self,
    genesis_hash: Sha256dHash,
    unspent_tx_output_identifier: u64
) -> Result<(Script, u64), ChainError>

Gets the script and value in satoshis for a given unspent transaction output given a short_channel_id (aka unspent_tx_output_identier). For BTC/tBTC channels the top three bytes are the block height, the next 3 the transaction index within the block, and the final two the output within the transaction.

Loading content...

Implementors

impl ChainWatchInterface for ChainWatchInterfaceUtil
[src]

Register listener

Loading content...