1 package org.ldk.structs;
2 import org.ldk.impl.bindings;
3 import org.ldk.enums.*;
5 import java.util.Arrays;
6 import java.lang.ref.Reference;
7 import javax.annotation.Nullable;
9 public class UtilMethods {
11 * Gets the 128-bit integer, as 16 little-endian bytes
13 public static byte[] U128_le_bytes(org.ldk.util.UInt128 val) {
14 byte[] ret = bindings.U128_le_bytes(val.getLEBytes());
15 Reference.reachabilityFence(val);
20 * Constructs a new U128 from 16 little-endian bytes
22 public static UInt128 U128_new(byte[] le_bytes) {
23 byte[] ret = bindings.U128_new(InternalUtils.check_arr_len(le_bytes, 16));
24 Reference.reachabilityFence(le_bytes);
25 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
30 * Constructs a new COption_NoneZ containing a
32 public static COption_NoneZ COption_NoneZ_some() {
33 COption_NoneZ ret = bindings.COption_NoneZ_some();
38 * Constructs a new COption_NoneZ containing nothing
40 public static COption_NoneZ COption_NoneZ_none() {
41 COption_NoneZ ret = bindings.COption_NoneZ_none();
46 * Read a ClosureReason from a byte array, created by ClosureReason_write
48 public static Result_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(byte[] ser) {
49 long ret = bindings.ClosureReason_read(ser);
50 Reference.reachabilityFence(ser);
51 if (ret >= 0 && ret <= 4096) { return null; }
52 Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret);
57 * Read a HTLCDestination from a byte array, created by HTLCDestination_write
59 public static Result_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(byte[] ser) {
60 long ret = bindings.HTLCDestination_read(ser);
61 Reference.reachabilityFence(ser);
62 if (ret >= 0 && ret <= 4096) { return null; }
63 Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret);
68 * Read a Event from a byte array, created by Event_write
70 public static Result_COption_EventZDecodeErrorZ Event_read(byte[] ser) {
71 long ret = bindings.Event_read(ser);
72 Reference.reachabilityFence(ser);
73 if (ret >= 0 && ret <= 4096) { return null; }
74 Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret);
79 * Creates a digital signature of a message given a SecretKey, like the node's secret.
80 * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
81 * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
83 public static Result_StringErrorZ sign(byte[] msg, byte[] sk) {
84 long ret = bindings.sign(msg, InternalUtils.check_arr_len(sk, 32));
85 Reference.reachabilityFence(msg);
86 Reference.reachabilityFence(sk);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 Result_StringErrorZ ret_hu_conv = Result_StringErrorZ.constr_from_ptr(ret);
93 * Recovers the PublicKey of the signer of the message given the message and the signature.
95 public static Result_PublicKeyErrorZ recover_pk(byte[] msg, java.lang.String sig) {
96 long ret = bindings.recover_pk(msg, sig);
97 Reference.reachabilityFence(msg);
98 Reference.reachabilityFence(sig);
99 if (ret >= 0 && ret <= 4096) { return null; }
100 Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret);
105 * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
108 public static boolean verify(byte[] msg, java.lang.String sig, byte[] pk) {
109 boolean ret = bindings.verify(msg, sig, InternalUtils.check_arr_len(pk, 33));
110 Reference.reachabilityFence(msg);
111 Reference.reachabilityFence(sig);
112 Reference.reachabilityFence(pk);
117 * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
119 public static byte[] construct_invoice_preimage(byte[] hrp_bytes, UInt5[] data_without_signature) {
120 byte[] ret = bindings.construct_invoice_preimage(hrp_bytes, data_without_signature != null ? InternalUtils.convUInt5Array(data_without_signature) : null);
121 Reference.reachabilityFence(hrp_bytes);
122 Reference.reachabilityFence(data_without_signature);
127 * Read a MonitorEvent from a byte array, created by MonitorEvent_write
129 public static Result_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(byte[] ser) {
130 long ret = bindings.MonitorEvent_read(ser);
131 Reference.reachabilityFence(ser);
132 if (ret >= 0 && ret <= 4096) { return null; }
133 Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret);
138 * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
140 public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, org.ldk.structs.KeysInterface arg) {
141 long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg == null ? 0 : arg.ptr);
142 Reference.reachabilityFence(ser);
143 Reference.reachabilityFence(arg);
144 if (ret >= 0 && ret <= 4096) { return null; }
145 Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
146 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg); };
151 * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
152 * [`ChannelManager`].
154 public static NodeFeatures provided_node_features() {
155 long ret = bindings.provided_node_features();
156 if (ret >= 0 && ret <= 4096) { return null; }
157 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
158 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
163 * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
164 * [`ChannelManager`].
166 public static ChannelFeatures provided_channel_features() {
167 long ret = bindings.provided_channel_features();
168 if (ret >= 0 && ret <= 4096) { return null; }
169 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
170 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
175 * Fetches the set of [`InitFeatures`] flags which are provided by or required by
176 * [`ChannelManager`].
178 public static InitFeatures provided_init_features() {
179 long ret = bindings.provided_init_features();
180 if (ret >= 0 && ret <= 4096) { return null; }
181 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
182 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
187 * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
189 public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) {
190 long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null));
191 Reference.reachabilityFence(ser);
192 Reference.reachabilityFence(arg_keys_manager);
193 Reference.reachabilityFence(arg_fee_estimator);
194 Reference.reachabilityFence(arg_chain_monitor);
195 Reference.reachabilityFence(arg_tx_broadcaster);
196 Reference.reachabilityFence(arg_logger);
197 Reference.reachabilityFence(arg_default_config);
198 Reference.reachabilityFence(arg_channel_monitors);
199 if (ret >= 0 && ret <= 4096) { return null; }
200 Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
201 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_keys_manager); };
202 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_fee_estimator); };
203 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_chain_monitor); };
204 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_tx_broadcaster); };
205 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_logger); };
206 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_default_config); };
207 for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); }; };
212 * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
213 * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
214 * a `ChannelManager`.
216 * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
217 * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
218 * regenerate it for each new inbound payment.
220 * `current_time` is a Unix timestamp representing the current time.
222 * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
224 public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.KeysInterface keys_manager, long current_time) {
225 long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, keys_manager == null ? 0 : keys_manager.ptr, current_time);
226 Reference.reachabilityFence(keys);
227 Reference.reachabilityFence(min_value_msat);
228 Reference.reachabilityFence(invoice_expiry_delta_secs);
229 Reference.reachabilityFence(keys_manager);
230 Reference.reachabilityFence(current_time);
231 if (ret >= 0 && ret <= 4096) { return null; }
232 Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret);
233 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
234 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
239 * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
240 * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
241 * without a `ChannelManager`.
243 * See [`create`] for information on the `keys` and `current_time` parameters.
245 * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
247 public static Result_PaymentSecretNoneZ create_from_hash(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time) {
248 long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time);
249 Reference.reachabilityFence(keys);
250 Reference.reachabilityFence(min_value_msat);
251 Reference.reachabilityFence(payment_hash);
252 Reference.reachabilityFence(invoice_expiry_delta_secs);
253 Reference.reachabilityFence(current_time);
254 if (ret >= 0 && ret <= 4096) { return null; }
255 Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
256 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
261 * Gets the weight for an HTLC-Success transaction.
263 public static long htlc_success_tx_weight(boolean opt_anchors) {
264 long ret = bindings.htlc_success_tx_weight(opt_anchors);
265 Reference.reachabilityFence(opt_anchors);
270 * Gets the weight for an HTLC-Timeout transaction.
272 public static long htlc_timeout_tx_weight(boolean opt_anchors) {
273 long ret = bindings.htlc_timeout_tx_weight(opt_anchors);
274 Reference.reachabilityFence(opt_anchors);
279 * Check if a given input witness attempts to claim a HTLC.
281 public static Option_HTLCClaimZ HTLCClaim_from_witness(byte[] witness) {
282 long ret = bindings.HTLCClaim_from_witness(witness);
283 Reference.reachabilityFence(witness);
284 if (ret >= 0 && ret <= 4096) { return null; }
285 org.ldk.structs.Option_HTLCClaimZ ret_hu_conv = org.ldk.structs.Option_HTLCClaimZ.constr_from_ptr(ret);
286 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
291 * Build the commitment secret from the seed and the commitment number
293 public static byte[] build_commitment_secret(byte[] commitment_seed, long idx) {
294 byte[] ret = bindings.build_commitment_secret(InternalUtils.check_arr_len(commitment_seed, 32), idx);
295 Reference.reachabilityFence(commitment_seed);
296 Reference.reachabilityFence(idx);
301 * Build a closing transaction
303 public static byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, org.ldk.structs.OutPoint funding_outpoint) {
304 byte[] ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr);
305 Reference.reachabilityFence(to_holder_value_sat);
306 Reference.reachabilityFence(to_counterparty_value_sat);
307 Reference.reachabilityFence(to_holder_script);
308 Reference.reachabilityFence(to_counterparty_script);
309 Reference.reachabilityFence(funding_outpoint);
314 * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
315 * from the base secret and the per_commitment_point.
317 public static byte[] derive_private_key(byte[] per_commitment_point, byte[] base_secret) {
318 byte[] ret = bindings.derive_private_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_secret, 32));
319 Reference.reachabilityFence(per_commitment_point);
320 Reference.reachabilityFence(base_secret);
325 * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
326 * from the base point and the per_commitment_key. This is the public equivalent of
327 * derive_private_key - using only public keys to derive a public key instead of private keys.
329 public static byte[] derive_public_key(byte[] per_commitment_point, byte[] base_point) {
330 byte[] ret = bindings.derive_public_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_point, 33));
331 Reference.reachabilityFence(per_commitment_point);
332 Reference.reachabilityFence(base_point);
337 * Derives a per-commitment-transaction revocation key from its constituent parts.
339 * Only the cheating participant owns a valid witness to propagate a revoked
340 * commitment transaction, thus per_commitment_secret always come from cheater
341 * and revocation_base_secret always come from punisher, which is the broadcaster
342 * of the transaction spending with this key knowledge.
344 public static byte[] derive_private_revocation_key(byte[] per_commitment_secret, byte[] countersignatory_revocation_base_secret) {
345 byte[] ret = bindings.derive_private_revocation_key(InternalUtils.check_arr_len(per_commitment_secret, 32), InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32));
346 Reference.reachabilityFence(per_commitment_secret);
347 Reference.reachabilityFence(countersignatory_revocation_base_secret);
352 * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
353 * the public equivalend of derive_private_revocation_key - using only public keys to derive a
354 * public key instead of private keys.
356 * Only the cheating participant owns a valid witness to propagate a revoked
357 * commitment transaction, thus per_commitment_point always come from cheater
358 * and revocation_base_point always come from punisher, which is the broadcaster
359 * of the transaction spending with this key knowledge.
361 * Note that this is infallible iff we trust that at least one of the two input keys are randomly
362 * generated (ie our own).
364 public static byte[] derive_public_revocation_key(byte[] per_commitment_point, byte[] countersignatory_revocation_base_point) {
365 byte[] ret = bindings.derive_public_revocation_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33));
366 Reference.reachabilityFence(per_commitment_point);
367 Reference.reachabilityFence(countersignatory_revocation_base_point);
372 * A script either spendable by the revocation
373 * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
374 * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
376 public static byte[] get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key) {
377 byte[] ret = bindings.get_revokeable_redeemscript(InternalUtils.check_arr_len(revocation_key, 33), contest_delay, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33));
378 Reference.reachabilityFence(revocation_key);
379 Reference.reachabilityFence(contest_delay);
380 Reference.reachabilityFence(broadcaster_delayed_payment_key);
385 * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
386 * does not need to have its previous_output_index filled.
388 public static byte[] get_htlc_redeemscript(org.ldk.structs.HTLCOutputInCommitment htlc, boolean opt_anchors, org.ldk.structs.TxCreationKeys keys) {
389 byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr, opt_anchors, keys == null ? 0 : keys.ptr);
390 Reference.reachabilityFence(htlc);
391 Reference.reachabilityFence(opt_anchors);
392 Reference.reachabilityFence(keys);
397 * Gets the redeemscript for a funding output from the two funding public keys.
398 * Note that the order of funding public keys does not matter.
400 public static byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory) {
401 byte[] ret = bindings.make_funding_redeemscript(InternalUtils.check_arr_len(broadcaster, 33), InternalUtils.check_arr_len(countersignatory, 33));
402 Reference.reachabilityFence(broadcaster);
403 Reference.reachabilityFence(countersignatory);
408 * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
409 * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
410 * transaction which needs signing, and can be used to construct an HTLC transaction which is
411 * broadcastable given a counterparty HTLC signature.
413 * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
414 * commitment transaction).
416 public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, org.ldk.structs.HTLCOutputInCommitment htlc, boolean opt_anchors, boolean use_non_zero_fee_anchors, byte[] broadcaster_delayed_payment_key, byte[] revocation_key) {
417 byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, opt_anchors, use_non_zero_fee_anchors, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33));
418 Reference.reachabilityFence(commitment_txid);
419 Reference.reachabilityFence(feerate_per_kw);
420 Reference.reachabilityFence(contest_delay);
421 Reference.reachabilityFence(htlc);
422 Reference.reachabilityFence(opt_anchors);
423 Reference.reachabilityFence(use_non_zero_fee_anchors);
424 Reference.reachabilityFence(broadcaster_delayed_payment_key);
425 Reference.reachabilityFence(revocation_key);
430 * Returns the witness required to satisfy and spend a HTLC input.
432 * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
434 public static byte[] build_htlc_input_witness(byte[] local_sig, byte[] remote_sig, @Nullable byte[] preimage, byte[] redeem_script, boolean opt_anchors) {
435 byte[] ret = bindings.build_htlc_input_witness(InternalUtils.check_arr_len(local_sig, 64), InternalUtils.check_arr_len(remote_sig, 64), InternalUtils.check_arr_len(preimage, 32), redeem_script, opt_anchors);
436 Reference.reachabilityFence(local_sig);
437 Reference.reachabilityFence(remote_sig);
438 Reference.reachabilityFence(preimage);
439 Reference.reachabilityFence(redeem_script);
440 Reference.reachabilityFence(opt_anchors);
445 * Gets the witnessScript for the to_remote output when anchors are enabled.
447 public static byte[] get_to_countersignatory_with_anchors_redeemscript(byte[] payment_point) {
448 byte[] ret = bindings.get_to_countersignatory_with_anchors_redeemscript(InternalUtils.check_arr_len(payment_point, 33));
449 Reference.reachabilityFence(payment_point);
454 * Gets the witnessScript for an anchor output from the funding public key.
455 * The witness in the spending input must be:
456 * <BIP 143 funding_signature>
457 * After 16 blocks of confirmation, an alternative satisfying witness could be:
459 * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
461 public static byte[] get_anchor_redeemscript(byte[] funding_pubkey) {
462 byte[] ret = bindings.get_anchor_redeemscript(InternalUtils.check_arr_len(funding_pubkey, 33));
463 Reference.reachabilityFence(funding_pubkey);
468 * Returns the witness required to satisfy and spend an anchor input.
470 public static byte[] build_anchor_input_witness(byte[] funding_key, byte[] funding_sig) {
471 byte[] ret = bindings.build_anchor_input_witness(InternalUtils.check_arr_len(funding_key, 33), InternalUtils.check_arr_len(funding_sig, 64));
472 Reference.reachabilityFence(funding_key);
473 Reference.reachabilityFence(funding_sig);
478 * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
479 * shared secret first. This prevents on-chain observers from discovering how many commitment
480 * transactions occurred in a channel before it was closed.
482 * This function gets the shared secret from relevant channel public keys and can be used to
483 * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
485 public static long get_commitment_transaction_number_obscure_factor(byte[] broadcaster_payment_basepoint, byte[] countersignatory_payment_basepoint, boolean outbound_from_broadcaster) {
486 long ret = bindings.get_commitment_transaction_number_obscure_factor(InternalUtils.check_arr_len(broadcaster_payment_basepoint, 33), InternalUtils.check_arr_len(countersignatory_payment_basepoint, 33), outbound_from_broadcaster);
487 Reference.reachabilityFence(broadcaster_payment_basepoint);
488 Reference.reachabilityFence(countersignatory_payment_basepoint);
489 Reference.reachabilityFence(outbound_from_broadcaster);
494 * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
496 public static Result_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(byte[] ser) {
497 long ret = bindings.NetworkUpdate_read(ser);
498 Reference.reachabilityFence(ser);
499 if (ret >= 0 && ret <= 4096) { return null; }
500 Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
505 * Finds a route from us (payer) to the given target node (payee).
507 * If the payee provided features in their invoice, they should be provided via `params.payee`.
508 * Without this, MPP will only be used if the payee's features are available in the network graph.
510 * Private routing paths between a public node and the target may be included in `params.payee`.
512 * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
513 * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
514 * from `network_graph` will be ignored, and only those in `first_hops` will be used.
516 * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
517 * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
518 * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
522 * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
523 * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
528 * Panics if first_hops contains channels without short_channel_ids;
529 * [`ChannelManager::list_usable_channels`] will never include such channels.
531 * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
532 * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
533 * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
535 * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
537 public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, @Nullable ChannelDetails[] first_hops, org.ldk.structs.Logger logger, org.ldk.structs.Score scorer, byte[] random_seed_bytes) {
538 long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
539 Reference.reachabilityFence(our_node_pubkey);
540 Reference.reachabilityFence(route_params);
541 Reference.reachabilityFence(network_graph);
542 Reference.reachabilityFence(first_hops);
543 Reference.reachabilityFence(logger);
544 Reference.reachabilityFence(scorer);
545 Reference.reachabilityFence(random_seed_bytes);
546 if (ret >= 0 && ret <= 4096) { return null; }
547 Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
548 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
549 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
550 if (first_hops != null) { for (ChannelDetails first_hops_conv_16: first_hops) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; } };
551 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
552 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
557 * Construct a route from us (payer) to the target node (payee) via the given hops (which should
558 * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
560 * Re-uses logic from `find_route`, so the restrictions described there also apply here.
562 public static Result_RouteLightningErrorZ build_route_from_hops(byte[] our_node_pubkey, byte[][] hops, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger, byte[] random_seed_bytes) {
563 long ret = bindings.build_route_from_hops(InternalUtils.check_arr_len(our_node_pubkey, 33), hops != null ? Arrays.stream(hops).map(hops_conv_8 -> InternalUtils.check_arr_len(hops_conv_8, 33)).toArray(byte[][]::new) : null, route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
564 Reference.reachabilityFence(our_node_pubkey);
565 Reference.reachabilityFence(hops);
566 Reference.reachabilityFence(route_params);
567 Reference.reachabilityFence(network_graph);
568 Reference.reachabilityFence(logger);
569 Reference.reachabilityFence(random_seed_bytes);
570 if (ret >= 0 && ret <= 4096) { return null; }
571 Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
572 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
573 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
574 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
579 * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
580 * See [`PhantomKeysManager`] for more information on phantom node payments.
582 * `phantom_route_hints` parameter:
583 * Contains channel info for all nodes participating in the phantom invoice
584 * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
586 * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
587 * updated when a channel becomes disabled or closes
588 * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
589 * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
592 * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
593 * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
594 * If `None` is provided for `payment_hash`, then one will be created.
596 * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
597 * in excess of the current time.
599 * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
600 * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
603 * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
604 * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
605 * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
606 * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
607 * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
609 * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
611 public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network) {
612 long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network);
613 Reference.reachabilityFence(amt_msat);
614 Reference.reachabilityFence(payment_hash);
615 Reference.reachabilityFence(description);
616 Reference.reachabilityFence(invoice_expiry_delta_secs);
617 Reference.reachabilityFence(phantom_route_hints);
618 Reference.reachabilityFence(keys_manager);
619 Reference.reachabilityFence(logger);
620 Reference.reachabilityFence(network);
621 if (ret >= 0 && ret <= 4096) { return null; }
622 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
623 for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; };
624 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
625 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
630 * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
631 * See [`PhantomKeysManager`] for more information on phantom node payments.
633 * `phantom_route_hints` parameter:
634 * Contains channel info for all nodes participating in the phantom invoice
635 * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
637 * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
638 * updated when a channel becomes disabled or closes
639 * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
640 * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
643 * `description_hash` is a SHA-256 hash of the description text
645 * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
646 * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
647 * If `None` is provided for `payment_hash`, then one will be created.
649 * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
650 * in excess of the current time.
652 * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
653 * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
656 * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
657 * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
658 * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
659 * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
660 * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
662 * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
664 public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network) {
665 long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network);
666 Reference.reachabilityFence(amt_msat);
667 Reference.reachabilityFence(payment_hash);
668 Reference.reachabilityFence(invoice_expiry_delta_secs);
669 Reference.reachabilityFence(description_hash);
670 Reference.reachabilityFence(phantom_route_hints);
671 Reference.reachabilityFence(keys_manager);
672 Reference.reachabilityFence(logger);
673 Reference.reachabilityFence(network);
674 if (ret >= 0 && ret <= 4096) { return null; }
675 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
676 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
677 for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; };
678 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
679 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
684 * Utility to construct an invoice. Generally, unless you want to do something like a custom
685 * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
686 * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
687 * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
688 * that the payment secret is valid when the invoice is paid.
690 * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
691 * in excess of the current time.
693 public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, int invoice_expiry_delta_secs) {
694 long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs);
695 Reference.reachabilityFence(channelmanager);
696 Reference.reachabilityFence(keys_manager);
697 Reference.reachabilityFence(logger);
698 Reference.reachabilityFence(network);
699 Reference.reachabilityFence(amt_msat);
700 Reference.reachabilityFence(description);
701 Reference.reachabilityFence(invoice_expiry_delta_secs);
702 if (ret >= 0 && ret <= 4096) { return null; }
703 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
704 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
705 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
706 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
711 * Utility to construct an invoice. Generally, unless you want to do something like a custom
712 * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
713 * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
714 * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
715 * that the payment secret is valid when the invoice is paid.
716 * Use this variant if you want to pass the `description_hash` to the invoice.
718 * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
719 * in excess of the current time.
721 public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, int invoice_expiry_delta_secs) {
722 long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs);
723 Reference.reachabilityFence(channelmanager);
724 Reference.reachabilityFence(keys_manager);
725 Reference.reachabilityFence(logger);
726 Reference.reachabilityFence(network);
727 Reference.reachabilityFence(amt_msat);
728 Reference.reachabilityFence(description_hash);
729 Reference.reachabilityFence(invoice_expiry_delta_secs);
730 if (ret >= 0 && ret <= 4096) { return null; }
731 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
732 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
733 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
734 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
735 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
740 * See [`create_invoice_from_channelmanager_with_description_hash`]
741 * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
742 * available and the current time is supplied by the caller.
744 public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, long duration_since_epoch, int invoice_expiry_delta_secs) {
745 long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs);
746 Reference.reachabilityFence(channelmanager);
747 Reference.reachabilityFence(keys_manager);
748 Reference.reachabilityFence(logger);
749 Reference.reachabilityFence(network);
750 Reference.reachabilityFence(amt_msat);
751 Reference.reachabilityFence(description_hash);
752 Reference.reachabilityFence(duration_since_epoch);
753 Reference.reachabilityFence(invoice_expiry_delta_secs);
754 if (ret >= 0 && ret <= 4096) { return null; }
755 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
756 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
757 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
758 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
759 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
764 * See [`create_invoice_from_channelmanager`]
765 * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
766 * available and the current time is supplied by the caller.
768 public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs) {
769 long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs);
770 Reference.reachabilityFence(channelmanager);
771 Reference.reachabilityFence(keys_manager);
772 Reference.reachabilityFence(logger);
773 Reference.reachabilityFence(network);
774 Reference.reachabilityFence(amt_msat);
775 Reference.reachabilityFence(description);
776 Reference.reachabilityFence(duration_since_epoch);
777 Reference.reachabilityFence(invoice_expiry_delta_secs);
778 if (ret >= 0 && ret <= 4096) { return null; }
779 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
780 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
781 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
782 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
787 * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
788 * This version allows for providing a custom [`PaymentHash`] for the invoice.
789 * This may be useful if you're building an on-chain swap or involving another protocol where
790 * the payment hash is also involved outside the scope of lightning.
792 public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash) {
793 long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32));
794 Reference.reachabilityFence(channelmanager);
795 Reference.reachabilityFence(keys_manager);
796 Reference.reachabilityFence(logger);
797 Reference.reachabilityFence(network);
798 Reference.reachabilityFence(amt_msat);
799 Reference.reachabilityFence(description);
800 Reference.reachabilityFence(duration_since_epoch);
801 Reference.reachabilityFence(invoice_expiry_delta_secs);
802 Reference.reachabilityFence(payment_hash);
803 if (ret >= 0 && ret <= 4096) { return null; }
804 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
805 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
806 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
807 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };