import org.ldk.enums.*;
import org.ldk.util.*;
import java.util.Arrays;
+import java.lang.ref.Reference;
+import javax.annotation.Nullable;
/**
if (ptr != 0) { bindings.BestBlock_free(ptr); }
}
+ long clone_ptr() {
+ long ret = bindings.BestBlock_clone_ptr(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
/**
* Creates a copy of the BestBlock
*/
public BestBlock clone() {
long ret = bindings.BestBlock_clone(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;
}
/**
- * Returns the best block from the genesis of the given network.
+ * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
+ * network.
*/
- public static BestBlock constructor_from_genesis(LDKNetwork network) {
+ public static BestBlock from_genesis(org.ldk.enums.Network network) {
long ret = bindings.BestBlock_from_genesis(network);
- BestBlock ret_hu_conv = new BestBlock(null, ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ Reference.reachabilityFence(network);
+ 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(ret_hu_conv); };
return ret_hu_conv;
}
/**
- * Returns the best block as identified by the given block hash and height.
+ * Returns a `BestBlock` as identified by the given block hash and height.
*/
- public static BestBlock constructor_new(byte[] block_hash, int height) {
- long ret = bindings.BestBlock_new(block_hash, height);
- BestBlock ret_hu_conv = new BestBlock(null, ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ public static BestBlock of(byte[] block_hash, int height) {
+ long ret = bindings.BestBlock_new(InternalUtils.check_arr_len(block_hash, 32), height);
+ Reference.reachabilityFence(block_hash);
+ Reference.reachabilityFence(height);
+ 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(ret_hu_conv); };
return ret_hu_conv;
}
*/
public byte[] block_hash() {
byte[] ret = bindings.BestBlock_block_hash(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}
*/
public int height() {
int ret = bindings.BestBlock_height(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}