6 namespace org { namespace ldk { namespace structs {
10 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
11 * The fields are organized by holder/counterparty.
13 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
14 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
16 public class ChannelTransactionParameters : CommonBase {
17 internal ChannelTransactionParameters(object _dummy, long ptr) : base(ptr) { }
18 ~ChannelTransactionParameters() {
19 if (ptr != 0) { bindings.ChannelTransactionParameters_free(ptr); }
25 public ChannelPublicKeys get_holder_pubkeys() {
26 long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr);
28 if (ret >= 0 && ret <= 4096) { return null; }
29 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
30 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
37 public void set_holder_pubkeys(org.ldk.structs.ChannelPublicKeys val) {
38 bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val.ptr);
41 if (this != null) { this.ptrs_to.AddLast(val); };
45 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
47 public short get_holder_selected_contest_delay() {
48 short ret = bindings.ChannelTransactionParameters_get_holder_selected_contest_delay(this.ptr);
54 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
56 public void set_holder_selected_contest_delay(short val) {
57 bindings.ChannelTransactionParameters_set_holder_selected_contest_delay(this.ptr, val);
63 * Whether the holder is the initiator of this channel.
64 * This is an input to the commitment number obscure factor computation.
66 public bool get_is_outbound_from_holder() {
67 bool ret = bindings.ChannelTransactionParameters_get_is_outbound_from_holder(this.ptr);
73 * Whether the holder is the initiator of this channel.
74 * This is an input to the commitment number obscure factor computation.
76 public void set_is_outbound_from_holder(bool val) {
77 bindings.ChannelTransactionParameters_set_is_outbound_from_holder(this.ptr, val);
83 * The late-bound counterparty channel transaction parameters.
84 * These parameters are populated at the point in the protocol where the counterparty provides them.
86 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
88 public CounterpartyChannelTransactionParameters get_counterparty_parameters() {
89 long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.CounterpartyChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CounterpartyChannelTransactionParameters(null, ret); }
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
98 * The late-bound counterparty channel transaction parameters.
99 * These parameters are populated at the point in the protocol where the counterparty provides them.
101 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
103 public void set_counterparty_parameters(org.ldk.structs.CounterpartyChannelTransactionParameters val) {
104 bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr);
107 if (this != null) { this.ptrs_to.AddLast(val); };
111 * The late-bound funding outpoint
113 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
115 public OutPoint get_funding_outpoint() {
116 long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr);
118 if (ret >= 0 && ret <= 4096) { return null; }
119 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
120 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
125 * The late-bound funding outpoint
127 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
129 public void set_funding_outpoint(org.ldk.structs.OutPoint val) {
130 bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr);
133 if (this != null) { this.ptrs_to.AddLast(val); };
137 * This channel's type, as negotiated during channel open. For old objects where this field
138 * wasn't serialized, it will default to static_remote_key at deserialization.
140 public ChannelTypeFeatures get_channel_type_features() {
141 long ret = bindings.ChannelTransactionParameters_get_channel_type_features(this.ptr);
143 if (ret >= 0 && ret <= 4096) { return null; }
144 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
145 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
150 * This channel's type, as negotiated during channel open. For old objects where this field
151 * wasn't serialized, it will default to static_remote_key at deserialization.
153 public void set_channel_type_features(org.ldk.structs.ChannelTypeFeatures val) {
154 bindings.ChannelTransactionParameters_set_channel_type_features(this.ptr, val.ptr);
157 if (this != null) { this.ptrs_to.AddLast(val); };
161 * Constructs a new ChannelTransactionParameters given each field
163 * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
164 * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
166 public static ChannelTransactionParameters of(org.ldk.structs.ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, org.ldk.structs.CounterpartyChannelTransactionParameters counterparty_parameters_arg, org.ldk.structs.OutPoint funding_outpoint_arg, org.ldk.structs.ChannelTypeFeatures channel_type_features_arg) {
167 long ret = bindings.ChannelTransactionParameters_new(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.ptr);
168 GC.KeepAlive(holder_pubkeys_arg);
169 GC.KeepAlive(holder_selected_contest_delay_arg);
170 GC.KeepAlive(is_outbound_from_holder_arg);
171 GC.KeepAlive(counterparty_parameters_arg);
172 GC.KeepAlive(funding_outpoint_arg);
173 GC.KeepAlive(channel_type_features_arg);
174 if (ret >= 0 && ret <= 4096) { return null; }
175 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
176 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
177 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(holder_pubkeys_arg); };
178 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(counterparty_parameters_arg); };
179 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_outpoint_arg); };
180 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_features_arg); };
184 internal long clone_ptr() {
185 long ret = bindings.ChannelTransactionParameters_clone_ptr(this.ptr);
191 * Creates a copy of the ChannelTransactionParameters
193 public ChannelTransactionParameters clone() {
194 long ret = bindings.ChannelTransactionParameters_clone(this.ptr);
196 if (ret >= 0 && ret <= 4096) { return null; }
197 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
198 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
203 * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters.
206 long ret = bindings.ChannelTransactionParameters_hash(this.ptr);
211 public override int GetHashCode() {
212 return (int)this.hash();
215 * Checks if two ChannelTransactionParameterss contain equal inner contents.
216 * This ignores pointers and is_owned flags and looks at the values in fields.
217 * Two objects with NULL inner values will be considered "equal" here.
219 public bool eq(org.ldk.structs.ChannelTransactionParameters b) {
220 bool ret = bindings.ChannelTransactionParameters_eq(this.ptr, b.ptr);
223 if (this != null) { this.ptrs_to.AddLast(b); };
227 public override bool Equals(object o) {
228 if (!(o is ChannelTransactionParameters)) return false;
229 return this.eq((ChannelTransactionParameters)o);
232 * Whether the late bound parameters are populated.
234 public bool is_populated() {
235 bool ret = bindings.ChannelTransactionParameters_is_populated(this.ptr);
241 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
242 * given that the holder is the broadcaster.
244 * self.is_populated() must be true before calling this function.
246 public DirectedChannelTransactionParameters as_holder_broadcastable() {
247 long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr);
249 if (ret >= 0 && ret <= 4096) { return null; }
250 org.ldk.structs.DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelTransactionParameters(null, ret); }
251 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
256 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
257 * given that the counterparty is the broadcaster.
259 * self.is_populated() must be true before calling this function.
261 public DirectedChannelTransactionParameters as_counterparty_broadcastable() {
262 long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr);
264 if (ret >= 0 && ret <= 4096) { return null; }
265 org.ldk.structs.DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelTransactionParameters(null, ret); }
266 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
271 * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
273 public byte[] write() {
274 long ret = bindings.ChannelTransactionParameters_write(this.ptr);
276 if (ret >= 0 && ret <= 4096) { return null; }
277 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
282 * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
284 public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) {
285 long ret = bindings.ChannelTransactionParameters_read(InternalUtils.encodeUint8Array(ser));
287 if (ret >= 0 && ret <= 4096) { return null; }
288 Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret);