X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FBestBlock.java;h=77664b50f914c880a676913f33cf39d944006e8f;hb=8c0814bf345323be8f16e075a9af0bd43d9400ee;hp=cda09d30f09453df56f4cb2f34cb1c59471aeee9;hpb=348009c7987109e810e7e31db6110fb71879fbc3;p=ldk-java diff --git a/src/main/java/org/ldk/structs/BestBlock.java b/src/main/java/org/ldk/structs/BestBlock.java index cda09d30..77664b50 100644 --- a/src/main/java/org/ldk/structs/BestBlock.java +++ b/src/main/java/org/ldk/structs/BestBlock.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; /** @@ -23,6 +24,7 @@ public class BestBlock extends CommonBase { */ public BestBlock clone() { long ret = bindings.BestBlock_clone(this.ptr); + if (ret < 1024) { return null; } BestBlock ret_hu_conv = new BestBlock(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -32,8 +34,9 @@ public class BestBlock extends CommonBase { * Constructs a `BestBlock` that represents the genesis block at height 0 of the given * network. */ - public static BestBlock from_genesis(Network network) { + public static BestBlock from_genesis(org.ldk.enums.Network network) { long ret = bindings.BestBlock_from_genesis(network); + if (ret < 1024) { return null; } BestBlock ret_hu_conv = new BestBlock(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; @@ -44,6 +47,7 @@ public class BestBlock extends CommonBase { */ public static BestBlock of(byte[] block_hash, int height) { long ret = bindings.BestBlock_new(block_hash, height); + if (ret < 1024) { return null; } BestBlock ret_hu_conv = new BestBlock(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv;