X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FUtilMethods.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FUtilMethods.java;h=156d1e93eed3c58265b116cc2969b22b38f55ff0;hb=2bb592fb946e316dba9f4d1123f8ac72ff4e9bf8;hp=b6e562537627209c4cc1c35cc369f4c5bb0dbd98;hpb=519dc944de5b88f95975140a13fbc6d77dd15a95;p=ldk-java diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index b6e56253..156d1e93 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -143,6 +143,33 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information + * about the intended next-hop for the HTLC. + * + * This does all the relevant context-free checks that LDK requires for payment relay or + * acceptance. If the payment is to be received, and the amount matches the expected amount for + * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the + * channel, will generate an [`Event::PaymentClaimable`]. + * + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable + */ + public static Result_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(org.ldk.structs.UpdateAddHTLC msg, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, int cur_height, boolean accept_mpp_keysend, boolean allow_skimmed_fees) { + long ret = bindings.peel_payment_onion(msg == null ? 0 : msg.ptr, node_signer.ptr, logger.ptr, cur_height, accept_mpp_keysend, allow_skimmed_fees); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(node_signer); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(cur_height); + Reference.reachabilityFence(accept_mpp_keysend); + Reference.reachabilityFence(allow_skimmed_fees); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PendingHTLCInfoInboundHTLCErrZ ret_hu_conv = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + return ret_hu_conv; + } + /** * Fetches the set of [`InitFeatures`] flags that are provided by or required by * [`ChannelManager`]. @@ -328,18 +355,6 @@ public class UtilMethods { return ret; } - /** - * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) - * from the base point and the per_commitment_key. This is the public equivalent of - * derive_private_key - using only public keys to derive a public key instead of private keys. - */ - public static byte[] derive_public_key(byte[] per_commitment_point, byte[] base_point) { - byte[] ret = bindings.derive_public_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_point, 33)); - Reference.reachabilityFence(per_commitment_point); - Reference.reachabilityFence(base_point); - return ret; - } - /** * Derives a per-commitment-transaction revocation key from its constituent parts. * @@ -355,33 +370,13 @@ public class UtilMethods { return ret; } - /** - * Derives a per-commitment-transaction revocation public key from its constituent parts. This is - * the public equivalend of derive_private_revocation_key - using only public keys to derive a - * public key instead of private keys. - * - * Only the cheating participant owns a valid witness to propagate a revoked - * commitment transaction, thus per_commitment_point always come from cheater - * and revocation_base_point always come from punisher, which is the broadcaster - * of the transaction spending with this key knowledge. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). - */ - public static byte[] derive_public_revocation_key(byte[] per_commitment_point, byte[] countersignatory_revocation_base_point) { - byte[] ret = bindings.derive_public_revocation_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33)); - Reference.reachabilityFence(per_commitment_point); - Reference.reachabilityFence(countersignatory_revocation_base_point); - return ret; - } - /** * A script either spendable by the revocation * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. */ - public static byte[] get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key) { - byte[] ret = bindings.get_revokeable_redeemscript(InternalUtils.check_arr_len(revocation_key, 33), contest_delay, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33)); + public static byte[] get_revokeable_redeemscript(org.ldk.structs.RevocationKey revocation_key, short contest_delay, org.ldk.structs.DelayedPaymentKey broadcaster_delayed_payment_key) { + byte[] ret = bindings.get_revokeable_redeemscript(revocation_key == null ? 0 : revocation_key.ptr, contest_delay, broadcaster_delayed_payment_key == null ? 0 : broadcaster_delayed_payment_key.ptr); Reference.reachabilityFence(revocation_key); Reference.reachabilityFence(contest_delay); Reference.reachabilityFence(broadcaster_delayed_payment_key); @@ -431,8 +426,8 @@ public class UtilMethods { * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the * commitment transaction). */ - public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, org.ldk.structs.HTLCOutputInCommitment htlc, org.ldk.structs.ChannelTypeFeatures channel_type_features, byte[] broadcaster_delayed_payment_key, byte[] revocation_key) { - byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33)); + public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, org.ldk.structs.HTLCOutputInCommitment htlc, org.ldk.structs.ChannelTypeFeatures channel_type_features, org.ldk.structs.DelayedPaymentKey broadcaster_delayed_payment_key, org.ldk.structs.RevocationKey revocation_key) { + byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, broadcaster_delayed_payment_key == null ? 0 : broadcaster_delayed_payment_key.ptr, revocation_key == null ? 0 : revocation_key.ptr); Reference.reachabilityFence(commitment_txid); Reference.reachabilityFence(feerate_per_kw); Reference.reachabilityFence(contest_delay); @@ -634,7 +629,7 @@ public class UtilMethods { * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. */ - public static Result_C2Tuple_CVec_u8ZusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_u32Z locktime) { + public static Result_C2Tuple_CVec_u8Zu64ZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_u32Z locktime) { long ret = bindings.SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr); Reference.reachabilityFence(descriptors); Reference.reachabilityFence(outputs); @@ -642,7 +637,7 @@ public class UtilMethods { Reference.reachabilityFence(feerate_sat_per_1000_weight); Reference.reachabilityFence(locktime); if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_CVec_u8ZusizeZNoneZ ret_hu_conv = Result_C2Tuple_CVec_u8ZusizeZNoneZ.constr_from_ptr(ret); + Result_C2Tuple_CVec_u8Zu64ZNoneZ ret_hu_conv = Result_C2Tuple_CVec_u8Zu64ZNoneZ.constr_from_ptr(ret); for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(descriptors_conv_27); }; }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(locktime); }; return ret_hu_conv; @@ -652,11 +647,12 @@ public class UtilMethods { * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of * `path`. * - * Returns both the node id of the peer to send the message to and the message itself. + * Returns the node id of the peer to send the message to, the message itself, and any addresses + * need to connect to the first node. * * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents contents, @Nullable org.ldk.structs.BlindedPath reply_path) { + public static Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents contents, @Nullable org.ldk.structs.BlindedPath reply_path) { long ret = bindings.create_onion_message(entropy_source.ptr, node_signer.ptr, path == null ? 0 : path.ptr, contents.ptr, reply_path == null ? 0 : reply_path.ptr); Reference.reachabilityFence(entropy_source); Reference.reachabilityFence(node_signer); @@ -664,7 +660,7 @@ public class UtilMethods { Reference.reachabilityFence(contents); Reference.reachabilityFence(reply_path); if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ ret_hu_conv = Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ.constr_from_ptr(ret); + Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ ret_hu_conv = Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); }; @@ -718,6 +714,31 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`. + * + * Errors if: + * a provided node id is invalid + * [`BlindedPayInfo`] calculation results in an integer overflow + * any unknown features are required in the provided [`ForwardTlvs`] + * + * [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs + */ + public static Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_new_for_payment(ForwardNode[] intermediate_nodes, byte[] payee_node_id, org.ldk.structs.ReceiveTlvs payee_tlvs, long htlc_maximum_msat, org.ldk.structs.EntropySource entropy_source) { + long ret = bindings.BlindedPath_new_for_payment(intermediate_nodes != null ? Arrays.stream(intermediate_nodes).mapToLong(intermediate_nodes_conv_13 -> intermediate_nodes_conv_13 == null ? 0 : intermediate_nodes_conv_13.ptr).toArray() : null, InternalUtils.check_arr_len(payee_node_id, 33), payee_tlvs == null ? 0 : payee_tlvs.ptr, htlc_maximum_msat, entropy_source.ptr); + Reference.reachabilityFence(intermediate_nodes); + Reference.reachabilityFence(payee_node_id); + Reference.reachabilityFence(payee_tlvs); + Reference.reachabilityFence(htlc_maximum_msat); + Reference.reachabilityFence(entropy_source); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ ret_hu_conv = Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.constr_from_ptr(ret); + for (ForwardNode intermediate_nodes_conv_13: intermediate_nodes) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(intermediate_nodes_conv_13); }; }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payee_tlvs); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + return ret_hu_conv; + } + /** * Read a PathFailure from a byte array, created by PathFailure_write */ @@ -763,141 +784,48 @@ public class UtilMethods { } /** - * Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`]. - * - * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. If the payment succeeds, you must ensure that a second payment - * with the same [`PaymentHash`] is never sent. - * - * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. - */ - public static Result_ThirtyTwoBytesPaymentErrorZ pay_invoice(org.ldk.structs.Bolt11Invoice invoice, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { - long ret = bindings.pay_invoice(invoice == null ? 0 : invoice.ptr, retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(retry_strategy); - Reference.reachabilityFence(channelmanager); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ThirtyTwoBytesPaymentErrorZ ret_hu_conv = Result_ThirtyTwoBytesPaymentErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - return ret_hu_conv; - } - - /** - * Pays the given [`Bolt11Invoice`] with a custom idempotency key, retrying if needed based on - * [`Retry`]. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. + * Builds the necessary parameters to pay or pre-flight probe the given zero-amount + * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or + * [`ChannelManager::send_preflight_probes`]. * - * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same - * [`PaymentHash`] has never been paid before. - * - * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token. - */ - public static Result_NonePaymentErrorZ pay_invoice_with_id(org.ldk.structs.Bolt11Invoice invoice, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { - long ret = bindings.pay_invoice_with_id(invoice == null ? 0 : invoice.ptr, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(payment_id); - Reference.reachabilityFence(retry_strategy); - Reference.reachabilityFence(channelmanager); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - return ret_hu_conv; - } - - /** - * Pays the given zero-value [`Bolt11Invoice`] using the given amount, retrying if needed based on - * [`Retry`]. + * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the + * same [`PaymentHash`] has never been paid before. * - * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. If the payment succeeds, you must ensure that a second payment - * with the same [`PaymentHash`] is never sent. + * Will always succeed unless the invoice has an amount specified, in which case + * [`payment_parameters_from_invoice`] should be used. * - * If you wish to use a different payment idempotency token, see - * [`pay_zero_value_invoice_with_id`]. + * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes */ - public static Result_ThirtyTwoBytesPaymentErrorZ pay_zero_value_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msats, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { - long ret = bindings.pay_zero_value_invoice(invoice == null ? 0 : invoice.ptr, amount_msats, retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); + public static Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msat) { + long ret = bindings.payment_parameters_from_zero_amount_invoice(invoice == null ? 0 : invoice.ptr, amount_msat); Reference.reachabilityFence(invoice); - Reference.reachabilityFence(amount_msats); - Reference.reachabilityFence(retry_strategy); - Reference.reachabilityFence(channelmanager); + Reference.reachabilityFence(amount_msat); if (ret >= 0 && ret <= 4096) { return null; } - Result_ThirtyTwoBytesPaymentErrorZ ret_hu_conv = Result_ThirtyTwoBytesPaymentErrorZ.constr_from_ptr(ret); + Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ ret_hu_conv = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; return ret_hu_conv; } /** - * Pays the given zero-value [`Bolt11Invoice`] using the given amount and custom idempotency key, - * retrying if needed based on [`Retry`]. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. + * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using + * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. * - * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same - * [`PaymentHash`] has never been paid before. + * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the + * same [`PaymentHash`] has never been paid before. * - * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the - * idempotency token. - */ - public static Result_NonePaymentErrorZ pay_zero_value_invoice_with_id(org.ldk.structs.Bolt11Invoice invoice, long amount_msats, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { - long ret = bindings.pay_zero_value_invoice_with_id(invoice == null ? 0 : invoice.ptr, amount_msats, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(amount_msats); - Reference.reachabilityFence(payment_id); - Reference.reachabilityFence(retry_strategy); - Reference.reachabilityFence(channelmanager); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - return ret_hu_conv; - } - - /** - * Sends payment probes over all paths of a route that would be used to pay the given invoice. - * - * See [`ChannelManager::send_preflight_probes`] for more information. - */ - public static Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_invoice(org.ldk.structs.Bolt11Invoice invoice, org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.Option_u64Z liquidity_limit_multiplier) { - long ret = bindings.preflight_probe_invoice(invoice == null ? 0 : invoice.ptr, channelmanager == null ? 0 : channelmanager.ptr, liquidity_limit_multiplier.ptr); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(liquidity_limit_multiplier); - if (ret >= 0 && ret <= 4096) { return null; } - Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ ret_hu_conv = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(liquidity_limit_multiplier); }; - return ret_hu_conv; - } - - /** - * Sends payment probes over all paths of a route that would be used to pay the given zero-value - * invoice using the given amount. + * Will always succeed unless the invoice has no amount specified, in which case + * [`payment_parameters_from_zero_amount_invoice`] should be used. * - * See [`ChannelManager::send_preflight_probes`] for more information. + * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes */ - public static Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_zero_value_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msat, org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.Option_u64Z liquidity_limit_multiplier) { - long ret = bindings.preflight_probe_zero_value_invoice(invoice == null ? 0 : invoice.ptr, amount_msat, channelmanager == null ? 0 : channelmanager.ptr, liquidity_limit_multiplier.ptr); + public static Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(org.ldk.structs.Bolt11Invoice invoice) { + long ret = bindings.payment_parameters_from_invoice(invoice == null ? 0 : invoice.ptr); Reference.reachabilityFence(invoice); - Reference.reachabilityFence(amount_msat); - Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(liquidity_limit_multiplier); if (ret >= 0 && ret <= 4096) { return null; } - Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ ret_hu_conv = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.constr_from_ptr(ret); + Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ ret_hu_conv = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(liquidity_limit_multiplier); }; return ret_hu_conv; }