]> git.bitcoin.ninja Git - ldk-java/blobdiff - src/main/java/org/ldk/structs/Filter.java
Update CI references to LDK 0.0.124 drop stale memchr pins
[ldk-java] / src / main / java / org / ldk / structs / Filter.java
index f35fa9dc825627989dc30e73beee9d2c7af5eda0..f02adbea0b6c88b9b9ddbbd069c0a4a3a81c8819 100644 (file)
@@ -42,11 +42,28 @@ public class Filter extends CommonBase {
        protected void finalize() throws Throwable {
                if (ptr != 0) { bindings.Filter_free(ptr); } super.finalize();
        }
-
+       /**
+        * 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.
+        */
+       public void destroy() {
+               if (ptr != 0) { bindings.Filter_free(ptr); }
+               ptr = 0;
+       }
        public static interface FilterInterface {
                /**
                 * 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.
                 */
                void register_tx(byte[] txid, byte[] script_pubkey);
                /**
@@ -56,6 +73,9 @@ public class Filter extends CommonBase {
                 * 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).
                 */
                void register_output(WatchedOutput output);
        }
@@ -79,6 +99,11 @@ public class Filter extends CommonBase {
        /**
         * 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.
         */
        public void register_tx(byte[] txid, byte[] script_pubkey) {
                bindings.Filter_register_tx(this.ptr, InternalUtils.check_arr_len(txid, 32), script_pubkey);
@@ -94,12 +119,14 @@ public class Filter extends CommonBase {
         * 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).
         */
        public void register_output(org.ldk.structs.WatchedOutput output) {
-               bindings.Filter_register_output(this.ptr, output == null ? 0 : output.ptr);
+               bindings.Filter_register_output(this.ptr, output.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(output);
-               if (this != null) { this.ptrs_to.add(output); };
        }
 
 }