Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / BaseSign.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 javax.annotation.Nullable;
8
9 /**
10  * A trait to sign lightning channel transactions as described in BOLT 3.
11  * 
12  * Signing services could be implemented on a hardware wallet. In this case,
13  * the current Sign would be a front-end on top of a communication
14  * channel connected to your secure device and lightning key material wouldn't
15  * reside on a hot server. Nevertheless, a this deployment would still need
16  * to trust the ChannelManager to avoid loss of funds as this latest component
17  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
18  * 
19  * A more secure iteration would be to use hashlock (or payment points) to pair
20  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
21  * at the price of more state and computation on the hardware wallet side. In the future,
22  * we are looking forward to design such interface.
23  * 
24  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
25  * to act, as liveness and breach reply correctness are always going to be hard requirements
26  * of LN security model, orthogonal of key management issues.
27  */
28 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
29 public class BaseSign extends CommonBase {
30         final bindings.LDKBaseSign bindings_instance;
31         BaseSign(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
32         private BaseSign(bindings.LDKBaseSign arg, ChannelPublicKeys pubkeys) {
33                 super(bindings.LDKBaseSign_new(arg, pubkeys == null ? 0 : pubkeys.ptr & ~1));
34                 this.ptrs_to.add(arg);
35                 this.bindings_instance = arg;
36         }
37         @Override @SuppressWarnings("deprecation")
38         protected void finalize() throws Throwable {
39                 if (ptr != 0) { bindings.BaseSign_free(ptr); } super.finalize();
40         }
41
42         public static interface BaseSignInterface {
43                 /**
44                  * Gets the per-commitment point for a specific commitment number
45                  * 
46                  * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
47                  */
48                 byte[] get_per_commitment_point(long idx);
49                 /**
50                  * Gets the commitment secret for a specific commitment number as part of the revocation process
51                  * 
52                  * An external signer implementation should error here if the commitment was already signed
53                  * and should refuse to sign it in the future.
54                  * 
55                  * May be called more than once for the same index.
56                  * 
57                  * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
58                  */
59                 byte[] release_commitment_secret(long idx);
60                 /**
61                  * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
62                  * 
63                  * This is required in order for the signer to make sure that releasing a commitment
64                  * secret won't leave us without a broadcastable holder transaction.
65                  * Policy checks should be implemented in this function, including checking the amount
66                  * sent to us and checking the HTLCs.
67                  */
68                 Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx);
69                 /**
70                  * Gets an arbitrary identifier describing the set of keys which are provided back to you in
71                  * some SpendableOutputDescriptor types. This should be sufficient to identify this
72                  * Sign object uniquely and lookup or re-derive its keys.
73                  */
74                 byte[] channel_keys_id();
75                 /**
76                  * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
77                  * 
78                  * Note that if signing fails or is rejected, the channel will be force-closed.
79                  * 
80                  * Policy checks should be implemented in this function, including checking the amount
81                  * sent to us and checking the HTLCs.
82                  */
83                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx);
84                 /**
85                  * Validate the counterparty's revocation.
86                  * 
87                  * This is required in order for the signer to make sure that the state has moved
88                  * forward and it is safe to sign the next counterparty commitment.
89                  */
90                 Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret);
91                 /**
92                  * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
93                  * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
94                  * latest commitment_tx when we initiate a force-close.
95                  * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
96                  * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
97                  * the latest.
98                  * This may be called multiple times for the same transaction.
99                  * 
100                  * An external signer implementation should check that the commitment has not been revoked.
101                  * 
102                  * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
103                  */
104                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx);
105                 /**
106                  * Create a signature for the given input in a transaction spending an HTLC transaction output
107                  * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
108                  * 
109                  * A justice transaction may claim multiple outputs at the same time if timelocks are
110                  * similar, but only a signature for the input at index `input` should be signed for here.
111                  * It may be called multiple times for same output(s) if a fee-bump is needed with regards
112                  * to an upcoming timelock expiration.
113                  * 
114                  * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
115                  * 
116                  * per_commitment_key is revocation secret which was provided by our counterparty when they
117                  * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
118                  * not allow the spending of any funds by itself (you need our holder revocation_secret to do
119                  * so).
120                  */
121                 Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
122                 /**
123                  * Create a signature for the given input in a transaction spending a commitment transaction
124                  * HTLC output when our counterparty broadcasts an old state.
125                  * 
126                  * A justice transaction may claim multiple outputs at the same time if timelocks are
127                  * similar, but only a signature for the input at index `input` should be signed for here.
128                  * It may be called multiple times for same output(s) if a fee-bump is needed with regards
129                  * to an upcoming timelock expiration.
130                  * 
131                  * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
132                  * 
133                  * per_commitment_key is revocation secret which was provided by our counterparty when they
134                  * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
135                  * not allow the spending of any funds by itself (you need our holder revocation_secret to do
136                  * so).
137                  * 
138                  * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
139                  * (which is committed to in the BIP 143 signatures).
140                  */
141                 Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc);
142                 /**
143                  * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
144                  * transaction, either offered or received.
145                  * 
146                  * Such a transaction may claim multiples offered outputs at same time if we know the
147                  * preimage for each when we create it, but only the input at index `input` should be
148                  * signed for here. It may be called multiple times for same output(s) if a fee-bump is
149                  * needed with regards to an upcoming timelock expiration.
150                  * 
151                  * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
152                  * outputs.
153                  * 
154                  * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
155                  * 
156                  * Per_commitment_point is the dynamic point corresponding to the channel state
157                  * detected onchain. It has been generated by our counterparty and is used to derive
158                  * channel state keys, which are then included in the witness script and committed to in the
159                  * BIP 143 signature.
160                  */
161                 Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc);
162                 /**
163                  * Create a signature for a (proposed) closing transaction.
164                  * 
165                  * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
166                  * chosen to forgo their output as dust.
167                  */
168                 Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
169                 /**
170                  * Signs a channel announcement message with our funding key, proving it comes from one
171                  * of the channel participants.
172                  * 
173                  * Note that if this fails or is rejected, the channel will not be publicly announced and
174                  * our counterparty may (though likely will not) close the channel on us for violating the
175                  * protocol.
176                  */
177                 Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg);
178                 /**
179                  * Set the counterparty static channel data, including basepoints,
180                  * counterparty_selected/holder_selected_contest_delay and funding outpoint.
181                  * This is done as soon as the funding outpoint is known.  Since these are static channel data,
182                  * they MUST NOT be allowed to change to different values once set.
183                  * 
184                  * channel_parameters.is_populated() MUST be true.
185                  * 
186                  * We bind holder_selected_contest_delay late here for API convenience.
187                  * 
188                  * Will be called before any signatures are applied.
189                  */
190                 void ready_channel(ChannelTransactionParameters channel_parameters);
191         }
192         private static class LDKBaseSignHolder { BaseSign held; }
193         public static BaseSign new_impl(BaseSignInterface arg, ChannelPublicKeys pubkeys) {
194                 final LDKBaseSignHolder impl_holder = new LDKBaseSignHolder();
195                 impl_holder.held = new BaseSign(new bindings.LDKBaseSign() {
196                         @Override public byte[] get_per_commitment_point(long idx) {
197                                 byte[] ret = arg.get_per_commitment_point(idx);
198                                 return ret;
199                         }
200                         @Override public byte[] release_commitment_secret(long idx) {
201                                 byte[] ret = arg.release_commitment_secret(idx);
202                                 return ret;
203                         }
204                         @Override public long validate_holder_commitment(long holder_tx) {
205                                 HolderCommitmentTransaction holder_tx_hu_conv = null; if (holder_tx < 0 || holder_tx > 4096) { holder_tx_hu_conv = new HolderCommitmentTransaction(null, holder_tx); }
206                                 Result_NoneNoneZ ret = arg.validate_holder_commitment(holder_tx_hu_conv);
207                                 long result = ret != null ? ret.ptr : 0;
208                                 return result;
209                         }
210                         @Override public byte[] channel_keys_id() {
211                                 byte[] ret = arg.channel_keys_id();
212                                 return ret;
213                         }
214                         @Override public long sign_counterparty_commitment(long commitment_tx) {
215                                 CommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new CommitmentTransaction(null, commitment_tx); }
216                                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv);
217                                 long result = ret != null ? ret.ptr : 0;
218                                 return result;
219                         }
220                         @Override public long validate_counterparty_revocation(long idx, byte[] secret) {
221                                 Result_NoneNoneZ ret = arg.validate_counterparty_revocation(idx, secret);
222                                 long result = ret != null ? ret.ptr : 0;
223                                 return result;
224                         }
225                         @Override public long sign_holder_commitment_and_htlcs(long commitment_tx) {
226                                 HolderCommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new HolderCommitmentTransaction(null, commitment_tx); }
227                                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv);
228                                 long result = ret != null ? ret.ptr : 0;
229                                 return result;
230                         }
231                         @Override public long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
232                                 Result_SignatureNoneZ ret = arg.sign_justice_revoked_output(justice_tx, input, amount, per_commitment_key);
233                                 long result = ret != null ? ret.ptr : 0;
234                                 return result;
235                         }
236                         @Override public long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) {
237                                 HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new HTLCOutputInCommitment(null, htlc); }
238                                 Result_SignatureNoneZ ret = arg.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc_hu_conv);
239                                 long result = ret != null ? ret.ptr : 0;
240                                 return result;
241                         }
242                         @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) {
243                                 HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new HTLCOutputInCommitment(null, htlc); }
244                                 Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv);
245                                 long result = ret != null ? ret.ptr : 0;
246                                 return result;
247                         }
248                         @Override public long sign_closing_transaction(long closing_tx) {
249                                 ClosingTransaction closing_tx_hu_conv = null; if (closing_tx < 0 || closing_tx > 4096) { closing_tx_hu_conv = new ClosingTransaction(null, closing_tx); }
250                                 Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv);
251                                 long result = ret != null ? ret.ptr : 0;
252                                 return result;
253                         }
254                         @Override public long sign_channel_announcement(long msg) {
255                                 UnsignedChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UnsignedChannelAnnouncement(null, msg); }
256                                 Result_SignatureNoneZ ret = arg.sign_channel_announcement(msg_hu_conv);
257                                 long result = ret != null ? ret.ptr : 0;
258                                 return result;
259                         }
260                         @Override public void ready_channel(long channel_parameters) {
261                                 ChannelTransactionParameters channel_parameters_hu_conv = null; if (channel_parameters < 0 || channel_parameters > 4096) { channel_parameters_hu_conv = new ChannelTransactionParameters(null, channel_parameters); }
262                                 arg.ready_channel(channel_parameters_hu_conv);
263                         }
264                 }, pubkeys);
265                 return impl_holder.held;
266         }
267         /**
268          * Gets the per-commitment point for a specific commitment number
269          * 
270          * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
271          */
272         public byte[] get_per_commitment_point(long idx) {
273                 byte[] ret = bindings.BaseSign_get_per_commitment_point(this.ptr, idx);
274                 return ret;
275         }
276
277         /**
278          * Gets the commitment secret for a specific commitment number as part of the revocation process
279          * 
280          * An external signer implementation should error here if the commitment was already signed
281          * and should refuse to sign it in the future.
282          * 
283          * May be called more than once for the same index.
284          * 
285          * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
286          */
287         public byte[] release_commitment_secret(long idx) {
288                 byte[] ret = bindings.BaseSign_release_commitment_secret(this.ptr, idx);
289                 return ret;
290         }
291
292         /**
293          * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
294          * 
295          * This is required in order for the signer to make sure that releasing a commitment
296          * secret won't leave us without a broadcastable holder transaction.
297          * Policy checks should be implemented in this function, including checking the amount
298          * sent to us and checking the HTLCs.
299          */
300         public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx) {
301                 long ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr & ~1);
302                 if (ret >= 0 && ret <= 4096) { return null; }
303                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
304                 this.ptrs_to.add(holder_tx);
305                 return ret_hu_conv;
306         }
307
308         /**
309          * Gets an arbitrary identifier describing the set of keys which are provided back to you in
310          * some SpendableOutputDescriptor types. This should be sufficient to identify this
311          * Sign object uniquely and lookup or re-derive its keys.
312          */
313         public byte[] channel_keys_id() {
314                 byte[] ret = bindings.BaseSign_channel_keys_id(this.ptr);
315                 return ret;
316         }
317
318         /**
319          * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
320          * 
321          * Note that if signing fails or is rejected, the channel will be force-closed.
322          * 
323          * Policy checks should be implemented in this function, including checking the amount
324          * sent to us and checking the HTLCs.
325          */
326         public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) {
327                 long ret = bindings.BaseSign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1);
328                 if (ret >= 0 && ret <= 4096) { return null; }
329                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret);
330                 this.ptrs_to.add(commitment_tx);
331                 return ret_hu_conv;
332         }
333
334         /**
335          * Validate the counterparty's revocation.
336          * 
337          * This is required in order for the signer to make sure that the state has moved
338          * forward and it is safe to sign the next counterparty commitment.
339          */
340         public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
341                 long ret = bindings.BaseSign_validate_counterparty_revocation(this.ptr, idx, secret);
342                 if (ret >= 0 && ret <= 4096) { return null; }
343                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
344                 return ret_hu_conv;
345         }
346
347         /**
348          * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
349          * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
350          * latest commitment_tx when we initiate a force-close.
351          * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
352          * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
353          * the latest.
354          * This may be called multiple times for the same transaction.
355          * 
356          * An external signer implementation should check that the commitment has not been revoked.
357          * 
358          * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
359          */
360         public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) {
361                 long ret = bindings.BaseSign_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1);
362                 if (ret >= 0 && ret <= 4096) { return null; }
363                 Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret);
364                 this.ptrs_to.add(commitment_tx);
365                 return ret_hu_conv;
366         }
367
368         /**
369          * Create a signature for the given input in a transaction spending an HTLC transaction output
370          * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
371          * 
372          * A justice transaction may claim multiple outputs at the same time if timelocks are
373          * similar, but only a signature for the input at index `input` should be signed for here.
374          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
375          * to an upcoming timelock expiration.
376          * 
377          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
378          * 
379          * per_commitment_key is revocation secret which was provided by our counterparty when they
380          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
381          * not allow the spending of any funds by itself (you need our holder revocation_secret to do
382          * so).
383          */
384         public Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
385                 long ret = bindings.BaseSign_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, per_commitment_key);
386                 if (ret >= 0 && ret <= 4096) { return null; }
387                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
388                 return ret_hu_conv;
389         }
390
391         /**
392          * Create a signature for the given input in a transaction spending a commitment transaction
393          * HTLC output when our counterparty broadcasts an old state.
394          * 
395          * A justice transaction may claim multiple outputs at the same time if timelocks are
396          * similar, but only a signature for the input at index `input` should be signed for here.
397          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
398          * to an upcoming timelock expiration.
399          * 
400          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
401          * 
402          * per_commitment_key is revocation secret which was provided by our counterparty when they
403          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
404          * not allow the spending of any funds by itself (you need our holder revocation_secret to do
405          * so).
406          * 
407          * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
408          * (which is committed to in the BIP 143 signatures).
409          */
410         public Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc) {
411                 long ret = bindings.BaseSign_sign_justice_revoked_htlc(this.ptr, justice_tx, input, amount, per_commitment_key, htlc == null ? 0 : htlc.ptr & ~1);
412                 if (ret >= 0 && ret <= 4096) { return null; }
413                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
414                 this.ptrs_to.add(htlc);
415                 return ret_hu_conv;
416         }
417
418         /**
419          * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
420          * transaction, either offered or received.
421          * 
422          * Such a transaction may claim multiples offered outputs at same time if we know the
423          * preimage for each when we create it, but only the input at index `input` should be
424          * signed for here. It may be called multiple times for same output(s) if a fee-bump is
425          * needed with regards to an upcoming timelock expiration.
426          * 
427          * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
428          * outputs.
429          * 
430          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
431          * 
432          * Per_commitment_point is the dynamic point corresponding to the channel state
433          * detected onchain. It has been generated by our counterparty and is used to derive
434          * channel state keys, which are then included in the witness script and committed to in the
435          * BIP 143 signature.
436          */
437         public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc) {
438                 long ret = bindings.BaseSign_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, per_commitment_point, htlc == null ? 0 : htlc.ptr & ~1);
439                 if (ret >= 0 && ret <= 4096) { return null; }
440                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
441                 this.ptrs_to.add(htlc);
442                 return ret_hu_conv;
443         }
444
445         /**
446          * Create a signature for a (proposed) closing transaction.
447          * 
448          * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
449          * chosen to forgo their output as dust.
450          */
451         public Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx) {
452                 long ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr & ~1);
453                 if (ret >= 0 && ret <= 4096) { return null; }
454                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
455                 this.ptrs_to.add(closing_tx);
456                 return ret_hu_conv;
457         }
458
459         /**
460          * Signs a channel announcement message with our funding key, proving it comes from one
461          * of the channel participants.
462          * 
463          * Note that if this fails or is rejected, the channel will not be publicly announced and
464          * our counterparty may (though likely will not) close the channel on us for violating the
465          * protocol.
466          */
467         public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) {
468                 long ret = bindings.BaseSign_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
469                 if (ret >= 0 && ret <= 4096) { return null; }
470                 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
471                 this.ptrs_to.add(msg);
472                 return ret_hu_conv;
473         }
474
475         /**
476          * Set the counterparty static channel data, including basepoints,
477          * counterparty_selected/holder_selected_contest_delay and funding outpoint.
478          * This is done as soon as the funding outpoint is known.  Since these are static channel data,
479          * they MUST NOT be allowed to change to different values once set.
480          * 
481          * channel_parameters.is_populated() MUST be true.
482          * 
483          * We bind holder_selected_contest_delay late here for API convenience.
484          * 
485          * Will be called before any signatures are applied.
486          */
487         public void ready_channel(ChannelTransactionParameters channel_parameters) {
488                 bindings.BaseSign_ready_channel(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1);
489                 this.ptrs_to.add(channel_parameters);
490         }
491
492         /**
493          * Frees any resources associated with this object given its this_arg pointer.
494          * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
495          */
496         public ChannelPublicKeys get_pubkeys() {
497                 long ret = bindings.BaseSign_get_pubkeys(this.ptr);
498                 if (ret >= 0 && ret <= 4096) { return null; }
499                 ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); }
500                 ret_hu_conv.ptrs_to.add(this);
501                 return ret_hu_conv;
502         }
503
504 }