Update java bindings with new generator and new upstream code
[ldk-java] / src / main / java / org / ldk / structs / Filter.java
index 648823106a4e607e1f169366b3259b9ed73fea89..092c65614100a5045588eb204eac935026cba488 100644 (file)
@@ -5,6 +5,29 @@ import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
 
+/**
+ * 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 [`TemporaryFailure`].
+ * 
+ * [`Watch`]: trait.Watch.html
+ * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure
+ * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
+ * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
+ */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class Filter extends CommonBase {
        final bindings.LDKFilter bindings_instance;
@@ -20,7 +43,15 @@ public class Filter extends CommonBase {
        }
 
        public static interface FilterInterface {
+               /**
+                * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
+                * a spending condition.
+                */
                void register_tx(byte[] txid, byte[] script_pubkey);
+               /**
+                * Registers interest in spends of a transaction output identified by `outpoint` having
+                * `script_pubkey` as the spending condition.
+                */
                void register_output(OutPoint outpoint, byte[] script_pubkey);
        }
        private static class LDKFilterHolder { Filter held; }
@@ -37,10 +68,18 @@ public class Filter extends CommonBase {
                });
                return impl_holder.held;
        }
+       /**
+        * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
+        * a spending condition.
+        */
        public void register_tx(byte[] txid, byte[] script_pubkey) {
                bindings.Filter_register_tx(this.ptr, txid, script_pubkey);
        }
 
+       /**
+        * Registers interest in spends of a transaction output identified by `outpoint` having
+        * `script_pubkey` as the spending condition.
+        */
        public void register_output(OutPoint outpoint, byte[] script_pubkey) {
                bindings.Filter_register_output(this.ptr, outpoint == null ? 0 : outpoint.ptr & ~1, script_pubkey);
                this.ptrs_to.add(outpoint);