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