7 namespace org { namespace ldk { namespace structs {
11 /** An implementation of EcdsaChannelSigner */
12 public interface EcdsaChannelSignerInterface {
13 /**Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
15 * Note that if signing fails or is rejected, the channel will be force-closed.
17 * Policy checks should be implemented in this function, including checking the amount
18 * sent to us and checking the HTLCs.
20 * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment
21 * are provided. A validating signer should ensure that an outbound HTLC output is removed
22 * only when the matching preimage is provided and after the corresponding inbound HTLC has
23 * been removed for forwarded payments.
25 * Note that all the relevant preimages will be provided, but there may also be additional
26 * irrelevant or duplicate preimages.
28 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages);
29 /**Creates a signature for a holder's commitment transaction.
32 * - with a non-revoked `commitment_tx`.
33 * - with the latest `commitment_tx` when we initiate a force-close.
35 * This may be called multiple times for the same transaction.
37 * An external signer implementation should check that the commitment has not been revoked.
39 Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx);
40 /**Create a signature for the given input in a transaction spending an HTLC transaction output
41 * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
43 * A justice transaction may claim multiple outputs at the same time if timelocks are
44 * similar, but only a signature for the input at index `input` should be signed for here.
45 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
46 * to an upcoming timelock expiration.
48 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
50 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
51 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
52 * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
55 Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
56 /**Create a signature for the given input in a transaction spending a commitment transaction
57 * HTLC output when our counterparty broadcasts an old state.
59 * A justice transaction may claim multiple outputs at the same time if timelocks are
60 * similar, but only a signature for the input at index `input` should be signed for here.
61 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
62 * to an upcoming timelock expiration.
64 * `amount` is the value of the output spent by this input, committed to in the BIP 143
67 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
68 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
69 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
72 * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
73 * (which is committed to in the BIP 143 signatures).
75 Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc);
76 /**Computes the signature for a commitment transaction's HTLC output used as an input within
77 * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
78 * must be be computed using [`EcdsaSighashType::All`].
80 * Note that this may be called for HTLCs in the penultimate commitment transaction if a
81 * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
82 * broadcasts it before receiving the update for the latest commitment transaction.
84 * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
85 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
87 Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor);
88 /**Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
89 * transaction, either offered or received.
91 * Such a transaction may claim multiples offered outputs at same time if we know the
92 * preimage for each when we create it, but only the input at index `input` should be
93 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
94 * needed with regards to an upcoming timelock expiration.
96 * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
99 * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
101 * `per_commitment_point` is the dynamic point corresponding to the channel state
102 * detected onchain. It has been generated by our counterparty and is used to derive
103 * channel state keys, which are then included in the witness script and committed to in the
106 Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc);
107 /**Create a signature for a (proposed) closing transaction.
109 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
110 * chosen to forgo their output as dust.
112 Result_ECDSASignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
113 /**Computes the signature for a commitment transaction's anchor output used as an
114 * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
116 Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input);
117 /**Signs a channel announcement message with our funding key proving it comes from one of the
118 * channel participants.
120 * Channel announcements also require a signature from each node's network key. Our node
121 * signature is computed through [`NodeSigner::sign_gossip_message`].
123 * Note that if this fails or is rejected, the channel will not be publicly announced and
124 * our counterparty may (though likely will not) close the channel on us for violating the
127 * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
129 Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg);
133 * A trait to sign Lightning channel transactions as described in
134 * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
136 * Signing services could be implemented on a hardware wallet and should implement signing
137 * policies in order to be secure. Please refer to the [VLS Policy
138 * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
139 * for an example of such policies.
141 public class EcdsaChannelSigner : CommonBase {
142 internal bindings.LDKEcdsaChannelSigner bindings_instance;
143 internal long instance_idx;
145 internal EcdsaChannelSigner(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
146 ~EcdsaChannelSigner() {
147 if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); }
150 private class LDKEcdsaChannelSignerHolder { internal EcdsaChannelSigner held; }
151 private class LDKEcdsaChannelSignerImpl : bindings.LDKEcdsaChannelSigner {
152 internal LDKEcdsaChannelSignerImpl(EcdsaChannelSignerInterface arg, LDKEcdsaChannelSignerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
153 private EcdsaChannelSignerInterface arg;
154 private LDKEcdsaChannelSignerHolder impl_holder;
155 public long sign_counterparty_commitment(long _commitment_tx, long _inbound_htlc_preimages, long _outbound_htlc_preimages) {
156 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); }
157 int _inbound_htlc_preimages_conv_8_len = InternalUtils.getArrayLength(_inbound_htlc_preimages);
158 byte[][] _inbound_htlc_preimages_conv_8_arr = new byte[_inbound_htlc_preimages_conv_8_len][];
159 for (int i = 0; i < _inbound_htlc_preimages_conv_8_len; i++) {
160 long _inbound_htlc_preimages_conv_8 = InternalUtils.getU64ArrayElem(_inbound_htlc_preimages, i);
161 byte[] _inbound_htlc_preimages_conv_8_conv = InternalUtils.decodeUint8Array(_inbound_htlc_preimages_conv_8);
162 _inbound_htlc_preimages_conv_8_arr[i] = _inbound_htlc_preimages_conv_8_conv;
164 bindings.free_buffer(_inbound_htlc_preimages);
165 int _outbound_htlc_preimages_conv_8_len = InternalUtils.getArrayLength(_outbound_htlc_preimages);
166 byte[][] _outbound_htlc_preimages_conv_8_arr = new byte[_outbound_htlc_preimages_conv_8_len][];
167 for (int i = 0; i < _outbound_htlc_preimages_conv_8_len; i++) {
168 long _outbound_htlc_preimages_conv_8 = InternalUtils.getU64ArrayElem(_outbound_htlc_preimages, i);
169 byte[] _outbound_htlc_preimages_conv_8_conv = InternalUtils.decodeUint8Array(_outbound_htlc_preimages_conv_8);
170 _outbound_htlc_preimages_conv_8_arr[i] = _outbound_htlc_preimages_conv_8_conv;
172 bindings.free_buffer(_outbound_htlc_preimages);
173 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = arg.sign_counterparty_commitment(_commitment_tx_hu_conv, _inbound_htlc_preimages_conv_8_arr, _outbound_htlc_preimages_conv_8_arr);
175 long result = ret == null ? 0 : ret.clone_ptr();
178 public long sign_holder_commitment(long _commitment_tx) {
179 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); }
180 Result_ECDSASignatureNoneZ ret = arg.sign_holder_commitment(_commitment_tx_hu_conv);
182 long result = ret == null ? 0 : ret.clone_ptr();
185 public long sign_justice_revoked_output(long _justice_tx, long _input, long _amount, long _per_commitment_key) {
186 byte[] _justice_tx_conv = InternalUtils.decodeUint8Array(_justice_tx);
187 byte[] _per_commitment_key_conv = InternalUtils.decodeUint8Array(_per_commitment_key);
188 Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_output(_justice_tx_conv, _input, _amount, _per_commitment_key_conv);
190 long result = ret == null ? 0 : ret.clone_ptr();
193 public long sign_justice_revoked_htlc(long _justice_tx, long _input, long _amount, long _per_commitment_key, long _htlc) {
194 byte[] _justice_tx_conv = InternalUtils.decodeUint8Array(_justice_tx);
195 byte[] _per_commitment_key_conv = InternalUtils.decodeUint8Array(_per_commitment_key);
196 org.ldk.structs.HTLCOutputInCommitment _htlc_hu_conv = null; if (_htlc < 0 || _htlc > 4096) { _htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, _htlc); }
197 Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_htlc(_justice_tx_conv, _input, _amount, _per_commitment_key_conv, _htlc_hu_conv);
199 long result = ret == null ? 0 : ret.clone_ptr();
202 public long sign_holder_htlc_transaction(long _htlc_tx, long _input, long _htlc_descriptor) {
203 byte[] _htlc_tx_conv = InternalUtils.decodeUint8Array(_htlc_tx);
204 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); }
205 Result_ECDSASignatureNoneZ ret = arg.sign_holder_htlc_transaction(_htlc_tx_conv, _input, _htlc_descriptor_hu_conv);
207 long result = ret == null ? 0 : ret.clone_ptr();
210 public long sign_counterparty_htlc_transaction(long _htlc_tx, long _input, long _amount, long _per_commitment_point, long _htlc) {
211 byte[] _htlc_tx_conv = InternalUtils.decodeUint8Array(_htlc_tx);
212 byte[] _per_commitment_point_conv = InternalUtils.decodeUint8Array(_per_commitment_point);
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_conv, _input, _amount, _per_commitment_point_conv, _htlc_hu_conv);
216 long result = ret == null ? 0 : ret.clone_ptr();
219 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);
223 long result = ret == null ? 0 : ret.clone_ptr();
226 public long sign_holder_anchor_input(long _anchor_tx, long _input) {
227 byte[] _anchor_tx_conv = InternalUtils.decodeUint8Array(_anchor_tx);
228 Result_ECDSASignatureNoneZ ret = arg.sign_holder_anchor_input(_anchor_tx_conv, _input);
230 long result = ret == null ? 0 : ret.clone_ptr();
233 public long sign_channel_announcement_with_funding_key(long _msg) {
234 org.ldk.structs.UnsignedChannelAnnouncement _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, _msg); }
235 Result_ECDSASignatureNoneZ ret = arg.sign_channel_announcement_with_funding_key(_msg_hu_conv);
237 long result = ret == null ? 0 : ret.clone_ptr();
242 /** Creates a new instance of EcdsaChannelSigner from a given implementation */
243 public static EcdsaChannelSigner new_impl(EcdsaChannelSignerInterface arg, ChannelSignerInterface channelSigner_impl, ChannelPublicKeys pubkeys) {
244 LDKEcdsaChannelSignerHolder impl_holder = new LDKEcdsaChannelSignerHolder();
245 LDKEcdsaChannelSignerImpl impl = new LDKEcdsaChannelSignerImpl(arg, impl_holder);
246 ChannelSigner channelSigner = ChannelSigner.new_impl(channelSigner_impl, pubkeys);
247 long[] ptr_idx = bindings.LDKEcdsaChannelSigner_new(impl, channelSigner.instance_idx, pubkeys == null ? 0 : pubkeys.clone_ptr());
249 impl_holder.held = new EcdsaChannelSigner(null, ptr_idx[0]);
250 impl_holder.held.instance_idx = ptr_idx[1];
251 impl_holder.held.bindings_instance = impl;
252 impl_holder.held.ptrs_to.AddLast(channelSigner);
253 return impl_holder.held;
257 * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
259 * Note that if signing fails or is rejected, the channel will be force-closed.
261 * Policy checks should be implemented in this function, including checking the amount
262 * sent to us and checking the HTLCs.
264 * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment
265 * are provided. A validating signer should ensure that an outbound HTLC output is removed
266 * only when the matching preimage is provided and after the corresponding inbound HTLC has
267 * been removed for forwarded payments.
269 * Note that all the relevant preimages will be provided, but there may also be additional
270 * irrelevant or duplicate preimages.
272 public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages) {
273 long ret = bindings.EcdsaChannelSigner_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(inbound_htlc_preimages, inbound_htlc_preimages_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(inbound_htlc_preimages_conv_8, 32)))), InternalUtils.encodeUint64Array(InternalUtils.mapArray(outbound_htlc_preimages, outbound_htlc_preimages_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(outbound_htlc_preimages_conv_8, 32)))));
275 GC.KeepAlive(commitment_tx);
276 GC.KeepAlive(inbound_htlc_preimages);
277 GC.KeepAlive(outbound_htlc_preimages);
278 if (ret >= 0 && ret <= 4096) { return null; }
279 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_hu_conv = Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.constr_from_ptr(ret);
280 if (this != null) { this.ptrs_to.AddLast(commitment_tx); };
285 * Creates a signature for a holder's commitment transaction.
287 * This will be called
288 * - with a non-revoked `commitment_tx`.
289 * - with the latest `commitment_tx` when we initiate a force-close.
291 * This may be called multiple times for the same transaction.
293 * An external signer implementation should check that the commitment has not been revoked.
295 public Result_ECDSASignatureNoneZ sign_holder_commitment(org.ldk.structs.HolderCommitmentTransaction commitment_tx) {
296 long ret = bindings.EcdsaChannelSigner_sign_holder_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr);
298 GC.KeepAlive(commitment_tx);
299 if (ret >= 0 && ret <= 4096) { return null; }
300 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
301 if (this != null) { this.ptrs_to.AddLast(commitment_tx); };
306 * Create a signature for the given input in a transaction spending an HTLC transaction output
307 * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
309 * A justice transaction may claim multiple outputs at the same time if timelocks are
310 * similar, but only a signature for the input at index `input` should be signed for here.
311 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
312 * to an upcoming timelock expiration.
314 * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
316 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
317 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
318 * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
321 public Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
322 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_output(this.ptr, InternalUtils.encodeUint8Array(justice_tx), input, amount, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_key, 32)));
324 GC.KeepAlive(justice_tx);
326 GC.KeepAlive(amount);
327 GC.KeepAlive(per_commitment_key);
328 if (ret >= 0 && ret <= 4096) { return null; }
329 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
334 * Create a signature for the given input in a transaction spending a commitment transaction
335 * HTLC output when our counterparty broadcasts an old state.
337 * A justice transaction may claim multiple outputs at the same time if timelocks are
338 * similar, but only a signature for the input at index `input` should be signed for here.
339 * It may be called multiple times for same output(s) if a fee-bump is needed with regards
340 * to an upcoming timelock expiration.
342 * `amount` is the value of the output spent by this input, committed to in the BIP 143
345 * `per_commitment_key` is revocation secret which was provided by our counterparty when they
346 * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
347 * not allow the spending of any funds by itself (you need our holder revocation_secret to do
350 * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
351 * (which is committed to in the BIP 143 signatures).
353 public Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) {
354 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_htlc(this.ptr, InternalUtils.encodeUint8Array(justice_tx), input, amount, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_key, 32)), htlc == null ? 0 : htlc.ptr);
356 GC.KeepAlive(justice_tx);
358 GC.KeepAlive(amount);
359 GC.KeepAlive(per_commitment_key);
361 if (ret >= 0 && ret <= 4096) { return null; }
362 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
363 if (this != null) { this.ptrs_to.AddLast(htlc); };
368 * Computes the signature for a commitment transaction's HTLC output used as an input within
369 * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
370 * must be be computed using [`EcdsaSighashType::All`].
372 * Note that this may be called for HTLCs in the penultimate commitment transaction if a
373 * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
374 * broadcasts it before receiving the update for the latest commitment transaction.
376 * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
377 * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
379 public Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, org.ldk.structs.HTLCDescriptor htlc_descriptor) {
380 long ret = bindings.EcdsaChannelSigner_sign_holder_htlc_transaction(this.ptr, InternalUtils.encodeUint8Array(htlc_tx), input, htlc_descriptor == null ? 0 : htlc_descriptor.ptr);
382 GC.KeepAlive(htlc_tx);
384 GC.KeepAlive(htlc_descriptor);
385 if (ret >= 0 && ret <= 4096) { return null; }
386 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
387 if (this != null) { this.ptrs_to.AddLast(htlc_descriptor); };
392 * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
393 * transaction, either offered or received.
395 * Such a transaction may claim multiples offered outputs at same time if we know the
396 * preimage for each when we create it, but only the input at index `input` should be
397 * signed for here. It may be called multiple times for same output(s) if a fee-bump is
398 * needed with regards to an upcoming timelock expiration.
400 * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
403 * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
405 * `per_commitment_point` is the dynamic point corresponding to the channel state
406 * detected onchain. It has been generated by our counterparty and is used to derive
407 * channel state keys, which are then included in the witness script and committed to in the
410 public Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) {
411 long ret = bindings.EcdsaChannelSigner_sign_counterparty_htlc_transaction(this.ptr, InternalUtils.encodeUint8Array(htlc_tx), input, amount, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_point, 33)), htlc == null ? 0 : htlc.ptr);
413 GC.KeepAlive(htlc_tx);
415 GC.KeepAlive(amount);
416 GC.KeepAlive(per_commitment_point);
418 if (ret >= 0 && ret <= 4096) { return null; }
419 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
420 if (this != null) { this.ptrs_to.AddLast(htlc); };
425 * Create a signature for a (proposed) closing transaction.
427 * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
428 * chosen to forgo their output as dust.
430 public Result_ECDSASignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) {
431 long ret = bindings.EcdsaChannelSigner_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr);
433 GC.KeepAlive(closing_tx);
434 if (ret >= 0 && ret <= 4096) { return null; }
435 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
436 if (this != null) { this.ptrs_to.AddLast(closing_tx); };
441 * Computes the signature for a commitment transaction's anchor output used as an
442 * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
444 public Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
445 long ret = bindings.EcdsaChannelSigner_sign_holder_anchor_input(this.ptr, InternalUtils.encodeUint8Array(anchor_tx), input);
447 GC.KeepAlive(anchor_tx);
449 if (ret >= 0 && ret <= 4096) { return null; }
450 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
455 * Signs a channel announcement message with our funding key proving it comes from one of the
456 * channel participants.
458 * Channel announcements also require a signature from each node's network key. Our node
459 * signature is computed through [`NodeSigner::sign_gossip_message`].
461 * Note that if this fails or is rejected, the channel will not be publicly announced and
462 * our counterparty may (though likely will not) close the channel on us for violating the
465 * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
467 public Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(org.ldk.structs.UnsignedChannelAnnouncement msg) {
468 long ret = bindings.EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this.ptr, msg == null ? 0 : msg.ptr);
471 if (ret >= 0 && ret <= 4096) { return null; }
472 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
473 if (this != null) { this.ptrs_to.AddLast(msg); };