X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FWatchedOutput.java;h=2014286be97b0751c91150819184870f7be2d40b;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=55c7a4183ff6046c6619188a744ab41ec516df21;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/WatchedOutput.java b/src/main/java/org/ldk/structs/WatchedOutput.java index 55c7a418..2014286b 100644 --- a/src/main/java/org/ldk/structs/WatchedOutput.java +++ b/src/main/java/org/ldk/structs/WatchedOutput.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; /** @@ -30,7 +31,10 @@ public class WatchedOutput extends CommonBase { /** * First block where the transaction output may have been spent. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public byte[] get_block_hash() { byte[] ret = bindings.WatchedOutput_get_block_hash(this.ptr); return ret; @@ -38,8 +42,10 @@ public class WatchedOutput extends CommonBase { /** * First block where the transaction output may have been spent. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_block_hash(byte[] val) { + public void set_block_hash(@Nullable byte[] val) { bindings.WatchedOutput_set_block_hash(this.ptr, val); } @@ -48,7 +54,8 @@ public class WatchedOutput extends CommonBase { */ public OutPoint get_outpoint() { long ret = bindings.WatchedOutput_get_outpoint(this.ptr); - OutPoint ret_hu_conv = new OutPoint(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -58,7 +65,6 @@ public class WatchedOutput extends CommonBase { */ public void set_outpoint(OutPoint val) { bindings.WatchedOutput_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); } /** @@ -81,9 +87,9 @@ public class WatchedOutput extends CommonBase { */ public static WatchedOutput of(byte[] block_hash_arg, OutPoint outpoint_arg, byte[] script_pubkey_arg) { long ret = bindings.WatchedOutput_new(block_hash_arg, outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, script_pubkey_arg); - WatchedOutput ret_hu_conv = new WatchedOutput(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + WatchedOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new WatchedOutput(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(outpoint_arg); return ret_hu_conv; } @@ -92,7 +98,8 @@ public class WatchedOutput extends CommonBase { */ public WatchedOutput clone() { long ret = bindings.WatchedOutput_clone(this.ptr); - WatchedOutput ret_hu_conv = new WatchedOutput(null, ret); + if (ret >= 0 && ret <= 4096) { return null; } + WatchedOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new WatchedOutput(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; }