Package org.ldk.structs
Class Filter
- java.lang.Object
-
- org.ldk.structs.Filter
-
public class Filter extends Object
The `Filter` trait defines behavior for indicating chain activity of interest pertaining to channels. This is useful in order to have a [`Watch`] implementation convey to a chain source which transactions to be notified of. Notification may take the form of pre-filtering blocks or, in the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If receiving full blocks from a chain source, any further filtering is unnecessary. After an output has been registered, subsequent block retrievals from the chain source must not exclude any transactions matching the new criteria nor any in-block descendants of such transactions. Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter` should not block on I/O. Implementations should instead queue the newly monitored data to be processed later. Then, in order to block until the data has been processed, any [`Watch`] invocation that has called the `Filter` must return [`InProgress`]. [`InProgress`]: ChannelMonitorUpdateStatus::InProgress [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Filter.FilterInterface
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys the object, freeing associated resources.protected void
finalize()
static Filter
new_impl(Filter.FilterInterface arg)
void
register_output(WatchedOutput output)
Registers interest in spends of a transaction output.void
register_tx(byte[] txid, byte[] script_pubkey)
Registers interest in a transaction with `txid` and having an output with `script_pubkey` as a spending condition.
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
destroy
public void destroy()
Destroys the object, freeing associated resources. After this call, any access to this object may result in a SEGFAULT or worse. You should generally NEVER call this method. You should let the garbage collector do this for you when it finalizes objects. However, it may be useful for types which represent locks and should be closed immediately to avoid holding locks until the GC runs.
-
new_impl
public static Filter new_impl(Filter.FilterInterface arg)
-
register_tx
public void register_tx(byte[] txid, byte[] script_pubkey)
Registers interest in a transaction with `txid` and having an output with `script_pubkey` as a spending condition.
-
register_output
public void register_output(WatchedOutput output)
Registers interest in spends of a transaction output. Note that this method might be called during processing of a new block. You therefore need 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.
-
-