Merge pull request #49 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / ChainParameters.java
index c65be86d10fe3f6391f43bce896abb19885ddffa..48f54722ae88aab10ab72eac28ed3825a88ad578 100644 (file)
@@ -45,7 +45,7 @@ public class ChainParameters extends CommonBase {
         */
        public BestBlock get_best_block() {
                long ret = bindings.ChainParameters_get_best_block(this.ptr);
-               if (ret < 1024) { return null; }
+               if (ret >= 0 && ret < 1024) { return null; }
                BestBlock ret_hu_conv = new BestBlock(null, ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
@@ -58,7 +58,6 @@ public class ChainParameters extends CommonBase {
         */
        public void set_best_block(BestBlock val) {
                bindings.ChainParameters_set_best_block(this.ptr, val == null ? 0 : val.ptr & ~1);
-               this.ptrs_to.add(val);
        }
 
        /**
@@ -66,10 +65,9 @@ public class ChainParameters extends CommonBase {
         */
        public static ChainParameters of(org.ldk.enums.Network network_arg, BestBlock best_block_arg) {
                long ret = bindings.ChainParameters_new(network_arg, best_block_arg == null ? 0 : best_block_arg.ptr & ~1);
-               if (ret < 1024) { return null; }
+               if (ret >= 0 && ret < 1024) { return null; }
                ChainParameters ret_hu_conv = new ChainParameters(null, ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(best_block_arg);
                return ret_hu_conv;
        }
 
@@ -78,7 +76,7 @@ public class ChainParameters extends CommonBase {
         */
        public ChainParameters clone() {
                long ret = bindings.ChainParameters_clone(this.ptr);
-               if (ret < 1024) { return null; }
+               if (ret >= 0 && ret < 1024) { return null; }
                ChainParameters ret_hu_conv = new ChainParameters(null, ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;