/**
- * An open_channel message to be sent or received from a peer
+ * An [`open_channel`] message to be sent to or received from a peer.
+ *
+ * Used in V1 channel establishment
+ *
+ * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
*/
public class OpenChannel : CommonBase {
internal OpenChannel(object _dummy, long ptr) : base(ptr) { }
}
/**
- * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
+ * The feerate per 1000-weight of sender generated transactions, until updated by
+ * [`UpdateFee`]
*/
public int get_feerate_per_kw() {
int ret = bindings.OpenChannel_get_feerate_per_kw(this.ptr);
}
/**
- * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
+ * The feerate per 1000-weight of sender generated transactions, until updated by
+ * [`UpdateFee`]
*/
public void set_feerate_per_kw(int val) {
bindings.OpenChannel_set_feerate_per_kw(this.ptr, val);
}
/**
- * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
+ * The number of blocks which the counterparty will have to wait to claim on-chain funds if
+ * they broadcast a commitment transaction
*/
public short get_to_self_delay() {
short ret = bindings.OpenChannel_get_to_self_delay(this.ptr);
}
/**
- * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
+ * The number of blocks which the counterparty will have to wait to claim on-chain funds if
+ * they broadcast a commitment transaction
*/
public void set_to_self_delay(short val) {
bindings.OpenChannel_set_to_self_delay(this.ptr, val);
}
/**
- * Channel flags
+ * The channel flags to be used
*/
public byte get_channel_flags() {
byte ret = bindings.OpenChannel_get_channel_flags(this.ptr);
}
/**
- * Channel flags
+ * The channel flags to be used
*/
public void set_channel_flags(byte val) {
bindings.OpenChannel_set_channel_flags(this.ptr, val);
}
/**
- * The channel type that this channel will represent. If none is set, we derive the channel
- * type from the intersection of our feature bits with our counterparty's feature bits from
- * the Init message.
+ * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
+ */
+ public Option_ScriptZ get_shutdown_scriptpubkey() {
+ long ret = bindings.OpenChannel_get_shutdown_scriptpubkey(this.ptr);
+ GC.KeepAlive(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
+ */
+ public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
+ bindings.OpenChannel_set_shutdown_scriptpubkey(this.ptr, val.ptr);
+ GC.KeepAlive(this);
+ GC.KeepAlive(val);
+ if (this != null) { this.ptrs_to.AddLast(val); };
+ }
+
+ /**
+ * The channel type that this channel will represent
+ *
+ * If this is `None`, we derive the channel type from the intersection of our
+ * feature bits with our counterparty's feature bits from the [`Init`] message.
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
}
/**
- * The channel type that this channel will represent. If none is set, we derive the channel
- * type from the intersection of our feature bits with our counterparty's feature bits from
- * the Init message.
+ * The channel type that this channel will represent
+ *
+ * If this is `None`, we derive the channel type from the intersection of our
+ * feature bits with our counterparty's feature bits from the [`Init`] message.
*
* Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
if (this != null) { this.ptrs_to.AddLast(val); };
}
+ /**
+ * Constructs a new OpenChannel given each field
+ */
+ public static OpenChannel of(byte[] chain_hash_arg, byte[] temporary_channel_id_arg, long funding_satoshis_arg, long push_msat_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long channel_reserve_satoshis_arg, long htlc_minimum_msat_arg, int feerate_per_kw_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte channel_flags_arg, org.ldk.structs.Option_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
+ long ret = bindings.OpenChannel_new(InternalUtils.check_arr_len(chain_hash_arg, 32), InternalUtils.check_arr_len(temporary_channel_id_arg, 32), funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33), InternalUtils.check_arr_len(first_per_commitment_point_arg, 33), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
+ GC.KeepAlive(chain_hash_arg);
+ GC.KeepAlive(temporary_channel_id_arg);
+ GC.KeepAlive(funding_satoshis_arg);
+ GC.KeepAlive(push_msat_arg);
+ GC.KeepAlive(dust_limit_satoshis_arg);
+ GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
+ GC.KeepAlive(channel_reserve_satoshis_arg);
+ GC.KeepAlive(htlc_minimum_msat_arg);
+ GC.KeepAlive(feerate_per_kw_arg);
+ GC.KeepAlive(to_self_delay_arg);
+ GC.KeepAlive(max_accepted_htlcs_arg);
+ GC.KeepAlive(funding_pubkey_arg);
+ GC.KeepAlive(revocation_basepoint_arg);
+ GC.KeepAlive(payment_point_arg);
+ GC.KeepAlive(delayed_payment_basepoint_arg);
+ GC.KeepAlive(htlc_basepoint_arg);
+ GC.KeepAlive(first_per_commitment_point_arg);
+ GC.KeepAlive(channel_flags_arg);
+ GC.KeepAlive(shutdown_scriptpubkey_arg);
+ GC.KeepAlive(channel_type_arg);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.OpenChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannel(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
+ return ret_hu_conv;
+ }
+
internal long clone_ptr() {
long ret = bindings.OpenChannel_clone_ptr(this.ptr);
GC.KeepAlive(this);