X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelInfo.java;h=db9f3589bac668671062d87ce8f165f48b7d6f05;hb=f385eff0dd0aa61fbf21ae946c424f4a6a26de04;hp=a8d680c199f346d075c9668b495592a2036d3b0a;hpb=d941cc4e66ea53ce81912a04d35b164344f3a7ee;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index a8d680c1..db9f3589 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -28,8 +28,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_features(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -37,9 +37,10 @@ public class ChannelInfo extends CommonBase { * Protocol features of a channel communicated during its announcement */ public void set_features(ChannelFeatures val) { - bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -49,8 +50,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_node_one(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -58,9 +59,10 @@ public class ChannelInfo extends CommonBase { * Source node of the first direction of a channel */ public void set_node_one(NodeId val) { - bindings.ChannelInfo_set_node_one(this.ptr, val == null ? 0 : val.ptr & ~1); + bindings.ChannelInfo_set_node_one(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -73,8 +75,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_one_to_two(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -84,9 +86,10 @@ public class ChannelInfo extends CommonBase { * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ public void set_one_to_two(@Nullable ChannelUpdateInfo val) { - bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1); + bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -96,8 +99,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_node_two(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -105,9 +108,10 @@ public class ChannelInfo extends CommonBase { * Source node of the second direction of a channel */ public void set_node_two(NodeId val) { - bindings.ChannelInfo_set_node_two(this.ptr, val == null ? 0 : val.ptr & ~1); + bindings.ChannelInfo_set_node_two(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -120,8 +124,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_two_to_one(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -131,9 +135,10 @@ public class ChannelInfo extends CommonBase { * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ public void set_two_to_one(@Nullable ChannelUpdateInfo val) { - bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1); + bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -143,8 +148,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_capacity_sats(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -170,8 +175,8 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_announcement_message(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelAnnouncement(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -184,9 +189,10 @@ public class ChannelInfo extends CommonBase { * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ public void set_announcement_message(@Nullable ChannelAnnouncement val) { - bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1); + bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } long clone_ptr() { @@ -202,8 +208,24 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelInfo(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelUpdateInfo get_directional_info(byte channel_flags) { + long ret = bindings.ChannelInfo_get_directional_info(this.ptr, channel_flags); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_flags); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; }