1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
11 * A trait to sign Lightning channel transactions as described in
12 * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
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.
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;
29 @Override @SuppressWarnings("deprecation")
30 protected void finalize() throws Throwable {
31 if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); } super.finalize();
34 * Destroys the object, freeing associated resources. After this call, any access
35 * to this object may result in a SEGFAULT or worse.
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
42 public void destroy() {
43 if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); }
46 public static interface EcdsaChannelSignerInterface {
48 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
50 * Note that if signing fails or is rejected, the channel will be force-closed.
52 * Policy checks should be implemented in this function, including checking the amount
53 * sent to us and checking the HTLCs.
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.
59 * Note that all the relevant preimages will be provided, but there may also be additional
60 * irrelevant or duplicate preimages.
62 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] preimages);
64 * Validate the counterparty's revocation.
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.
69 Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret);
71 * Creates a signature for a holder's commitment transaction.
74 * - with a non-revoked `commitment_tx`.
75 * - with the latest `commitment_tx` when we initiate a force-close.
77 * This may be called multiple times for the same transaction.
79 * An external signer implementation should check that the commitment has not been revoked.
81 Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx);
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.
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.
91 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
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
98 Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
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.
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.
108 * `amount` is the value of the output spent by this input, committed to in the BIP 143
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
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).
119 Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc);
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`].
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.
129 * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
130 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
132 Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor);
134 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
135 * transaction, either offered or received.
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.
142 * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
145 * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
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
152 Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc);
154 * Create a signature for a (proposed) closing transaction.
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.
159 Result_ECDSASignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
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`.
164 Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input);
166 * Signs a channel announcement message with our funding key proving it comes from one of the
167 * channel participants.
169 * Channel announcements also require a signature from each node's network key. Our node
170 * signature is computed through [`NodeSigner::sign_gossip_message`].
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
176 Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg);
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
249 }, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys);
250 return impl_holder.held;
254 * Gets the underlying ChannelSigner.
256 public ChannelSigner get_channel_signer() {
257 ChannelSigner res = new ChannelSigner(null, bindings.LDKEcdsaChannelSigner_get_ChannelSigner(this.ptr));
258 res.ptrs_to.add(this);
263 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
265 * Note that if signing fails or is rejected, the channel will be force-closed.
267 * Policy checks should be implemented in this function, including checking the amount
268 * sent to us and checking the HTLCs.
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.
274 * Note that all the relevant preimages will be provided, but there may also be additional
275 * irrelevant or duplicate preimages.
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); };
289 * Validate the counterparty's revocation.
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.
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);
305 * Creates a signature for a holder's commitment transaction.
307 * This will be called
308 * - with a non-revoked `commitment_tx`.
309 * - with the latest `commitment_tx` when we initiate a force-close.
311 * This may be called multiple times for the same transaction.
313 * An external signer implementation should check that the commitment has not been revoked.
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); };
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.
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.
334 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
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
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);
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.
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.
362 * `amount` is the value of the output spent by this input, committed to in the BIP 143
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
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).
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); };
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`].
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.
396 * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All
397 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
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); };
412 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
413 * transaction, either offered or received.
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.
420 * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
423 * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
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
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); };
445 * Create a signature for a (proposed) closing transaction.
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.
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); };
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`.
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);
475 * Signs a channel announcement message with our funding key proving it comes from one of the
476 * channel participants.
478 * Channel announcements also require a signature from each node's network key. Our node
479 * signature is computed through [`NodeSigner::sign_gossip_message`].
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
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); };