[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / MonitorEvent.java
index 46311a927ddcf323b5bee4edcd32539d5d20b981..dec1118f8ca22ea937e9ba3a2b275f462ad1c52b 100644 (file)
@@ -27,8 +27,8 @@ public class MonitorEvent extends CommonBase {
                if (raw_val.getClass() == bindings.LDKMonitorEvent.CommitmentTxConfirmed.class) {
                        return new CommitmentTxConfirmed(ptr, (bindings.LDKMonitorEvent.CommitmentTxConfirmed)raw_val);
                }
-               if (raw_val.getClass() == bindings.LDKMonitorEvent.UpdateCompleted.class) {
-                       return new UpdateCompleted(ptr, (bindings.LDKMonitorEvent.UpdateCompleted)raw_val);
+               if (raw_val.getClass() == bindings.LDKMonitorEvent.Completed.class) {
+                       return new Completed(ptr, (bindings.LDKMonitorEvent.Completed)raw_val);
                }
                if (raw_val.getClass() == bindings.LDKMonitorEvent.UpdateFailed.class) {
                        return new UpdateFailed(ptr, (bindings.LDKMonitorEvent.UpdateFailed)raw_val);
@@ -45,7 +45,7 @@ public class MonitorEvent extends CommonBase {
                        super(null, ptr);
                        long htlc_event = obj.htlc_event;
                        org.ldk.structs.HTLCUpdate htlc_event_hu_conv = null; if (htlc_event < 0 || htlc_event > 4096) { htlc_event_hu_conv = new org.ldk.structs.HTLCUpdate(null, htlc_event); }
-                       htlc_event_hu_conv.ptrs_to.add(this);
+                       if (htlc_event_hu_conv != null) { htlc_event_hu_conv.ptrs_to.add(this); };
                        this.htlc_event = htlc_event_hu_conv;
                }
        }
@@ -58,17 +58,17 @@ public class MonitorEvent extends CommonBase {
                        super(null, ptr);
                        long commitment_tx_confirmed = obj.commitment_tx_confirmed;
                        org.ldk.structs.OutPoint commitment_tx_confirmed_hu_conv = null; if (commitment_tx_confirmed < 0 || commitment_tx_confirmed > 4096) { commitment_tx_confirmed_hu_conv = new org.ldk.structs.OutPoint(null, commitment_tx_confirmed); }
-                       commitment_tx_confirmed_hu_conv.ptrs_to.add(this);
+                       if (commitment_tx_confirmed_hu_conv != null) { commitment_tx_confirmed_hu_conv.ptrs_to.add(this); };
                        this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv;
                }
        }
        /**
         * Indicates a [`ChannelMonitor`] update has completed. See
-        * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
+        * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
         * 
-        * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
+        * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
         */
-       public final static class UpdateCompleted extends MonitorEvent {
+       public final static class Completed extends MonitorEvent {
                /**
                 * The funding outpoint of the [`ChannelMonitor`] that was updated
                */
@@ -81,20 +81,20 @@ public class MonitorEvent extends CommonBase {
                 * same [`ChannelMonitor`] have been applied and persisted.
                */
                public final long monitor_update_id;
-               private UpdateCompleted(long ptr, bindings.LDKMonitorEvent.UpdateCompleted obj) {
+               private Completed(long ptr, bindings.LDKMonitorEvent.Completed obj) {
                        super(null, ptr);
                        long funding_txo = obj.funding_txo;
                        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); }
-                       funding_txo_hu_conv.ptrs_to.add(this);
+                       if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
                        this.funding_txo = funding_txo_hu_conv;
                        this.monitor_update_id = obj.monitor_update_id;
                }
        }
        /**
         * Indicates a [`ChannelMonitor`] update has failed. See
-        * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
+        * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
         * 
-        * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
+        * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
         */
        public final static class UpdateFailed extends MonitorEvent {
                public final org.ldk.structs.OutPoint update_failed;
@@ -102,7 +102,7 @@ public class MonitorEvent extends CommonBase {
                        super(null, ptr);
                        long update_failed = obj.update_failed;
                        org.ldk.structs.OutPoint update_failed_hu_conv = null; if (update_failed < 0 || update_failed > 4096) { update_failed_hu_conv = new org.ldk.structs.OutPoint(null, update_failed); }
-                       update_failed_hu_conv.ptrs_to.add(this);
+                       if (update_failed_hu_conv != null) { update_failed_hu_conv.ptrs_to.add(this); };
                        this.update_failed = update_failed_hu_conv;
                }
        }
@@ -120,7 +120,7 @@ public class MonitorEvent extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -128,11 +128,12 @@ public class MonitorEvent extends CommonBase {
         * Utility method to constructs a new HTLCEvent-variant MonitorEvent
         */
        public static MonitorEvent htlcevent(HTLCUpdate a) {
-               long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr & ~1);
+               long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
                return ret_hu_conv;
        }
 
@@ -140,24 +141,26 @@ public class MonitorEvent extends CommonBase {
         * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
         */
        public static MonitorEvent commitment_tx_confirmed(OutPoint a) {
-               long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1);
+               long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
                return ret_hu_conv;
        }
 
        /**
-        * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
+        * Utility method to constructs a new Completed-variant MonitorEvent
         */
-       public static MonitorEvent update_completed(OutPoint funding_txo, long monitor_update_id) {
-               long ret = bindings.MonitorEvent_update_completed(funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor_update_id);
+       public static MonitorEvent completed(OutPoint funding_txo, long monitor_update_id) {
+               long ret = bindings.MonitorEvent_completed(funding_txo == null ? 0 : funding_txo.ptr, monitor_update_id);
                Reference.reachabilityFence(funding_txo);
                Reference.reachabilityFence(monitor_update_id);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
                return ret_hu_conv;
        }
 
@@ -165,14 +168,30 @@ public class MonitorEvent extends CommonBase {
         * Utility method to constructs a new UpdateFailed-variant MonitorEvent
         */
        public static MonitorEvent update_failed(OutPoint a) {
-               long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1);
+               long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
                return ret_hu_conv;
        }
 
+       /**
+        * Checks if two MonitorEvents contain equal inner contents.
+        * This ignores pointers and is_owned flags and looks at the values in fields.
+        */
+       public boolean eq(MonitorEvent b) {
+               boolean ret = bindings.MonitorEvent_eq(this.ptr, b == null ? 0 : b.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(b);
+               return ret;
+       }
+
+       @Override public boolean equals(Object o) {
+               if (!(o instanceof MonitorEvent)) return false;
+               return this.eq((MonitorEvent)o);
+       }
        /**
         * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
         */