X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelInfo.java;h=b00fa3d7c7d9bd906b44016d2fdf419cf40de732;hb=32973ea2749f8efd05b543dd774763513013b38b;hp=c9de83bc4daa3e398d31bc56549dd1779e08ef29;hpb=d2925e24ac4643ec22eb73495f0424e27def2545;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index c9de83bc..b00fa3d7 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -28,18 +28,19 @@ 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; } /** * 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); + public void set_features(org.ldk.structs.ChannelFeatures val) { + 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,18 +50,19 @@ 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; } /** * 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); + public void set_node_one(org.ldk.structs.NodeId val) { + 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); }; } /** @@ -69,12 +71,12 @@ public class ChannelInfo extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public DirectionalChannelInfo get_one_to_two() { + public ChannelUpdateInfo get_one_to_two() { long ret = bindings.ChannelInfo_get_one_to_two(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(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; } @@ -83,10 +85,11 @@ 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 DirectionalChannelInfo val) { - bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_one_to_two(@Nullable org.ldk.structs.ChannelUpdateInfo val) { + 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,18 +99,19 @@ 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; } /** * 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); + public void set_node_two(org.ldk.structs.NodeId val) { + 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); }; } /** @@ -116,12 +120,12 @@ public class ChannelInfo extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public DirectionalChannelInfo get_two_to_one() { + public ChannelUpdateInfo get_two_to_one() { long ret = bindings.ChannelInfo_get_two_to_one(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(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; } @@ -130,10 +134,11 @@ 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 DirectionalChannelInfo val) { - bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_two_to_one(@Nullable org.ldk.structs.ChannelUpdateInfo val) { + 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,18 +148,19 @@ 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; } /** * The channel capacity as seen on-chain, if chain lookup is available. */ - public void set_capacity_sats(Option_u64Z val) { + public void set_capacity_sats(org.ldk.structs.Option_u64Z val) { bindings.ChannelInfo_set_capacity_sats(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -170,8 +176,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; } @@ -183,10 +189,11 @@ 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); + public void set_announcement_message(@Nullable org.ldk.structs.ChannelAnnouncement val) { + 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 +209,41 @@ 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; + } + + /** + * Checks if two ChannelInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(org.ldk.structs.ChannelInfo b) { + boolean ret = bindings.ChannelInfo_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + if (this != null) { this.ptrs_to.add(b); }; + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof ChannelInfo)) return false; + return this.eq((ChannelInfo)o); + } + /** + * 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; }