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