Merge pull request #126 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / Watch.java
index dd0311111f223041ebedc62846a12c1c3bc36009..87ae3274ca67b5679e44c88d60704cea10a3d93b 100644 (file)
@@ -41,7 +41,19 @@ public class Watch extends CommonBase {
        protected void finalize() throws Throwable {
                if (ptr != 0) { bindings.Watch_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.Watch_free(ptr); }
+               ptr = 0;
+       }
        public static interface WatchInterface {
                /**
                 * Watches a channel identified by `funding_txo` using `monitor`.
@@ -97,7 +109,6 @@ public class Watch extends CommonBase {
                                org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); }
                                if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
                                org.ldk.structs.ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new org.ldk.structs.ChannelMonitorUpdate(null, update); }
-                               if (update_hu_conv != null) { update_hu_conv.ptrs_to.add(this); };
                                ChannelMonitorUpdateStatus ret = arg.update_channel(funding_txo_hu_conv, update_hu_conv);
                                Reference.reachabilityFence(arg);
                                return ret;
@@ -125,7 +136,7 @@ public class Watch extends CommonBase {
         * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
         * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
         */
-       public ChannelMonitorUpdateStatus watch_channel(OutPoint funding_txo, ChannelMonitor monitor) {
+       public ChannelMonitorUpdateStatus watch_channel(org.ldk.structs.OutPoint funding_txo, org.ldk.structs.ChannelMonitor monitor) {
                ChannelMonitorUpdateStatus ret = bindings.Watch_watch_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr, monitor == null ? 0 : monitor.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(funding_txo);
@@ -143,7 +154,7 @@ public class Watch extends CommonBase {
         * 
         * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
         */
-       public ChannelMonitorUpdateStatus update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) {
+       public ChannelMonitorUpdateStatus update_channel(org.ldk.structs.OutPoint funding_txo, org.ldk.structs.ChannelMonitorUpdate update) {
                ChannelMonitorUpdateStatus ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr, update == null ? 0 : update.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(funding_txo);