[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / EcdsaChannelSigner.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * A trait to sign Lightning channel transactions as described in
10  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
11  * 
12  * Signing services could be implemented on a hardware wallet and should implement signing
13  * policies in order to be secure. Please refer to the [VLS Policy
14  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
15  * for an example of such policies.
16  */
17 public class EcdsaChannelSigner : CommonBase {
18         internal readonly bindings.LDKEcdsaChannelSigner bindings_instance;
19         internal EcdsaChannelSigner(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
20         private EcdsaChannelSigner(bindings.LDKEcdsaChannelSigner arg, bindings.LDKChannelSigner ChannelSigner, ChannelPublicKeys pubkeys) : base(bindings.LDKEcdsaChannelSigner_new(arg, ChannelSigner, pubkeys == null ? 0 : pubkeys.clone_ptr())) {
21                 this.ptrs_to.AddLast(arg);
22                 this.ptrs_to.AddLast(ChannelSigner);
23                 this.bindings_instance = arg;
24         }
25         ~EcdsaChannelSigner() {
26                 if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); }
27         }
28
29         public interface EcdsaChannelSignerInterface {
30                 /**
31                  * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
32                  * 
33                  * Note that if signing fails or is rejected, the channel will be force-closed.
34                  * 
35                  * Policy checks should be implemented in this function, including checking the amount
36                  * sent to us and checking the HTLCs.
37                  * 
38                  * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
39                  * A validating signer should ensure that an HTLC output is removed only when the matching
40                  * preimage is provided, or when the value to holder is restored.
41                  * 
42                  * Note that all the relevant preimages will be provided, but there may also be additional
43                  * irrelevant or duplicate preimages.
44                  */
45                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction _commitment_tx, byte[][] _preimages);
46                 /**
47                  * Validate the counterparty's revocation.
48                  * 
49                  * This is required in order for the signer to make sure that the state has moved
50                  * forward and it is safe to sign the next counterparty commitment.
51                  */
52                 Result_NoneNoneZ validate_counterparty_revocation(long _idx, byte[] _secret);
53                 /**
54                  * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
55                  * 
56                  * This will be called
57                  * - with a non-revoked `commitment_tx`.
58                  * - with the latest `commitment_tx` when we initiate a force-close.
59                  * - with the previous `commitment_tx`, just to get claiming HTLC
60                  * signatures, if we are reacting to a [`ChannelMonitor`]
61                  * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
62                  * that decided to broadcast before it had been updated to the latest `commitment_tx`.
63                  * 
64                  * This may be called multiple times for the same transaction.
65                  * 
66                  * An external signer implementation should check that the commitment has not been revoked.
67                  * 
68                  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
69                  */
70                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction _commitment_tx);
71                 /**
72                  * Create a signature for the given input in a transaction spending an HTLC transaction output
73                  * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
74                  * 
75                  * A justice transaction may claim multiple outputs at the same time if timelocks are
76                  * similar, but only a signature for the input at index `input` should be signed for here.
77                  * It may be called multiple times for same output(s) if a fee-bump is needed with regards
78                  * to an upcoming timelock expiration.
79                  * 
80                  * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
81                  * 
82                  * `per_commitment_key` is revocation secret which was provided by our counterparty when they
83                  * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
84                  * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
85                  * so).
86                  */
87                 Result_SignatureNoneZ sign_justice_revoked_output(byte[] _justice_tx, long _input, long _amount, byte[] _per_commitment_key);
88                 /**
89                  * Create a signature for the given input in a transaction spending a commitment transaction
90                  * HTLC output when our counterparty broadcasts an old state.
91                  * 
92                  * A justice transaction may claim multiple outputs at the same time if timelocks are
93                  * similar, but only a signature for the input at index `input` should be signed for here.
94                  * It may be called multiple times for same output(s) if a fee-bump is needed with regards
95                  * to an upcoming timelock expiration.
96                  * 
97                  * `amount` is the value of the output spent by this input, committed to in the BIP 143
98                  * signature.
99                  * 
100                  * `per_commitment_key` is revocation secret which was provided by our counterparty when they
101                  * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
102                  * not allow the spending of any funds by itself (you need our holder revocation_secret to do
103                  * so).
104                  * 
105                  * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
106                  * (which is committed to in the BIP 143 signatures).
107                  */
108                 Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] _justice_tx, long _input, long _amount, byte[] _per_commitment_key, HTLCOutputInCommitment _htlc);
109                 /**
110                  * Computes the signature for a commitment transaction's HTLC output used as an input within
111                  * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
112                  * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to
113                  * sign HTLC transactions from channels supporting anchor outputs after all additional
114                  * inputs/outputs have been added to the transaction.
115                  * 
116                  * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
117                  */
118                 Result_SignatureNoneZ sign_holder_htlc_transaction(byte[] _htlc_tx, long _input, HTLCDescriptor _htlc_descriptor);
119                 /**
120                  * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
121                  * transaction, either offered or received.
122                  * 
123                  * Such a transaction may claim multiples offered outputs at same time if we know the
124                  * preimage for each when we create it, but only the input at index `input` should be
125                  * signed for here. It may be called multiple times for same output(s) if a fee-bump is
126                  * needed with regards to an upcoming timelock expiration.
127                  * 
128                  * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
129                  * outputs.
130                  * 
131                  * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
132                  * 
133                  * `per_commitment_point` is the dynamic point corresponding to the channel state
134                  * detected onchain. It has been generated by our counterparty and is used to derive
135                  * channel state keys, which are then included in the witness script and committed to in the
136                  * BIP 143 signature.
137                  */
138                 Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] _htlc_tx, long _input, long _amount, byte[] _per_commitment_point, HTLCOutputInCommitment _htlc);
139                 /**
140                  * Create a signature for a (proposed) closing transaction.
141                  * 
142                  * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
143                  * chosen to forgo their output as dust.
144                  */
145                 Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction _closing_tx);
146                 /**
147                  * Computes the signature for a commitment transaction's anchor output used as an
148                  * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
149                  */
150                 Result_SignatureNoneZ sign_holder_anchor_input(byte[] _anchor_tx, long _input);
151                 /**
152                  * Signs a channel announcement message with our funding key proving it comes from one of the
153                  * channel participants.
154                  * 
155                  * Channel announcements also require a signature from each node's network key. Our node
156                  * signature is computed through [`NodeSigner::sign_gossip_message`].
157                  * 
158                  * Note that if this fails or is rejected, the channel will not be publicly announced and
159                  * our counterparty may (though likely will not) close the channel on us for violating the
160                  * protocol.
161                  */
162                 Result_SignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement _msg);
163         }
164         private class LDKEcdsaChannelSignerHolder { internal EcdsaChannelSigner held; }
165         private class LDKEcdsaChannelSignerImpl : bindings.LDKEcdsaChannelSigner {
166                 internal LDKEcdsaChannelSignerImpl(EcdsaChannelSignerInterface arg, LDKEcdsaChannelSignerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
167                 private EcdsaChannelSignerInterface arg;
168                 private LDKEcdsaChannelSignerHolder impl_holder;
169                 public long sign_counterparty_commitment(long _commitment_tx, byte[][] _preimages) {
170                         org.ldk.structs.CommitmentTransaction _commitment_tx_hu_conv = null; if (_commitment_tx < 0 || _commitment_tx > 4096) { _commitment_tx_hu_conv = new org.ldk.structs.CommitmentTransaction(null, _commitment_tx); }
171                         Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(_commitment_tx_hu_conv, _preimages);
172                                 GC.KeepAlive(arg);
173                         long result = ret == null ? 0 : ret.clone_ptr();
174                         return result;
175                 }
176                 public long validate_counterparty_revocation(long _idx, byte[] _secret) {
177                         Result_NoneNoneZ ret = arg.validate_counterparty_revocation(_idx, _secret);
178                                 GC.KeepAlive(arg);
179                         long result = ret == null ? 0 : ret.clone_ptr();
180                         return result;
181                 }
182                 public long sign_holder_commitment_and_htlcs(long _commitment_tx) {
183                         org.ldk.structs.HolderCommitmentTransaction _commitment_tx_hu_conv = null; if (_commitment_tx < 0 || _commitment_tx > 4096) { _commitment_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, _commitment_tx); }
184                         Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(_commitment_tx_hu_conv);
185                                 GC.KeepAlive(arg);
186                         long result = ret == null ? 0 : ret.clone_ptr();
187                         return result;
188                 }
189                 public long sign_justice_revoked_output(byte[] _justice_tx, long _input, long _amount, byte[] _per_commitment_key) {
190                         Result_SignatureNoneZ ret = arg.sign_justice_revoked_output(_justice_tx, _input, _amount, _per_commitment_key);
191                                 GC.KeepAlive(arg);
192                         long result = ret == null ? 0 : ret.clone_ptr();
193                         return result;
194                 }
195                 public long sign_justice_revoked_htlc(byte[] _justice_tx, long _input, long _amount, byte[] _per_commitment_key, long _htlc) {
196                         org.ldk.structs.HTLCOutputInCommitment _htlc_hu_conv = null; if (_htlc < 0 || _htlc > 4096) { _htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, _htlc); }
197                         Result_SignatureNoneZ ret = arg.sign_justice_revoked_htlc(_justice_tx, _input, _amount, _per_commitment_key, _htlc_hu_conv);
198                                 GC.KeepAlive(arg);
199                         long result = ret == null ? 0 : ret.clone_ptr();
200                         return result;
201                 }
202                 public long sign_holder_htlc_transaction(byte[] _htlc_tx, long _input, long _htlc_descriptor) {
203                         org.ldk.structs.HTLCDescriptor _htlc_descriptor_hu_conv = null; if (_htlc_descriptor < 0 || _htlc_descriptor > 4096) { _htlc_descriptor_hu_conv = new org.ldk.structs.HTLCDescriptor(null, _htlc_descriptor); }
204                         Result_SignatureNoneZ ret = arg.sign_holder_htlc_transaction(_htlc_tx, _input, _htlc_descriptor_hu_conv);
205                                 GC.KeepAlive(arg);
206                         long result = ret == null ? 0 : ret.clone_ptr();
207                         return result;
208                 }
209                 public long sign_counterparty_htlc_transaction(byte[] _htlc_tx, long _input, long _amount, byte[] _per_commitment_point, long _htlc) {
210                         org.ldk.structs.HTLCOutputInCommitment _htlc_hu_conv = null; if (_htlc < 0 || _htlc > 4096) { _htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, _htlc); }
211                         Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(_htlc_tx, _input, _amount, _per_commitment_point, _htlc_hu_conv);
212                                 GC.KeepAlive(arg);
213                         long result = ret == null ? 0 : ret.clone_ptr();
214                         return result;
215                 }
216                 public long sign_closing_transaction(long _closing_tx) {
217                         org.ldk.structs.ClosingTransaction _closing_tx_hu_conv = null; if (_closing_tx < 0 || _closing_tx > 4096) { _closing_tx_hu_conv = new org.ldk.structs.ClosingTransaction(null, _closing_tx); }
218                         Result_SignatureNoneZ ret = arg.sign_closing_transaction(_closing_tx_hu_conv);
219                                 GC.KeepAlive(arg);
220                         long result = ret == null ? 0 : ret.clone_ptr();
221                         return result;
222                 }
223                 public long sign_holder_anchor_input(byte[] _anchor_tx, long _input) {
224                         Result_SignatureNoneZ ret = arg.sign_holder_anchor_input(_anchor_tx, _input);
225                                 GC.KeepAlive(arg);
226                         long result = ret == null ? 0 : ret.clone_ptr();
227                         return result;
228                 }
229                 public long sign_channel_announcement_with_funding_key(long _msg) {
230                         org.ldk.structs.UnsignedChannelAnnouncement _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, _msg); }
231                         Result_SignatureNoneZ ret = arg.sign_channel_announcement_with_funding_key(_msg_hu_conv);
232                                 GC.KeepAlive(arg);
233                         long result = ret == null ? 0 : ret.clone_ptr();
234                         return result;
235                 }
236         }
237         public static EcdsaChannelSigner new_impl(EcdsaChannelSignerInterface arg, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) {
238                 LDKEcdsaChannelSignerHolder impl_holder = new LDKEcdsaChannelSignerHolder();
239                 impl_holder.held = new EcdsaChannelSigner(new LDKEcdsaChannelSignerImpl(arg, impl_holder), ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys);
240                 return impl_holder.held;
241         }
242
243         /**
244          * Gets the underlying ChannelSigner.
245          */
246         public ChannelSigner get_channel_signer() {
247                 ChannelSigner res = new ChannelSigner(null, bindings.LDKEcdsaChannelSigner_get_ChannelSigner(this.ptr));
248                 this.ptrs_to.AddLast(res);
249                 return res;
250         }
251
252         /**
253          * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
254          * 
255          * Note that if signing fails or is rejected, the channel will be force-closed.
256          * 
257          * Policy checks should be implemented in this function, including checking the amount
258          * sent to us and checking the HTLCs.
259          * 
260          * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
261          * A validating signer should ensure that an HTLC output is removed only when the matching
262          * preimage is provided, or when the value to holder is restored.
263          * 
264          * Note that all the relevant preimages will be provided, but there may also be additional
265          * irrelevant or duplicate preimages.
266          */
267         public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] preimages) {
268                 long ret = bindings.EcdsaChannelSigner_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr, preimages != null ? InternalUtils.mapArray(preimages, preimages_conv_8 => InternalUtils.check_arr_len(preimages_conv_8, 32)) : null);
269                 GC.KeepAlive(this);
270                 GC.KeepAlive(commitment_tx);
271                 GC.KeepAlive(preimages);
272                 if (ret >= 0 && ret <= 4096) { return null; }
273                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret);
274                 if (this != null) { this.ptrs_to.AddLast(commitment_tx); };
275                 return ret_hu_conv;
276         }
277
278         /**
279          * Validate the counterparty's revocation.
280          * 
281          * This is required in order for the signer to make sure that the state has moved
282          * forward and it is safe to sign the next counterparty commitment.
283          */
284         public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
285                 long ret = bindings.EcdsaChannelSigner_validate_counterparty_revocation(this.ptr, idx, InternalUtils.check_arr_len(secret, 32));
286                 GC.KeepAlive(this);
287                 GC.KeepAlive(idx);
288                 GC.KeepAlive(secret);
289                 if (ret >= 0 && ret <= 4096) { return null; }
290                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
291                 return ret_hu_conv;
292         }
293
294         /**
295          * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
296          * 
297          * This will be called
298          * - with a non-revoked `commitment_tx`.
299          * - with the latest `commitment_tx` when we initiate a force-close.
300          * - with the previous `commitment_tx`, just to get claiming HTLC
301          * signatures, if we are reacting to a [`ChannelMonitor`]
302          * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
303          * that decided to broadcast before it had been updated to the latest `commitment_tx`.
304          * 
305          * This may be called multiple times for the same transaction.
306          * 
307          * An external signer implementation should check that the commitment has not been revoked.
308          * 
309          * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
310          */
311         public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(org.ldk.structs.HolderCommitmentTransaction commitment_tx) {
312                 long ret = bindings.EcdsaChannelSigner_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr);
313                 GC.KeepAlive(this);
314                 GC.KeepAlive(commitment_tx);
315                 if (ret >= 0 && ret <= 4096) { return null; }
316                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret);
317                 if (this != null) { this.ptrs_to.AddLast(commitment_tx); };
318                 return ret_hu_conv;
319         }
320
321         /**
322          * Create a signature for the given input in a transaction spending an HTLC transaction output
323          * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
324          * 
325          * A justice transaction may claim multiple outputs at the same time if timelocks are
326          * similar, but only a signature for the input at index `input` should be signed for here.
327          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
328          * to an upcoming timelock expiration.
329          * 
330          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
331          * 
332          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
333          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
334          * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
335          * so).
336          */
337         public Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
338                 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32));
339                 GC.KeepAlive(this);
340                 GC.KeepAlive(justice_tx);
341                 GC.KeepAlive(input);
342                 GC.KeepAlive(amount);
343                 GC.KeepAlive(per_commitment_key);
344                 if (ret >= 0 && ret <= 4096) { return null; }
345                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
346                 return ret_hu_conv;
347         }
348
349         /**
350          * Create a signature for the given input in a transaction spending a commitment transaction
351          * HTLC output when our counterparty broadcasts an old state.
352          * 
353          * A justice transaction may claim multiple outputs at the same time if timelocks are
354          * similar, but only a signature for the input at index `input` should be signed for here.
355          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
356          * to an upcoming timelock expiration.
357          * 
358          * `amount` is the value of the output spent by this input, committed to in the BIP 143
359          * signature.
360          * 
361          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
362          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
363          * not allow the spending of any funds by itself (you need our holder revocation_secret to do
364          * so).
365          * 
366          * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
367          * (which is committed to in the BIP 143 signatures).
368          */
369         public Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) {
370                 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_htlc(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32), htlc == null ? 0 : htlc.ptr);
371                 GC.KeepAlive(this);
372                 GC.KeepAlive(justice_tx);
373                 GC.KeepAlive(input);
374                 GC.KeepAlive(amount);
375                 GC.KeepAlive(per_commitment_key);
376                 GC.KeepAlive(htlc);
377                 if (ret >= 0 && ret <= 4096) { return null; }
378                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
379                 if (this != null) { this.ptrs_to.AddLast(htlc); };
380                 return ret_hu_conv;
381         }
382
383         /**
384          * Computes the signature for a commitment transaction's HTLC output used as an input within
385          * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
386          * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to
387          * sign HTLC transactions from channels supporting anchor outputs after all additional
388          * inputs/outputs have been added to the transaction.
389          * 
390          * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
391          */
392         public Result_SignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, org.ldk.structs.HTLCDescriptor htlc_descriptor) {
393                 long ret = bindings.EcdsaChannelSigner_sign_holder_htlc_transaction(this.ptr, htlc_tx, input, htlc_descriptor == null ? 0 : htlc_descriptor.ptr);
394                 GC.KeepAlive(this);
395                 GC.KeepAlive(htlc_tx);
396                 GC.KeepAlive(input);
397                 GC.KeepAlive(htlc_descriptor);
398                 if (ret >= 0 && ret <= 4096) { return null; }
399                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
400                 if (this != null) { this.ptrs_to.AddLast(htlc_descriptor); };
401                 return ret_hu_conv;
402         }
403
404         /**
405          * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
406          * transaction, either offered or received.
407          * 
408          * Such a transaction may claim multiples offered outputs at same time if we know the
409          * preimage for each when we create it, but only the input at index `input` should be
410          * signed for here. It may be called multiple times for same output(s) if a fee-bump is
411          * needed with regards to an upcoming timelock expiration.
412          * 
413          * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
414          * outputs.
415          * 
416          * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
417          * 
418          * `per_commitment_point` is the dynamic point corresponding to the channel state
419          * detected onchain. It has been generated by our counterparty and is used to derive
420          * channel state keys, which are then included in the witness script and committed to in the
421          * BIP 143 signature.
422          */
423         public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) {
424                 long ret = bindings.EcdsaChannelSigner_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, InternalUtils.check_arr_len(per_commitment_point, 33), htlc == null ? 0 : htlc.ptr);
425                 GC.KeepAlive(this);
426                 GC.KeepAlive(htlc_tx);
427                 GC.KeepAlive(input);
428                 GC.KeepAlive(amount);
429                 GC.KeepAlive(per_commitment_point);
430                 GC.KeepAlive(htlc);
431                 if (ret >= 0 && ret <= 4096) { return null; }
432                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
433                 if (this != null) { this.ptrs_to.AddLast(htlc); };
434                 return ret_hu_conv;
435         }
436
437         /**
438          * Create a signature for a (proposed) closing transaction.
439          * 
440          * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
441          * chosen to forgo their output as dust.
442          */
443         public Result_SignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) {
444                 long ret = bindings.EcdsaChannelSigner_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr);
445                 GC.KeepAlive(this);
446                 GC.KeepAlive(closing_tx);
447                 if (ret >= 0 && ret <= 4096) { return null; }
448                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
449                 if (this != null) { this.ptrs_to.AddLast(closing_tx); };
450                 return ret_hu_conv;
451         }
452
453         /**
454          * Computes the signature for a commitment transaction's anchor output used as an
455          * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
456          */
457         public Result_SignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
458                 long ret = bindings.EcdsaChannelSigner_sign_holder_anchor_input(this.ptr, anchor_tx, input);
459                 GC.KeepAlive(this);
460                 GC.KeepAlive(anchor_tx);
461                 GC.KeepAlive(input);
462                 if (ret >= 0 && ret <= 4096) { return null; }
463                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
464                 return ret_hu_conv;
465         }
466
467         /**
468          * Signs a channel announcement message with our funding key proving it comes from one of the
469          * channel participants.
470          * 
471          * Channel announcements also require a signature from each node's network key. Our node
472          * signature is computed through [`NodeSigner::sign_gossip_message`].
473          * 
474          * Note that if this fails or is rejected, the channel will not be publicly announced and
475          * our counterparty may (though likely will not) close the channel on us for violating the
476          * protocol.
477          */
478         public Result_SignatureNoneZ sign_channel_announcement_with_funding_key(org.ldk.structs.UnsignedChannelAnnouncement msg) {
479                 long ret = bindings.EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this.ptr, msg == null ? 0 : msg.ptr);
480                 GC.KeepAlive(this);
481                 GC.KeepAlive(msg);
482                 if (ret >= 0 && ret <= 4096) { return null; }
483                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
484                 if (this != null) { this.ptrs_to.AddLast(msg); };
485                 return ret_hu_conv;
486         }
487
488 }
489 } } }