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=4503cdb62dc6f9ce142b59b0a9a1fe31161eeceb;hpb=d941cc4e66ea53ce81912a04d35b164344f3a7ee;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java index 4503cdb6..19e2ffc0 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java +++ b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java @@ -97,20 +97,17 @@ public class ChannelUpdateInfo extends CommonBase { /** * The maximum value which may be relayed to the next hop via the channel. */ - public Option_u64Z get_htlc_maximum_msat() { + public long get_htlc_maximum_msat() { long ret = bindings.ChannelUpdateInfo_get_htlc_maximum_msat(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); - return ret_hu_conv; + return ret; } /** * The maximum value which may be relayed to the next hop via the channel. */ - public void set_htlc_maximum_msat(Option_u64Z val) { - bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val.ptr); + public void set_htlc_maximum_msat(long val) { + bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val); Reference.reachabilityFence(this); Reference.reachabilityFence(val); } @@ -122,18 +119,19 @@ public class ChannelUpdateInfo extends CommonBase { long ret = bindings.ChannelUpdateInfo_get_fees(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); } + 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) { - bindings.ChannelUpdateInfo_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1); + 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); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -149,8 +147,8 @@ public class ChannelUpdateInfo extends CommonBase { long ret = bindings.ChannelUpdateInfo_get_last_update_message(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } - ret_hu_conv.ptrs_to.add(this); + org.ldk.structs.ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdate(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -162,17 +160,20 @@ 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) { - bindings.ChannelUpdateInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr & ~1); + 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); + 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, Option_u64Z htlc_maximum_msat_arg, RoutingFees fees_arg, 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.ptr, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1); + 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); Reference.reachabilityFence(cltv_expiry_delta_arg); @@ -181,8 +182,10 @@ public class ChannelUpdateInfo extends CommonBase { Reference.reachabilityFence(fees_arg); Reference.reachabilityFence(last_update_message_arg); 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(ret_hu_conv); + 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(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; } @@ -199,11 +202,28 @@ public class ChannelUpdateInfo extends CommonBase { long ret = bindings.ChannelUpdateInfo_clone(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; } + /** + * 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 */