X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FBestBlock.java;h=a595ed02f62723c4b0c33d1fde8a3c4fd300b7a9;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=9377da15b41062394d6870f6c23a4d4ee9e5e86c;hpb=e6173a79ce766cef7a660f22fc8fd1220975f6ea;p=ldk-java diff --git a/src/main/java/org/ldk/structs/BestBlock.java b/src/main/java/org/ldk/structs/BestBlock.java index 9377da15..a595ed02 100644 --- a/src/main/java/org/ldk/structs/BestBlock.java +++ b/src/main/java/org/ldk/structs/BestBlock.java @@ -19,13 +19,18 @@ public class BestBlock extends CommonBase { if (ptr != 0) { bindings.BestBlock_free(ptr); } } + long clone_ptr() { + long ret = bindings.BestBlock_clone_ptr(this.ptr); + return ret; + } + /** * Creates a copy of the BestBlock */ public BestBlock clone() { long ret = bindings.BestBlock_clone(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - BestBlock ret_hu_conv = new BestBlock(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -36,8 +41,8 @@ public class BestBlock extends CommonBase { */ public static BestBlock from_genesis(org.ldk.enums.Network network) { long ret = bindings.BestBlock_from_genesis(network); - if (ret >= 0 && ret < 1024) { return null; } - BestBlock ret_hu_conv = new BestBlock(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -46,9 +51,9 @@ public class BestBlock extends CommonBase { * Returns a `BestBlock` as identified by the given block hash and height. */ public static BestBlock of(byte[] block_hash, int height) { - long ret = bindings.BestBlock_new(block_hash, height); - if (ret >= 0 && ret < 1024) { return null; } - BestBlock ret_hu_conv = new BestBlock(null, ret); + long ret = bindings.BestBlock_new(InternalUtils.check_arr_len(block_hash, 32), height); + if (ret >= 0 && ret <= 4096) { return null; } + BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; }