Skip to content

Provide more color in filter registration methods #3036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lightning/src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ pub trait Watch<ChannelSigner: WriteableEcdsaChannelSigner> {
pub trait Filter {
/// Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
/// a spending condition.
///
/// This may be used, for example, to monitor for when a funding transaction confirms.
///
/// The `script_pubkey` is provided for informational purposes and may be useful for block
/// sources which only support filtering on scripts.
fn register_tx(&self, txid: &Txid, script_pubkey: &Script);

/// Registers interest in spends of a transaction output.
Expand All @@ -335,6 +340,9 @@ pub trait Filter {
/// to ensure that also dependent output spents within an already connected block are correctly
/// handled, e.g., by re-scanning the block in question whenever new outputs have been
/// registered mid-processing.
///
/// This may be used, for example, to monitor for when a funding output is spent (by any
/// transaction).
fn register_output(&self, output: WatchedOutput);
}

Expand All @@ -347,6 +355,9 @@ pub trait Filter {
/// If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
/// may have been spent there. See [`Filter::register_output`] for details.
///
/// Depending on your block source, you may need one or both of either [`Self::outpoint`] or
/// [`Self::script_pubkey`].
///
/// [`ChannelMonitor`]: channelmonitor::ChannelMonitor
/// [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
#[derive(Clone, PartialEq, Eq, Hash)]
Expand Down
Loading