X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInMemorySigner.java;h=1c5c25dbd7f5fea81b7b22605d41113e657015e6;hb=2bb592fb946e316dba9f4d1123f8ac72ff4e9bf8;hp=5afb560503a00633b315e439fd9627dbddbaf5c8;hpb=a672396f21c0448656bb400cfe28b9df6e5a842b;p=ldk-java diff --git a/src/main/java/org/ldk/structs/InMemorySigner.java b/src/main/java/org/ldk/structs/InMemorySigner.java index 5afb5605..1c5c25db 100644 --- a/src/main/java/org/ldk/structs/InMemorySigner.java +++ b/src/main/java/org/ldk/structs/InMemorySigner.java @@ -174,8 +174,12 @@ public class InMemorySigner extends CommonBase { /** * Returns the counterparty's pubkeys. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public ChannelPublicKeys counterparty_pubkeys() { long ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr); Reference.reachabilityFence(this); @@ -190,12 +194,16 @@ public class InMemorySigner extends CommonBase { * transactions, i.e., the amount of time that we have to wait to recover our funds if we * broadcast a transaction. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ - public short counterparty_selected_contest_delay() { - short ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr); + public Option_u16Z counterparty_selected_contest_delay() { + long ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** @@ -203,30 +211,42 @@ public class InMemorySigner extends CommonBase { * by our counterparty, i.e., the amount of time that they have to wait to recover their funds * if they broadcast a transaction. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ - public short holder_selected_contest_delay() { - short ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr); + public Option_u16Z holder_selected_contest_delay() { + long ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** * Returns whether the holder is the initiator. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ - public boolean is_outbound() { - boolean ret = bindings.InMemorySigner_is_outbound(this.ptr); + public Option_boolZ is_outbound() { + long ret = bindings.InMemorySigner_is_outbound(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_boolZ ret_hu_conv = org.ldk.structs.Option_boolZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** * Funding outpoint * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public OutPoint funding_outpoint() { long ret = bindings.InMemorySigner_funding_outpoint(this.ptr); Reference.reachabilityFence(this); @@ -240,8 +260,12 @@ public class InMemorySigner extends CommonBase { * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or * building transactions. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public ChannelTransactionParameters get_channel_parameters() { long ret = bindings.InMemorySigner_get_channel_parameters(this.ptr); Reference.reachabilityFence(this); @@ -252,14 +276,22 @@ public class InMemorySigner extends CommonBase { } /** - * Returns whether anchors should be used. + * Returns the channel type features of the channel parameters. Should be helpful for + * determining a channel's category, i. e. legacy/anchors/taproot/etc. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public boolean opt_anchors() { - boolean ret = bindings.InMemorySigner_opt_anchors(this.ptr); + @Nullable + public ChannelTypeFeatures channel_type_features() { + long ret = bindings.InMemorySigner_channel_type_features(this.ptr); Reference.reachabilityFence(this); - return ret; + 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; } /** @@ -272,14 +304,14 @@ public class InMemorySigner extends CommonBase { * * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint */ - public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, org.ldk.structs.StaticPaymentOutputDescriptor descriptor) { + public Result_WitnessNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, org.ldk.structs.StaticPaymentOutputDescriptor descriptor) { long ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(spend_tx); Reference.reachabilityFence(input_idx); Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } - Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); + Result_WitnessNoneZ ret_hu_conv = Result_WitnessNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(descriptor); }; return ret_hu_conv; } @@ -296,14 +328,14 @@ public class InMemorySigner extends CommonBase { * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay */ - public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, org.ldk.structs.DelayedPaymentOutputDescriptor descriptor) { + public Result_WitnessNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, org.ldk.structs.DelayedPaymentOutputDescriptor descriptor) { long ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(spend_tx); Reference.reachabilityFence(input_idx); Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } - Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); + Result_WitnessNoneZ ret_hu_conv = Result_WitnessNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(descriptor); }; return ret_hu_conv; } @@ -373,7 +405,7 @@ public class InMemorySigner extends CommonBase { * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ public static Result_InMemorySignerDecodeErrorZ read(byte[] ser, org.ldk.structs.EntropySource arg) { - long ret = bindings.InMemorySigner_read(ser, arg == null ? 0 : arg.ptr); + long ret = bindings.InMemorySigner_read(ser, arg.ptr); Reference.reachabilityFence(ser); Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; }