Merge pull request #117 from TheBlueMatt/2022-08-fix-npe
[ldk-java] / src / main / java / org / ldk / structs / ClosureReason.java
index ad198c32f0e626e5cd6b4ddf67d4d2678080bef6..800deb56e6b5b59bb7a9b15a8994064ee5c4b9a5 100644 (file)
@@ -62,7 +62,7 @@ public class ClosureReason extends CommonBase {
                 * or printed to stdout). Otherwise, a well crafted error message may exploit
                 * a security vulnerability in the terminal emulator or the logging subsystem.
                */
-               public final String peer_msg;
+               public final java.lang.String peer_msg;
                private CounterpartyForceClosed(long ptr, bindings.LDKClosureReason.CounterpartyForceClosed obj) {
                        super(null, ptr);
                        this.peer_msg = obj.peer_msg;
@@ -112,18 +112,18 @@ public class ClosureReason extends CommonBase {
                /**
                 * A developer-readable error message which we generated.
                */
-               public final String err;
+               public final java.lang.String err;
                private ProcessingError(long ptr, bindings.LDKClosureReason.ProcessingError obj) {
                        super(null, ptr);
                        this.err = obj.err;
                }
        }
        /**
-        * The `PeerManager` informed us that we've disconnected from the peer. We close channels
-        * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
-        * peer again in the future or if the peer disconnected before we finished negotiating
-        * the channel open. The first case may be caused by incompatible features which our
-        * counterparty, or we, require.
+        * The peer disconnected prior to funding completing. In this case the spec mandates that we
+        * forget the channel entirely - we can attempt again if the peer reconnects.
+        * 
+        * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
+        * peer because of mutual incompatibility between us and our channel counterparty.
         */
        public final static class DisconnectedPeer extends ClosureReason {
                private DisconnectedPeer(long ptr, bindings.LDKClosureReason.DisconnectedPeer obj) {
@@ -152,8 +152,8 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_clone(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -164,8 +164,8 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_counterparty_force_closed(peer_msg);
                Reference.reachabilityFence(peer_msg);
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -175,8 +175,8 @@ public class ClosureReason extends CommonBase {
        public static ClosureReason holder_force_closed() {
                long ret = bindings.ClosureReason_holder_force_closed();
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -186,8 +186,8 @@ public class ClosureReason extends CommonBase {
        public static ClosureReason cooperative_closure() {
                long ret = bindings.ClosureReason_cooperative_closure();
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -197,8 +197,8 @@ public class ClosureReason extends CommonBase {
        public static ClosureReason commitment_tx_confirmed() {
                long ret = bindings.ClosureReason_commitment_tx_confirmed();
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -208,8 +208,8 @@ public class ClosureReason extends CommonBase {
        public static ClosureReason funding_timed_out() {
                long ret = bindings.ClosureReason_funding_timed_out();
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -220,8 +220,8 @@ public class ClosureReason extends CommonBase {
                long ret = bindings.ClosureReason_processing_error(err);
                Reference.reachabilityFence(err);
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -231,8 +231,8 @@ public class ClosureReason extends CommonBase {
        public static ClosureReason disconnected_peer() {
                long ret = bindings.ClosureReason_disconnected_peer();
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -242,8 +242,8 @@ public class ClosureReason extends CommonBase {
        public static ClosureReason outdated_channel_manager() {
                long ret = bindings.ClosureReason_outdated_channel_manager();
                if (ret >= 0 && ret <= 4096) { return null; }
-               ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }