X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelUpdateInfo.java;h=19e2ffc023e637d27e3254b36ac5e94c3fd55c92;hb=7b75443b8305c6a24d3c08520e1785e9d39960e4;hp=15c593fe3bd50ac738ff3b3cedef77e11c205505;hpb=9760d533f7ecac9bb7a8249f9b557e3f995c276d;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java index 15c593fe..19e2ffc0 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java +++ b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java @@ -120,18 +120,18 @@ public class ChannelUpdateInfo extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** * Fees charged when the channel is used for routing */ - public void set_fees(RoutingFees val) { + public void set_fees(org.ldk.structs.RoutingFees val) { bindings.ChannelUpdateInfo_set_fees(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); - this.ptrs_to.add(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -148,7 +148,7 @@ public class ChannelUpdateInfo extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdate(null, ret); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -160,17 +160,19 @@ public class ChannelUpdateInfo extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_last_update_message(@Nullable ChannelUpdate val) { + public void set_last_update_message(@Nullable org.ldk.structs.ChannelUpdate val) { bindings.ChannelUpdateInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); - this.ptrs_to.add(val); + if (this != null) { this.ptrs_to.add(val); }; } /** * Constructs a new ChannelUpdateInfo given each field + * + * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static ChannelUpdateInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) { + public static ChannelUpdateInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, org.ldk.structs.RoutingFees fees_arg, @Nullable org.ldk.structs.ChannelUpdate last_update_message_arg) { long ret = bindings.ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg == null ? 0 : fees_arg.ptr, last_update_message_arg == null ? 0 : last_update_message_arg.ptr); Reference.reachabilityFence(last_update_arg); Reference.reachabilityFence(enabled_arg); @@ -181,9 +183,9 @@ public class ChannelUpdateInfo extends CommonBase { Reference.reachabilityFence(last_update_message_arg); 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); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(fees_arg); - ret_hu_conv.ptrs_to.add(last_update_message_arg); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fees_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(last_update_message_arg); }; return ret_hu_conv; } @@ -201,10 +203,27 @@ public class ChannelUpdateInfo extends CommonBase { Reference.reachabilityFence(this); 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); } - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Checks if two ChannelUpdateInfos 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.ChannelUpdateInfo b) { + boolean ret = bindings.ChannelUpdateInfo_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 ChannelUpdateInfo)) return false; + return this.eq((ChannelUpdateInfo)o); + } /** * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read */