X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelTransactionParameters.java;h=cba450382f4de9038dd2ee6e54375506a0e5deb0;hb=07d5d868dfe064aadb28a7f7ca6002c16be9723d;hp=c22941e929bcff8079eb624a91a7d67ae7ed142a;hpb=32692e00046b7ec16b6a2e20bd54800b2b48d4c0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelTransactionParameters.java b/src/main/java/org/ldk/structs/ChannelTransactionParameters.java index c22941e9..cba45038 100644 --- a/src/main/java/org/ldk/structs/ChannelTransactionParameters.java +++ b/src/main/java/org/ldk/structs/ChannelTransactionParameters.java @@ -4,6 +4,7 @@ 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; @@ -28,17 +29,21 @@ public class ChannelTransactionParameters extends CommonBase { */ public ChannelPublicKeys get_holder_pubkeys() { long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** * Holder public keys */ - public void set_holder_pubkeys(ChannelPublicKeys val) { - bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_holder_pubkeys(org.ldk.structs.ChannelPublicKeys val) { + bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -46,6 +51,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public short get_holder_selected_contest_delay() { short ret = bindings.ChannelTransactionParameters_get_holder_selected_contest_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -54,6 +60,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_holder_selected_contest_delay(short val) { bindings.ChannelTransactionParameters_set_holder_selected_contest_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -62,6 +70,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public boolean get_is_outbound_from_holder() { boolean ret = bindings.ChannelTransactionParameters_get_is_outbound_from_holder(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -71,6 +80,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_is_outbound_from_holder(boolean val) { bindings.ChannelTransactionParameters_set_is_outbound_from_holder(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -82,9 +93,10 @@ public class ChannelTransactionParameters extends CommonBase { @Nullable public CounterpartyChannelTransactionParameters get_counterparty_parameters() { long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - CounterpartyChannelTransactionParameters ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.CounterpartyChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CounterpartyChannelTransactionParameters(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -94,8 +106,11 @@ public class ChannelTransactionParameters extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_counterparty_parameters(@Nullable CounterpartyChannelTransactionParameters val) { - bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_counterparty_parameters(@Nullable org.ldk.structs.CounterpartyChannelTransactionParameters val) { + bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -106,9 +121,10 @@ public class ChannelTransactionParameters extends CommonBase { @Nullable public OutPoint get_funding_outpoint() { long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - OutPoint ret_hu_conv = new OutPoint(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -117,37 +133,114 @@ public class ChannelTransactionParameters extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_funding_outpoint(@Nullable OutPoint val) { - bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_funding_outpoint(@Nullable org.ldk.structs.OutPoint val) { + bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + + /** + * This channel's type, as negotiated during channel open. For old objects where this field + * wasn't serialized, it will default to static_remote_key at deserialization. + */ + public ChannelTypeFeatures get_channel_type_features() { + long ret = bindings.ChannelTransactionParameters_get_channel_type_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * This channel's type, as negotiated during channel open. For old objects where this field + * wasn't serialized, it will default to static_remote_key at deserialization. + */ + public void set_channel_type_features(org.ldk.structs.ChannelTypeFeatures val) { + bindings.ChannelTransactionParameters_set_channel_type_features(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** * Constructs a new ChannelTransactionParameters given each field + * + * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static ChannelTransactionParameters of(ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg) { - long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1); - if (ret >= 0 && ret < 1024) { return null; } - ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + public static ChannelTransactionParameters of(org.ldk.structs.ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, @Nullable org.ldk.structs.CounterpartyChannelTransactionParameters counterparty_parameters_arg, @Nullable org.ldk.structs.OutPoint funding_outpoint_arg, org.ldk.structs.ChannelTypeFeatures channel_type_features_arg) { + long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr, channel_type_features_arg == null ? 0 : channel_type_features_arg.ptr); + Reference.reachabilityFence(holder_pubkeys_arg); + Reference.reachabilityFence(holder_selected_contest_delay_arg); + Reference.reachabilityFence(is_outbound_from_holder_arg); + Reference.reachabilityFence(counterparty_parameters_arg); + Reference.reachabilityFence(funding_outpoint_arg); + Reference.reachabilityFence(channel_type_features_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(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(holder_pubkeys_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(counterparty_parameters_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_outpoint_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type_features_arg); }; return ret_hu_conv; } + long clone_ptr() { + long ret = bindings.ChannelTransactionParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Creates a copy of the ChannelTransactionParameters */ public ChannelTransactionParameters clone() { long ret = bindings.ChannelTransactionParameters_clone(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. + */ + public long hash() { + long ret = bindings.ChannelTransactionParameters_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } + /** + * Checks if two ChannelTransactionParameterss 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.ChannelTransactionParameters b) { + boolean ret = bindings.ChannelTransactionParameters_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 ChannelTransactionParameters)) return false; + return this.eq((ChannelTransactionParameters)o); + } /** * Whether the late bound parameters are populated. */ public boolean is_populated() { boolean ret = bindings.ChannelTransactionParameters_is_populated(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -159,9 +252,10 @@ public class ChannelTransactionParameters extends CommonBase { */ public DirectedChannelTransactionParameters as_holder_broadcastable() { long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelTransactionParameters(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -173,9 +267,10 @@ public class ChannelTransactionParameters extends CommonBase { */ public DirectedChannelTransactionParameters as_counterparty_broadcastable() { long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelTransactionParameters(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -184,6 +279,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelTransactionParameters_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -192,7 +288,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelTransactionParameters_read(ser); - if (ret >= 0 && ret < 1024) { return null; } + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }