6 namespace org { namespace ldk { namespace structs {
10 * A descriptor used to sign for a commitment transaction's HTLC output.
12 public class HTLCDescriptor : CommonBase {
13 internal HTLCDescriptor(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.HTLCDescriptor_free(ptr); }
19 * The parameters required to derive the signer for the HTLC input.
21 public ChannelDerivationParameters get_channel_derivation_parameters() {
22 long ret = bindings.HTLCDescriptor_get_channel_derivation_parameters(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31 * The parameters required to derive the signer for the HTLC input.
33 public void set_channel_derivation_parameters(org.ldk.structs.ChannelDerivationParameters val) {
34 bindings.HTLCDescriptor_set_channel_derivation_parameters(this.ptr, val == null ? 0 : val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * The number of the commitment transaction in which the HTLC output lives.
43 public long get_per_commitment_number() {
44 long ret = bindings.HTLCDescriptor_get_per_commitment_number(this.ptr);
50 * The number of the commitment transaction in which the HTLC output lives.
52 public void set_per_commitment_number(long val) {
53 bindings.HTLCDescriptor_set_per_commitment_number(this.ptr, val);
59 * The key tweak corresponding to the number of the commitment transaction in which the HTLC
60 * output lives. This tweak is applied to all the basepoints for both parties in the channel to
61 * arrive at unique keys per commitment.
63 * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
65 public byte[] get_per_commitment_point() {
66 long ret = bindings.HTLCDescriptor_get_per_commitment_point(this.ptr);
68 if (ret >= 0 && ret <= 4096) { return null; }
69 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
74 * The key tweak corresponding to the number of the commitment transaction in which the HTLC
75 * output lives. This tweak is applied to all the basepoints for both parties in the channel to
76 * arrive at unique keys per commitment.
78 * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
80 public void set_per_commitment_point(byte[] val) {
81 bindings.HTLCDescriptor_set_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
87 * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
88 * originating from a channel supporting anchor outputs, otherwise it is the channel's
89 * negotiated feerate at the time the commitment transaction was built.
91 public int get_feerate_per_kw() {
92 int ret = bindings.HTLCDescriptor_get_feerate_per_kw(this.ptr);
98 * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs
99 * originating from a channel supporting anchor outputs, otherwise it is the channel's
100 * negotiated feerate at the time the commitment transaction was built.
102 public void set_feerate_per_kw(int val) {
103 bindings.HTLCDescriptor_set_feerate_per_kw(this.ptr, val);
109 * The details of the HTLC as it appears in the commitment transaction.
111 public HTLCOutputInCommitment get_htlc() {
112 long ret = bindings.HTLCDescriptor_get_htlc(this.ptr);
114 if (ret >= 0 && ret <= 4096) { return null; }
115 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
116 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
121 * The details of the HTLC as it appears in the commitment transaction.
123 public void set_htlc(org.ldk.structs.HTLCOutputInCommitment val) {
124 bindings.HTLCDescriptor_set_htlc(this.ptr, val == null ? 0 : val.ptr);
127 if (this != null) { this.ptrs_to.AddLast(val); };
131 * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
134 public Option_ThirtyTwoBytesZ get_preimage() {
135 long ret = bindings.HTLCDescriptor_get_preimage(this.ptr);
137 if (ret >= 0 && ret <= 4096) { return null; }
138 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
139 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
144 * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
147 public void set_preimage(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
148 bindings.HTLCDescriptor_set_preimage(this.ptr, val.ptr);
151 if (this != null) { this.ptrs_to.AddLast(val); };
155 * The counterparty's signature required to spend the HTLC output.
157 public byte[] get_counterparty_sig() {
158 long ret = bindings.HTLCDescriptor_get_counterparty_sig(this.ptr);
160 if (ret >= 0 && ret <= 4096) { return null; }
161 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
166 * The counterparty's signature required to spend the HTLC output.
168 public void set_counterparty_sig(byte[] val) {
169 bindings.HTLCDescriptor_set_counterparty_sig(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64)));
174 internal long clone_ptr() {
175 long ret = bindings.HTLCDescriptor_clone_ptr(this.ptr);
181 * Creates a copy of the HTLCDescriptor
183 public HTLCDescriptor clone() {
184 long ret = bindings.HTLCDescriptor_clone(this.ptr);
186 if (ret >= 0 && ret <= 4096) { return null; }
187 org.ldk.structs.HTLCDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCDescriptor(null, ret); }
188 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
193 * Checks if two HTLCDescriptors contain equal inner contents.
194 * This ignores pointers and is_owned flags and looks at the values in fields.
195 * Two objects with NULL inner values will be considered "equal" here.
197 public bool eq(org.ldk.structs.HTLCDescriptor b) {
198 bool ret = bindings.HTLCDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
201 if (this != null) { this.ptrs_to.AddLast(b); };
205 public override bool Equals(object o) {
206 if (!(o is HTLCDescriptor)) return false;
207 return this.eq((HTLCDescriptor)o);
210 * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read
212 public byte[] write() {
213 long ret = bindings.HTLCDescriptor_write(this.ptr);
215 if (ret >= 0 && ret <= 4096) { return null; }
216 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
221 * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write
223 public static Result_HTLCDescriptorDecodeErrorZ read(byte[] ser) {
224 long ret = bindings.HTLCDescriptor_read(InternalUtils.encodeUint8Array(ser));
226 if (ret >= 0 && ret <= 4096) { return null; }
227 Result_HTLCDescriptorDecodeErrorZ ret_hu_conv = Result_HTLCDescriptorDecodeErrorZ.constr_from_ptr(ret);
232 * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
233 * being spent by the HTLC input in the HTLC transaction.
235 public OutPoint outpoint() {
236 long ret = bindings.HTLCDescriptor_outpoint(this.ptr);
238 if (ret >= 0 && ret <= 4096) { return null; }
239 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
240 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
245 * Returns the UTXO to be spent by the HTLC input, which can be obtained via
246 * [`Self::unsigned_tx_input`].
248 public TxOut previous_utxo() {
249 long ret = bindings.HTLCDescriptor_previous_utxo(this.ptr);
251 if (ret >= 0 && ret <= 4096) { return null; }
252 TxOut ret_conv = new TxOut(null, ret);
257 * Returns the unsigned transaction input spending the HTLC output in the commitment
260 public TxIn unsigned_tx_input() {
261 long ret = bindings.HTLCDescriptor_unsigned_tx_input(this.ptr);
263 if (ret >= 0 && ret <= 4096) { return null; }
264 TxIn ret_conv = new TxIn(null, ret);
269 * Returns the delayed output created as a result of spending the HTLC output in the commitment
272 public TxOut tx_output() {
273 long ret = bindings.HTLCDescriptor_tx_output(this.ptr);
275 if (ret >= 0 && ret <= 4096) { return null; }
276 TxOut ret_conv = new TxOut(null, ret);
281 * Returns the witness script of the HTLC output in the commitment transaction.
283 public byte[] witness_script() {
284 long ret = bindings.HTLCDescriptor_witness_script(this.ptr);
286 if (ret >= 0 && ret <= 4096) { return null; }
287 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
292 * Returns the fully signed witness required to spend the HTLC output in the commitment
295 public byte[] tx_input_witness(byte[] signature, byte[] witness_script) {
296 long ret = bindings.HTLCDescriptor_tx_input_witness(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(signature, 64)), InternalUtils.encodeUint8Array(witness_script));
298 GC.KeepAlive(signature);
299 GC.KeepAlive(witness_script);
300 if (ret >= 0 && ret <= 4096) { return null; }
301 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
306 * Derives the channel signer required to sign the HTLC input.
308 public WriteableEcdsaChannelSigner derive_channel_signer(org.ldk.structs.SignerProvider signer_provider) {
309 long ret = bindings.HTLCDescriptor_derive_channel_signer(this.ptr, signer_provider.ptr);
311 GC.KeepAlive(signer_provider);
312 if (ret >= 0 && ret <= 4096) { return null; }
313 WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret);
314 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
315 if (this != null) { this.ptrs_to.AddLast(signer_provider); };