[Java] Update auto-generated bindings to LDK 0.0.118
[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.
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                  * 
77                  * This may be called multiple times for the same transaction.
78                  * 
79                  * An external signer implementation should check that the commitment has not been revoked.
80                  */
81                 Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx);
82                 /**
83                  * Create a signature for the given input in a transaction spending an HTLC transaction output
84                  * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
85                  * 
86                  * A justice transaction may claim multiple outputs at the same time if timelocks are
87                  * similar, but only a signature for the input at index `input` should be signed for here.
88                  * It may be called multiple times for same output(s) if a fee-bump is needed with regards
89                  * to an upcoming timelock expiration.
90                  * 
91                  * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
92                  * 
93                  * `per_commitment_key` is revocation secret which was provided by our counterparty when they
94                  * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
95                  * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
96                  * so).
97                  */
98                 Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
99                 /**
100                  * Create a signature for the given input in a transaction spending a commitment transaction
101                  * HTLC output when our counterparty broadcasts an old state.
102                  * 
103                  * A justice transaction may claim multiple outputs at the same time if timelocks are
104                  * similar, but only a signature for the input at index `input` should be signed for here.
105                  * It may be called multiple times for same output(s) if a fee-bump is needed with regards
106                  * to an upcoming timelock expiration.
107                  * 
108                  * `amount` is the value of the output spent by this input, committed to in the BIP 143
109                  * signature.
110                  * 
111                  * `per_commitment_key` is revocation secret which was provided by our counterparty when they
112                  * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
113                  * not allow the spending of any funds by itself (you need our holder revocation_secret to do
114                  * so).
115                  * 
116                  * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
117                  * (which is committed to in the BIP 143 signatures).
118                  */
119                 Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc);
120                 /**
121                  * Computes the signature for a commitment transaction's HTLC output used as an input within
122                  * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
123                  * must be be computed using [`EcdsaSighashType::All`].
124                  * 
125                  * Note that this may be called for HTLCs in the penultimate commitment transaction if a
126                  * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
127                  * broadcasts it before receiving the update for the latest commitment transaction.
128                  * 
129                  * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
130                  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
131                  */
132                 Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor);
133                 /**
134                  * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
135                  * transaction, either offered or received.
136                  * 
137                  * Such a transaction may claim multiples offered outputs at same time if we know the
138                  * preimage for each when we create it, but only the input at index `input` should be
139                  * signed for here. It may be called multiple times for same output(s) if a fee-bump is
140                  * needed with regards to an upcoming timelock expiration.
141                  * 
142                  * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
143                  * outputs.
144                  * 
145                  * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
146                  * 
147                  * `per_commitment_point` is the dynamic point corresponding to the channel state
148                  * detected onchain. It has been generated by our counterparty and is used to derive
149                  * channel state keys, which are then included in the witness script and committed to in the
150                  * BIP 143 signature.
151                  */
152                 Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc);
153                 /**
154                  * Create a signature for a (proposed) closing transaction.
155                  * 
156                  * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
157                  * chosen to forgo their output as dust.
158                  */
159                 Result_ECDSASignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
160                 /**
161                  * Computes the signature for a commitment transaction's anchor output used as an
162                  * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
163                  */
164                 Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input);
165                 /**
166                  * Signs a channel announcement message with our funding key proving it comes from one of the
167                  * channel participants.
168                  * 
169                  * Channel announcements also require a signature from each node's network key. Our node
170                  * signature is computed through [`NodeSigner::sign_gossip_message`].
171                  * 
172                  * Note that if this fails or is rejected, the channel will not be publicly announced and
173                  * our counterparty may (though likely will not) close the channel on us for violating the
174                  * protocol.
175                  */
176                 Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg);
177         }
178         private static class LDKEcdsaChannelSignerHolder { EcdsaChannelSigner held; }
179         public static EcdsaChannelSigner new_impl(EcdsaChannelSignerInterface arg, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) {
180                 final LDKEcdsaChannelSignerHolder impl_holder = new LDKEcdsaChannelSignerHolder();
181                 impl_holder.held = new EcdsaChannelSigner(new bindings.LDKEcdsaChannelSigner() {
182                         @Override public long sign_counterparty_commitment(long commitment_tx, byte[][] preimages) {
183                                 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); }
184                                 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv, preimages);
185                                 Reference.reachabilityFence(arg);
186                                 long result = ret == null ? 0 : ret.clone_ptr();
187                                 return result;
188                         }
189                         @Override public long validate_counterparty_revocation(long idx, byte[] secret) {
190                                 Result_NoneNoneZ ret = arg.validate_counterparty_revocation(idx, secret);
191                                 Reference.reachabilityFence(arg);
192                                 long result = ret == null ? 0 : ret.clone_ptr();
193                                 return result;
194                         }
195                         @Override public long sign_holder_commitment(long commitment_tx) {
196                                 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); }
197                                 Result_ECDSASignatureNoneZ ret = arg.sign_holder_commitment(commitment_tx_hu_conv);
198                                 Reference.reachabilityFence(arg);
199                                 long result = ret == null ? 0 : ret.clone_ptr();
200                                 return result;
201                         }
202                         @Override public long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
203                                 Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_output(justice_tx, input, amount, per_commitment_key);
204                                 Reference.reachabilityFence(arg);
205                                 long result = ret == null ? 0 : ret.clone_ptr();
206                                 return result;
207                         }
208                         @Override public long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) {
209                                 org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); }
210                                 Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc_hu_conv);
211                                 Reference.reachabilityFence(arg);
212                                 long result = ret == null ? 0 : ret.clone_ptr();
213                                 return result;
214                         }
215                         @Override public long sign_holder_htlc_transaction(byte[] htlc_tx, long input, long htlc_descriptor) {
216                                 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); }
217                                 Result_ECDSASignatureNoneZ ret = arg.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor_hu_conv);
218                                 Reference.reachabilityFence(arg);
219                                 long result = ret == null ? 0 : ret.clone_ptr();
220                                 return result;
221                         }
222                         @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) {
223                                 org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); }
224                                 Result_ECDSASignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv);
225                                 Reference.reachabilityFence(arg);
226                                 long result = ret == null ? 0 : ret.clone_ptr();
227                                 return result;
228                         }
229                         @Override public long sign_closing_transaction(long closing_tx) {
230                                 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); }
231                                 Result_ECDSASignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv);
232                                 Reference.reachabilityFence(arg);
233                                 long result = ret == null ? 0 : ret.clone_ptr();
234                                 return result;
235                         }
236                         @Override public long sign_holder_anchor_input(byte[] anchor_tx, long input) {
237                                 Result_ECDSASignatureNoneZ ret = arg.sign_holder_anchor_input(anchor_tx, input);
238                                 Reference.reachabilityFence(arg);
239                                 long result = ret == null ? 0 : ret.clone_ptr();
240                                 return result;
241                         }
242                         @Override public long sign_channel_announcement_with_funding_key(long msg) {
243                                 org.ldk.structs.UnsignedChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, msg); }
244                                 Result_ECDSASignatureNoneZ ret = arg.sign_channel_announcement_with_funding_key(msg_hu_conv);
245                                 Reference.reachabilityFence(arg);
246                                 long result = ret == null ? 0 : ret.clone_ptr();
247                                 return result;
248                         }
249                 }, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys);
250                 return impl_holder.held;
251         }
252
253         /**
254          * Gets the underlying ChannelSigner.
255          */
256         public ChannelSigner get_channel_signer() {
257                 ChannelSigner res = new ChannelSigner(null, bindings.LDKEcdsaChannelSigner_get_ChannelSigner(this.ptr));
258                 res.ptrs_to.add(this);
259                 return res;
260         }
261
262         /**
263          * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
264          * 
265          * Note that if signing fails or is rejected, the channel will be force-closed.
266          * 
267          * Policy checks should be implemented in this function, including checking the amount
268          * sent to us and checking the HTLCs.
269          * 
270          * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
271          * A validating signer should ensure that an HTLC output is removed only when the matching
272          * preimage is provided, or when the value to holder is restored.
273          * 
274          * Note that all the relevant preimages will be provided, but there may also be additional
275          * irrelevant or duplicate preimages.
276          */
277         public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] preimages) {
278                 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);
279                 Reference.reachabilityFence(this);
280                 Reference.reachabilityFence(commitment_tx);
281                 Reference.reachabilityFence(preimages);
282                 if (ret >= 0 && ret <= 4096) { return null; }
283                 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_hu_conv = Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.constr_from_ptr(ret);
284                 if (this != null) { this.ptrs_to.add(commitment_tx); };
285                 return ret_hu_conv;
286         }
287
288         /**
289          * Validate the counterparty's revocation.
290          * 
291          * This is required in order for the signer to make sure that the state has moved
292          * forward and it is safe to sign the next counterparty commitment.
293          */
294         public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
295                 long ret = bindings.EcdsaChannelSigner_validate_counterparty_revocation(this.ptr, idx, InternalUtils.check_arr_len(secret, 32));
296                 Reference.reachabilityFence(this);
297                 Reference.reachabilityFence(idx);
298                 Reference.reachabilityFence(secret);
299                 if (ret >= 0 && ret <= 4096) { return null; }
300                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
301                 return ret_hu_conv;
302         }
303
304         /**
305          * Creates a signature for a holder's commitment transaction.
306          * 
307          * This will be called
308          * - with a non-revoked `commitment_tx`.
309          * - with the latest `commitment_tx` when we initiate a force-close.
310          * 
311          * This may be called multiple times for the same transaction.
312          * 
313          * An external signer implementation should check that the commitment has not been revoked.
314          */
315         public Result_ECDSASignatureNoneZ sign_holder_commitment(org.ldk.structs.HolderCommitmentTransaction commitment_tx) {
316                 long ret = bindings.EcdsaChannelSigner_sign_holder_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr);
317                 Reference.reachabilityFence(this);
318                 Reference.reachabilityFence(commitment_tx);
319                 if (ret >= 0 && ret <= 4096) { return null; }
320                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
321                 if (this != null) { this.ptrs_to.add(commitment_tx); };
322                 return ret_hu_conv;
323         }
324
325         /**
326          * Create a signature for the given input in a transaction spending an HTLC transaction output
327          * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
328          * 
329          * A justice transaction may claim multiple outputs at the same time if timelocks are
330          * similar, but only a signature for the input at index `input` should be signed for here.
331          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
332          * to an upcoming timelock expiration.
333          * 
334          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
335          * 
336          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
337          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
338          * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
339          * so).
340          */
341         public Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
342                 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32));
343                 Reference.reachabilityFence(this);
344                 Reference.reachabilityFence(justice_tx);
345                 Reference.reachabilityFence(input);
346                 Reference.reachabilityFence(amount);
347                 Reference.reachabilityFence(per_commitment_key);
348                 if (ret >= 0 && ret <= 4096) { return null; }
349                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
350                 return ret_hu_conv;
351         }
352
353         /**
354          * Create a signature for the given input in a transaction spending a commitment transaction
355          * HTLC output when our counterparty broadcasts an old state.
356          * 
357          * A justice transaction may claim multiple outputs at the same time if timelocks are
358          * similar, but only a signature for the input at index `input` should be signed for here.
359          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
360          * to an upcoming timelock expiration.
361          * 
362          * `amount` is the value of the output spent by this input, committed to in the BIP 143
363          * signature.
364          * 
365          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
366          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
367          * not allow the spending of any funds by itself (you need our holder revocation_secret to do
368          * so).
369          * 
370          * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
371          * (which is committed to in the BIP 143 signatures).
372          */
373         public Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) {
374                 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);
375                 Reference.reachabilityFence(this);
376                 Reference.reachabilityFence(justice_tx);
377                 Reference.reachabilityFence(input);
378                 Reference.reachabilityFence(amount);
379                 Reference.reachabilityFence(per_commitment_key);
380                 Reference.reachabilityFence(htlc);
381                 if (ret >= 0 && ret <= 4096) { return null; }
382                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
383                 if (this != null) { this.ptrs_to.add(htlc); };
384                 return ret_hu_conv;
385         }
386
387         /**
388          * Computes the signature for a commitment transaction's HTLC output used as an input within
389          * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
390          * must be be computed using [`EcdsaSighashType::All`].
391          * 
392          * Note that this may be called for HTLCs in the penultimate commitment transaction if a
393          * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
394          * broadcasts it before receiving the update for the latest commitment transaction.
395          * 
396          * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
397          * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
398          */
399         public Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, org.ldk.structs.HTLCDescriptor htlc_descriptor) {
400                 long ret = bindings.EcdsaChannelSigner_sign_holder_htlc_transaction(this.ptr, htlc_tx, input, htlc_descriptor == null ? 0 : htlc_descriptor.ptr);
401                 Reference.reachabilityFence(this);
402                 Reference.reachabilityFence(htlc_tx);
403                 Reference.reachabilityFence(input);
404                 Reference.reachabilityFence(htlc_descriptor);
405                 if (ret >= 0 && ret <= 4096) { return null; }
406                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
407                 if (this != null) { this.ptrs_to.add(htlc_descriptor); };
408                 return ret_hu_conv;
409         }
410
411         /**
412          * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
413          * transaction, either offered or received.
414          * 
415          * Such a transaction may claim multiples offered outputs at same time if we know the
416          * preimage for each when we create it, but only the input at index `input` should be
417          * signed for here. It may be called multiple times for same output(s) if a fee-bump is
418          * needed with regards to an upcoming timelock expiration.
419          * 
420          * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
421          * outputs.
422          * 
423          * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
424          * 
425          * `per_commitment_point` is the dynamic point corresponding to the channel state
426          * detected onchain. It has been generated by our counterparty and is used to derive
427          * channel state keys, which are then included in the witness script and committed to in the
428          * BIP 143 signature.
429          */
430         public Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) {
431                 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);
432                 Reference.reachabilityFence(this);
433                 Reference.reachabilityFence(htlc_tx);
434                 Reference.reachabilityFence(input);
435                 Reference.reachabilityFence(amount);
436                 Reference.reachabilityFence(per_commitment_point);
437                 Reference.reachabilityFence(htlc);
438                 if (ret >= 0 && ret <= 4096) { return null; }
439                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
440                 if (this != null) { this.ptrs_to.add(htlc); };
441                 return ret_hu_conv;
442         }
443
444         /**
445          * Create a signature for a (proposed) closing transaction.
446          * 
447          * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
448          * chosen to forgo their output as dust.
449          */
450         public Result_ECDSASignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) {
451                 long ret = bindings.EcdsaChannelSigner_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr);
452                 Reference.reachabilityFence(this);
453                 Reference.reachabilityFence(closing_tx);
454                 if (ret >= 0 && ret <= 4096) { return null; }
455                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
456                 if (this != null) { this.ptrs_to.add(closing_tx); };
457                 return ret_hu_conv;
458         }
459
460         /**
461          * Computes the signature for a commitment transaction's anchor output used as an
462          * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
463          */
464         public Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
465                 long ret = bindings.EcdsaChannelSigner_sign_holder_anchor_input(this.ptr, anchor_tx, input);
466                 Reference.reachabilityFence(this);
467                 Reference.reachabilityFence(anchor_tx);
468                 Reference.reachabilityFence(input);
469                 if (ret >= 0 && ret <= 4096) { return null; }
470                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
471                 return ret_hu_conv;
472         }
473
474         /**
475          * Signs a channel announcement message with our funding key proving it comes from one of the
476          * channel participants.
477          * 
478          * Channel announcements also require a signature from each node's network key. Our node
479          * signature is computed through [`NodeSigner::sign_gossip_message`].
480          * 
481          * Note that if this fails or is rejected, the channel will not be publicly announced and
482          * our counterparty may (though likely will not) close the channel on us for violating the
483          * protocol.
484          */
485         public Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(org.ldk.structs.UnsignedChannelAnnouncement msg) {
486                 long ret = bindings.EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this.ptr, msg == null ? 0 : msg.ptr);
487                 Reference.reachabilityFence(this);
488                 Reference.reachabilityFence(msg);
489                 if (ret >= 0 && ret <= 4096) { return null; }
490                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
491                 if (this != null) { this.ptrs_to.add(msg); };
492                 return ret_hu_conv;
493         }
494
495 }