X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelTransactionParameters.java;h=b581dc91326d65a92a6cd65c499e46a86e0df0dc;hb=9d146759e11191b55130be7a1b6988d3f289a168;hp=2930d5cb9f8d88fbdf5923f3dad6d592b473029e;hpb=1b870a3ffab1c0024411e30102bc6d198300f095;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelTransactionParameters.java b/src/main/java/org/ldk/structs/ChannelTransactionParameters.java index 2930d5cb..b581dc91 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 javax.annotation.Nullable; /** @@ -27,6 +28,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public ChannelPublicKeys get_holder_pubkeys() { long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr); + if (ret < 1024) { return null; } ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -37,7 +39,6 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_holder_pubkeys(ChannelPublicKeys val) { bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); } /** @@ -75,9 +76,13 @@ public class ChannelTransactionParameters extends CommonBase { /** * The late-bound counterparty channel transaction parameters. * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public CounterpartyChannelTransactionParameters get_counterparty_parameters() { long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr); + if (ret < 1024) { return null; } CounterpartyChannelTransactionParameters ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -86,17 +91,22 @@ public class ChannelTransactionParameters extends CommonBase { /** * The late-bound counterparty channel transaction parameters. * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_counterparty_parameters(CounterpartyChannelTransactionParameters val) { + public void set_counterparty_parameters(@Nullable CounterpartyChannelTransactionParameters val) { bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); } /** * The late-bound funding outpoint + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public OutPoint get_funding_outpoint() { long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr); + if (ret < 1024) { return null; } OutPoint ret_hu_conv = new OutPoint(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -104,22 +114,21 @@ public class ChannelTransactionParameters extends CommonBase { /** * The late-bound funding outpoint + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_funding_outpoint(OutPoint val) { + public void set_funding_outpoint(@Nullable OutPoint val) { bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); } /** * Constructs a new ChannelTransactionParameters given each field */ - public static ChannelTransactionParameters constructor_new(ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg) { + 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 < 1024) { return null; } ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(holder_pubkeys_arg); - ret_hu_conv.ptrs_to.add(counterparty_parameters_arg); - ret_hu_conv.ptrs_to.add(funding_outpoint_arg); return ret_hu_conv; } @@ -128,6 +137,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public ChannelTransactionParameters clone() { long ret = bindings.ChannelTransactionParameters_clone(this.ptr); + if (ret < 1024) { return null; } ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -149,6 +159,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public DirectedChannelTransactionParameters as_holder_broadcastable() { long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr); + if (ret < 1024) { return null; } DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -162,6 +173,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public DirectedChannelTransactionParameters as_counterparty_broadcastable() { long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr); + if (ret < 1024) { return null; } DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -178,8 +190,9 @@ public class ChannelTransactionParameters extends CommonBase { /** * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write */ - public static Result_ChannelTransactionParametersDecodeErrorZ constructor_read(byte[] ser) { + public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelTransactionParameters_read(ser); + if (ret < 1024) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; }