[−][src]Trait lightning::chain::chaininterface::ChainWatchInterface
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
)
&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 get_chain_utxo(
&self,
genesis_hash: Sha256dHash,
unspent_tx_output_identifier: u64
) -> Result<(Script, u64), ChainError>
&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.
fn filter_block<'a>(&self, block: &'a Block) -> (Vec<&'a Transaction>, Vec<u32>)
Gets the list of transactions and transaction indices that the ChainWatchInterface is watching for.
fn reentered(&self) -> usize
Returns a usize that changes when the ChainWatchInterface's watched data is modified.
Users of filter_block
should pre-save a copy of reentered
's return value and use it to
determine whether they need to re-filter a given block.
Implementors
impl ChainWatchInterface for ChainWatchInterfaceUtil
[src]
Register listener
fn install_watch_tx(&self, txid: &Sha256dHash, script_pub_key: &Script)
[src]
fn install_watch_outpoint(
&self,
outpoint: (Sha256dHash, u32),
out_script: &Script
)
[src]
&self,
outpoint: (Sha256dHash, u32),
out_script: &Script
)
fn watch_all_txn(&self)
[src]
fn get_chain_utxo(
&self,
genesis_hash: Sha256dHash,
_unspent_tx_output_identifier: u64
) -> Result<(Script, u64), ChainError>
[src]
&self,
genesis_hash: Sha256dHash,
_unspent_tx_output_identifier: u64
) -> Result<(Script, u64), ChainError>