X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FUnsignedNodeAnnouncement.java;h=7c6c614e8c10f52b99c3ccae021bf3323acfb0a9;hb=1854b5cebef22ace9e9e4dd191f609818df9ce08;hp=3bacc584f6fc5c4d7261c603425df56c94a13e81;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java index 3bacc584..7c6c614e 100644 --- a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java @@ -4,6 +4,8 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; /** @@ -23,7 +25,9 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public NodeFeatures get_features() { long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr); - NodeFeatures ret_hu_conv = new NodeFeatures(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -33,7 +37,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_features(NodeFeatures val) { bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -41,6 +46,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public int get_timestamp() { int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +55,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_timestamp(int val) { bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +65,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] get_node_id() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -65,7 +74,9 @@ public class UnsignedNodeAnnouncement extends CommonBase { * to this node). */ public void set_node_id(byte[] val) { - bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val); + bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -73,6 +84,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] get_rgb() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,7 +92,9 @@ public class UnsignedNodeAnnouncement extends CommonBase { * An RGB color for UI purposes */ public void set_rgb(byte[] val) { - bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val); + bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -89,6 +103,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] get_alias() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -97,15 +112,24 @@ public class UnsignedNodeAnnouncement extends CommonBase { * of uniqueness. */ public void set_alias(byte[] val) { - bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val); + bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * List of addresses on which this node is reachable */ public void set_addresses(NetAddress[] val) { - bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray()); - /* TODO 2 NetAddress */; + bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + long clone_ptr() { + long ret = bindings.UnsignedNodeAnnouncement_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; } /** @@ -113,7 +137,9 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public UnsignedNodeAnnouncement clone() { long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr); - UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedNodeAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -123,6 +149,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -131,6 +158,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) { long ret = bindings.UnsignedNodeAnnouncement_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }