import org.ldk.enums.*;
import org.ldk.util.*;
import java.util.Arrays;
+import java.lang.ref.Reference;
+import javax.annotation.Nullable;
/**
*/
public Network get_network() {
Network ret = bindings.ChainParameters_get_network(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}
/**
* The network for determining the `chain_hash` in Lightning messages.
*/
- public void set_network(Network val) {
+ public void set_network(org.ldk.enums.Network val) {
bindings.ChainParameters_set_network(this.ptr, val);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(val);
}
/**
*/
public BestBlock get_best_block() {
long ret = bindings.ChainParameters_get_best_block(this.ptr);
- BestBlock ret_hu_conv = new BestBlock(null, ret);
- ret_hu_conv.ptrs_to.add(this);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
return ret_hu_conv;
}
* Used to track on-chain channel funding outputs and send payments with reliable timelocks.
*/
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);
+ bindings.ChainParameters_set_best_block(this.ptr, val == null ? 0 : val.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(val);
+ if (this != null) { this.ptrs_to.add(val); };
}
/**
* Constructs a new ChainParameters given each field
*/
- public static ChainParameters of(Network network_arg, BestBlock best_block_arg) {
- long ret = bindings.ChainParameters_new(network_arg, best_block_arg == null ? 0 : best_block_arg.ptr & ~1);
- 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);
+ 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);
+ Reference.reachabilityFence(network_arg);
+ Reference.reachabilityFence(best_block_arg);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
+ 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(best_block_arg); };
return ret_hu_conv;
}
+ long clone_ptr() {
+ long ret = bindings.ChainParameters_clone_ptr(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
/**
* Creates a copy of the ChainParameters
*/
public ChainParameters clone() {
long ret = bindings.ChainParameters_clone(this.ptr);
- ChainParameters ret_hu_conv = new ChainParameters(null, ret);
- ret_hu_conv.ptrs_to.add(this);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChainParameters(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
return ret_hu_conv;
}