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 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.
60 * Note that all the relevant preimages will be provided, but there may also be additional
61 * irrelevant or duplicate preimages.
63 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages);
65 * Creates a signature for a holder's commitment transaction.
68 * - with a non-revoked `commitment_tx`.
69 * - with the latest `commitment_tx` when we initiate a force-close.
71 * This may be called multiple times for the same transaction.
73 * An external signer implementation should check that the commitment has not been revoked.
75 Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx);
77 * Create a signature for the given input in a transaction spending an HTLC transaction output
78 * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
80 * A justice transaction may claim multiple outputs at the same time if timelocks are
81 * similar, but only a signature for the input at index `input` should be signed for here.
82 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
83 * to an upcoming timelock expiration.
85 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
87 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
88 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
89 * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
92 Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
94 * Create a signature for the given input in a transaction spending a commitment transaction
95 * HTLC output when our counterparty broadcasts an old state.
97 * A justice transaction may claim multiple outputs at the same time if timelocks are
98 * similar, but only a signature for the input at index `input` should be signed for here.
99 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
100 * to an upcoming timelock expiration.
102 * `amount` is the value of the output spent by this input, committed to in the BIP 143
105 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
106 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
107 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
110 * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
111 * (which is committed to in the BIP 143 signatures).
113 Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc);
115 * Computes the signature for a commitment transaction's HTLC output used as an input within
116 * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
117 * must be be computed using [`EcdsaSighashType::All`].
119 * Note that this may be called for HTLCs in the penultimate commitment transaction if a
120 * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
121 * broadcasts it before receiving the update for the latest commitment transaction.
123 * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
124 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
126 Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor);
128 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
129 * transaction, either offered or received.
131 * Such a transaction may claim multiples offered outputs at same time if we know the
132 * preimage for each when we create it, but only the input at index `input` should be
133 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
134 * needed with regards to an upcoming timelock expiration.
136 * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
139 * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
141 * `per_commitment_point` is the dynamic point corresponding to the channel state
142 * detected onchain. It has been generated by our counterparty and is used to derive
143 * channel state keys, which are then included in the witness script and committed to in the
146 Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc);
148 * Create a signature for a (proposed) closing transaction.
150 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
151 * chosen to forgo their output as dust.
153 Result_ECDSASignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
155 * Computes the signature for a commitment transaction's anchor output used as an
156 * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
158 Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input);
160 * Signs a channel announcement message with our funding key proving it comes from one of the
161 * channel participants.
163 * Channel announcements also require a signature from each node's network key. Our node
164 * signature is computed through [`NodeSigner::sign_gossip_message`].
166 * Note that if this fails or is rejected, the channel will not be publicly announced and
167 * our counterparty may (though likely will not) close the channel on us for violating the
170 * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
172 Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg);
174 private static class LDKEcdsaChannelSignerHolder { EcdsaChannelSigner held; }
175 public static EcdsaChannelSigner new_impl(EcdsaChannelSignerInterface arg, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) {
176 final LDKEcdsaChannelSignerHolder impl_holder = new LDKEcdsaChannelSignerHolder();
177 impl_holder.held = new EcdsaChannelSigner(new bindings.LDKEcdsaChannelSigner() {
178 @Override public long sign_counterparty_commitment(long commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages) {
179 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); }
180 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv, inbound_htlc_preimages, outbound_htlc_preimages);
181 Reference.reachabilityFence(arg);
182 long result = ret == null ? 0 : ret.clone_ptr();
185 @Override public long sign_holder_commitment(long commitment_tx) {
186 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); }
187 Result_ECDSASignatureNoneZ ret = arg.sign_holder_commitment(commitment_tx_hu_conv);
188 Reference.reachabilityFence(arg);
189 long result = ret == null ? 0 : ret.clone_ptr();
192 @Override public long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
193 Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_output(justice_tx, input, amount, per_commitment_key);
194 Reference.reachabilityFence(arg);
195 long result = ret == null ? 0 : ret.clone_ptr();
198 @Override public long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) {
199 org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); }
200 Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc_hu_conv);
201 Reference.reachabilityFence(arg);
202 long result = ret == null ? 0 : ret.clone_ptr();
205 @Override public long sign_holder_htlc_transaction(byte[] htlc_tx, long input, long htlc_descriptor) {
206 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); }
207 Result_ECDSASignatureNoneZ ret = arg.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor_hu_conv);
208 Reference.reachabilityFence(arg);
209 long result = ret == null ? 0 : ret.clone_ptr();
212 @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) {
213 org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); }
214 Result_ECDSASignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv);
215 Reference.reachabilityFence(arg);
216 long result = ret == null ? 0 : ret.clone_ptr();
219 @Override public long sign_closing_transaction(long closing_tx) {
220 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); }
221 Result_ECDSASignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv);
222 Reference.reachabilityFence(arg);
223 long result = ret == null ? 0 : ret.clone_ptr();
226 @Override public long sign_holder_anchor_input(byte[] anchor_tx, long input) {
227 Result_ECDSASignatureNoneZ ret = arg.sign_holder_anchor_input(anchor_tx, input);
228 Reference.reachabilityFence(arg);
229 long result = ret == null ? 0 : ret.clone_ptr();
232 @Override public long sign_channel_announcement_with_funding_key(long msg) {
233 org.ldk.structs.UnsignedChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, msg); }
234 Result_ECDSASignatureNoneZ ret = arg.sign_channel_announcement_with_funding_key(msg_hu_conv);
235 Reference.reachabilityFence(arg);
236 long result = ret == null ? 0 : ret.clone_ptr();
239 }, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys);
240 return impl_holder.held;
244 * Gets the underlying ChannelSigner.
246 public ChannelSigner get_channel_signer() {
247 ChannelSigner res = new ChannelSigner(null, bindings.LDKEcdsaChannelSigner_get_ChannelSigner(this.ptr));
248 res.ptrs_to.add(this);
253 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
255 * Note that if signing fails or is rejected, the channel will be force-closed.
257 * Policy checks should be implemented in this function, including checking the amount
258 * sent to us and checking the HTLCs.
260 * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment
261 * are provided. A validating signer should ensure that an outbound HTLC output is removed
262 * only when the matching preimage is provided and after the corresponding inbound HTLC has
263 * been removed for forwarded payments.
265 * Note that all the relevant preimages will be provided, but there may also be additional
266 * irrelevant or duplicate preimages.
268 public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages) {
269 long ret = bindings.EcdsaChannelSigner_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : 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);
270 Reference.reachabilityFence(this);
271 Reference.reachabilityFence(commitment_tx);
272 Reference.reachabilityFence(inbound_htlc_preimages);
273 Reference.reachabilityFence(outbound_htlc_preimages);
274 if (ret >= 0 && ret <= 4096) { return null; }
275 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_hu_conv = Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.constr_from_ptr(ret);
276 if (this != null) { this.ptrs_to.add(commitment_tx); };
281 * Creates a signature for a holder's commitment transaction.
283 * This will be called
284 * - with a non-revoked `commitment_tx`.
285 * - with the latest `commitment_tx` when we initiate a force-close.
287 * This may be called multiple times for the same transaction.
289 * An external signer implementation should check that the commitment has not been revoked.
291 public Result_ECDSASignatureNoneZ sign_holder_commitment(org.ldk.structs.HolderCommitmentTransaction commitment_tx) {
292 long ret = bindings.EcdsaChannelSigner_sign_holder_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr);
293 Reference.reachabilityFence(this);
294 Reference.reachabilityFence(commitment_tx);
295 if (ret >= 0 && ret <= 4096) { return null; }
296 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
297 if (this != null) { this.ptrs_to.add(commitment_tx); };
302 * Create a signature for the given input in a transaction spending an HTLC transaction output
303 * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
305 * A justice transaction may claim multiple outputs at the same time if timelocks are
306 * similar, but only a signature for the input at index `input` should be signed for here.
307 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
308 * to an upcoming timelock expiration.
310 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
312 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
313 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
314 * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
317 public Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
318 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32));
319 Reference.reachabilityFence(this);
320 Reference.reachabilityFence(justice_tx);
321 Reference.reachabilityFence(input);
322 Reference.reachabilityFence(amount);
323 Reference.reachabilityFence(per_commitment_key);
324 if (ret >= 0 && ret <= 4096) { return null; }
325 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
330 * Create a signature for the given input in a transaction spending a commitment transaction
331 * HTLC output when our counterparty broadcasts an old state.
333 * A justice transaction may claim multiple outputs at the same time if timelocks are
334 * similar, but only a signature for the input at index `input` should be signed for here.
335 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
336 * to an upcoming timelock expiration.
338 * `amount` is the value of the output spent by this input, committed to in the BIP 143
341 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
342 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
343 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
346 * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
347 * (which is committed to in the BIP 143 signatures).
349 public Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) {
350 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);
351 Reference.reachabilityFence(this);
352 Reference.reachabilityFence(justice_tx);
353 Reference.reachabilityFence(input);
354 Reference.reachabilityFence(amount);
355 Reference.reachabilityFence(per_commitment_key);
356 Reference.reachabilityFence(htlc);
357 if (ret >= 0 && ret <= 4096) { return null; }
358 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
359 if (this != null) { this.ptrs_to.add(htlc); };
364 * Computes the signature for a commitment transaction's HTLC output used as an input within
365 * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
366 * must be be computed using [`EcdsaSighashType::All`].
368 * Note that this may be called for HTLCs in the penultimate commitment transaction if a
369 * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
370 * broadcasts it before receiving the update for the latest commitment transaction.
372 * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
373 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
375 public Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, org.ldk.structs.HTLCDescriptor htlc_descriptor) {
376 long ret = bindings.EcdsaChannelSigner_sign_holder_htlc_transaction(this.ptr, htlc_tx, input, htlc_descriptor == null ? 0 : htlc_descriptor.ptr);
377 Reference.reachabilityFence(this);
378 Reference.reachabilityFence(htlc_tx);
379 Reference.reachabilityFence(input);
380 Reference.reachabilityFence(htlc_descriptor);
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_descriptor); };
388 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
389 * transaction, either offered or received.
391 * Such a transaction may claim multiples offered outputs at same time if we know the
392 * preimage for each when we create it, but only the input at index `input` should be
393 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
394 * needed with regards to an upcoming timelock expiration.
396 * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
399 * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
401 * `per_commitment_point` is the dynamic point corresponding to the channel state
402 * detected onchain. It has been generated by our counterparty and is used to derive
403 * channel state keys, which are then included in the witness script and committed to in the
406 public Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) {
407 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);
408 Reference.reachabilityFence(this);
409 Reference.reachabilityFence(htlc_tx);
410 Reference.reachabilityFence(input);
411 Reference.reachabilityFence(amount);
412 Reference.reachabilityFence(per_commitment_point);
413 Reference.reachabilityFence(htlc);
414 if (ret >= 0 && ret <= 4096) { return null; }
415 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
416 if (this != null) { this.ptrs_to.add(htlc); };
421 * Create a signature for a (proposed) closing transaction.
423 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
424 * chosen to forgo their output as dust.
426 public Result_ECDSASignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) {
427 long ret = bindings.EcdsaChannelSigner_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr);
428 Reference.reachabilityFence(this);
429 Reference.reachabilityFence(closing_tx);
430 if (ret >= 0 && ret <= 4096) { return null; }
431 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
432 if (this != null) { this.ptrs_to.add(closing_tx); };
437 * Computes the signature for a commitment transaction's anchor output used as an
438 * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
440 public Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
441 long ret = bindings.EcdsaChannelSigner_sign_holder_anchor_input(this.ptr, anchor_tx, input);
442 Reference.reachabilityFence(this);
443 Reference.reachabilityFence(anchor_tx);
444 Reference.reachabilityFence(input);
445 if (ret >= 0 && ret <= 4096) { return null; }
446 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
451 * Signs a channel announcement message with our funding key proving it comes from one of the
452 * channel participants.
454 * Channel announcements also require a signature from each node's network key. Our node
455 * signature is computed through [`NodeSigner::sign_gossip_message`].
457 * Note that if this fails or is rejected, the channel will not be publicly announced and
458 * our counterparty may (though likely will not) close the channel on us for violating the
461 * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
463 public Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(org.ldk.structs.UnsignedChannelAnnouncement msg) {
464 long ret = bindings.EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this.ptr, msg == null ? 0 : msg.ptr);
465 Reference.reachabilityFence(this);
466 Reference.reachabilityFence(msg);
467 if (ret >= 0 && ret <= 4096) { return null; }
468 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
469 if (this != null) { this.ptrs_to.add(msg); };