* disconnected using its `block_connected` and `block_disconnected` methods, starting
* from after `params.latest_hash`.
*/
- public static ChannelManager of(FeeEstimator fee_est, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, KeysInterface keys_manager, UserConfig config, ChainParameters params) {
+ public static ChannelManager of(org.ldk.structs.FeeEstimator fee_est, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Logger logger, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.UserConfig config, org.ldk.structs.ChainParameters params) {
long ret = bindings.ChannelManager_new(fee_est == null ? 0 : fee_est.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, keys_manager == null ? 0 : keys_manager.ptr, config == null ? 0 : config.ptr, params == null ? 0 : params.ptr);
Reference.reachabilityFence(fee_est);
Reference.reachabilityFence(chain_monitor);
*
* `user_channel_id` will be provided back as in
* [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
- * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
- * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
- * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
- * ignored.
+ * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
+ * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
+ * is simply copied to events and otherwise ignored.
*
* Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
* greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
*
* Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public Result__u832APIErrorZ create_channel(byte[] their_network_key, long channel_value_satoshis, long push_msat, long user_channel_id, @Nullable UserConfig override_config) {
- long ret = bindings.ChannelManager_create_channel(this.ptr, InternalUtils.check_arr_len(their_network_key, 33), channel_value_satoshis, push_msat, user_channel_id, override_config == null ? 0 : override_config.ptr);
+ public Result__u832APIErrorZ create_channel(byte[] their_network_key, long channel_value_satoshis, long push_msat, org.ldk.util.UInt128 user_channel_id, @Nullable org.ldk.structs.UserConfig override_config) {
+ long ret = bindings.ChannelManager_create_channel(this.ptr, InternalUtils.check_arr_len(their_network_key, 33), channel_value_satoshis, push_msat, user_channel_id.getLEBytes(), override_config == null ? 0 : override_config.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(their_network_key);
Reference.reachabilityFence(channel_value_satoshis);
* Value parameters are provided via the last hop in route, see documentation for RouteHop
* fields for more info.
*
- * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
- * payment), we don't do anything to stop you! We always try to ensure that if the provided
- * next hop knows the preimage to payment_hash they can claim an additional amount as
- * specified in the last hop in the route! Thus, you should probably do your own
- * payment_preimage tracking (which you should already be doing as they represent \"proof of
- * payment\") and prevent double-sends yourself.
+ * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
+ * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
+ * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
+ * [`Event::PaymentSent`]) LDK will not stop you from sending a second payment with the same
+ * [`PaymentId`].
*
- * May generate SendHTLCs message(s) event on success, which should be relayed.
+ * Thus, in order to ensure duplicate payments are not sent, you should implement your own
+ * tracking of payments, including state to indicate once a payment has completed. Because you
+ * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
+ * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
+ * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
+ *
+ * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via
+ * [`PeerManager::process_events`]).
*
* Each path may have a different return value, and PaymentSendValue may return a Vec with
* each entry matching the corresponding-index entry in the route paths, see
* PaymentSendFailure for more info.
*
* In general, a path may raise:
- * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee,
+ * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
* node public key) is specified.
* [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
* (including due to previous monitor update failure or new permanent monitor update
* newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
* must not contain multiple paths as multi-path payments require a recipient-provided
* payment_secret.
+ *
* If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
* bit set (either as required or as available). If multiple paths are present in the Route,
* we assume the invoice had the basic_mpp feature set.
*
+ * [`Event::PaymentSent`]: events::Event::PaymentSent
+ * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
+ *
* Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public Result_PaymentIdPaymentSendFailureZ send_payment(Route route, byte[] payment_hash, @Nullable byte[] payment_secret) {
- long ret = bindings.ChannelManager_send_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32));
+ public Result_NonePaymentSendFailureZ send_payment(org.ldk.structs.Route route, byte[] payment_hash, @Nullable byte[] payment_secret, byte[] payment_id) {
+ long ret = bindings.ChannelManager_send_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32), InternalUtils.check_arr_len(payment_id, 32));
Reference.reachabilityFence(this);
Reference.reachabilityFence(route);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(payment_secret);
+ Reference.reachabilityFence(payment_id);
if (ret >= 0 && ret <= 4096) { return null; }
- Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret);
+ Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret);
if (this != null) { this.ptrs_to.add(route); };
return ret_hu_conv;
}
* [`send_payment`]: [`ChannelManager::send_payment`]
* [`abandon_payment`]: [`ChannelManager::abandon_payment`]
*/
- public Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id) {
+ public Result_NonePaymentSendFailureZ retry_payment(org.ldk.structs.Route route, byte[] payment_id) {
long ret = bindings.ChannelManager_retry_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_id, 32));
Reference.reachabilityFence(this);
Reference.reachabilityFence(route);
/**
* Signals that no further retries for the given payment will occur.
*
- * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
- * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
- * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
- * pending HTLCs for this payment.
+ * After this method returns, no future calls to [`retry_payment`] for the given `payment_id`
+ * are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be
+ * generated as soon as there are no remaining pending HTLCs for this payment.
*
* Note that calling this method does *not* prevent a payment from succeeding. You must still
* wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
* determine the ultimate status of a payment.
*
+ * If an [`Event::PaymentFailed`] event is generated and we restart without this
+ * [`ChannelManager`] having been persisted, the payment may still be in the pending state
+ * upon restart. This allows further calls to [`retry_payment`] (and requiring a second call
+ * to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to
+ * [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`].
+ *
+ * [`abandon_payment`]: Self::abandon_payment
* [`retry_payment`]: Self::retry_payment
* [`Event::PaymentFailed`]: events::Event::PaymentFailed
* [`Event::PaymentSent`]: events::Event::PaymentSent
* would be able to guess -- otherwise, an intermediate node may claim the payment and it will
* never reach the recipient.
*
- * See [`send_payment`] documentation for more details on the return value of this function.
+ * See [`send_payment`] documentation for more details on the return value of this function
+ * and idempotency guarantees provided by the [`PaymentId`] key.
*
* Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
* [`send_payment`] for more information about the risks of duplicate preimage usage.
*
* Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_spontaneous_payment(Route route, @Nullable byte[] payment_preimage) {
- long ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_preimage, 32));
+ public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment(org.ldk.structs.Route route, @Nullable byte[] payment_preimage, byte[] payment_id) {
+ long ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_id, 32));
Reference.reachabilityFence(this);
Reference.reachabilityFence(route);
Reference.reachabilityFence(payment_preimage);
+ Reference.reachabilityFence(payment_id);
if (ret >= 0 && ret <= 4096) { return null; }
- Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret);
+ Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
if (this != null) { this.ptrs_to.add(route); };
return ret_hu_conv;
}
* [`ChannelUnavailable`]: APIError::ChannelUnavailable
* [`APIMisuseError`]: APIError::APIMisuseError
*/
- public Result_NoneAPIErrorZ update_channel_config(byte[] counterparty_node_id, byte[][] channel_ids, ChannelConfig config) {
+ public Result_NoneAPIErrorZ update_channel_config(byte[] counterparty_node_id, byte[][] channel_ids, org.ldk.structs.ChannelConfig config) {
long ret = bindings.ChannelManager_update_channel_config(this.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), channel_ids != null ? Arrays.stream(channel_ids).map(channel_ids_conv_8 -> InternalUtils.check_arr_len(channel_ids_conv_8, 32)).toArray(byte[][]::new) : null, config == null ? 0 : config.ptr);
Reference.reachabilityFence(this);
Reference.reachabilityFence(counterparty_node_id);
return ret_hu_conv;
}
+ /**
+ * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
+ * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
+ *
+ * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
+ * channel to a receiving node if the node lacks sufficient inbound liquidity.
+ *
+ * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
+ * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
+ * receiver's invoice route hints. These route hints will signal to LDK to generate an
+ * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
+ * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
+ *
+ * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
+ * you from forwarding more than you received.
+ *
+ * Errors if the event was not handled in time, in which case the HTLC was automatically failed
+ * backwards.
+ *
+ * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
+ * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
+ */
+ public Result_NoneAPIErrorZ forward_intercepted_htlc(byte[] intercept_id, byte[] next_hop_channel_id, byte[] _next_node_id, long amt_to_forward_msat) {
+ long ret = bindings.ChannelManager_forward_intercepted_htlc(this.ptr, InternalUtils.check_arr_len(intercept_id, 32), InternalUtils.check_arr_len(next_hop_channel_id, 32), InternalUtils.check_arr_len(_next_node_id, 33), amt_to_forward_msat);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(intercept_id);
+ Reference.reachabilityFence(next_hop_channel_id);
+ Reference.reachabilityFence(_next_node_id);
+ Reference.reachabilityFence(amt_to_forward_msat);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
+ * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
+ *
+ * Errors if the event was not handled in time, in which case the HTLC was automatically failed
+ * backwards.
+ *
+ * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
+ */
+ public Result_NoneAPIErrorZ fail_intercepted_htlc(byte[] intercept_id) {
+ long ret = bindings.ChannelManager_fail_intercepted_htlc(this.ptr, InternalUtils.check_arr_len(intercept_id, 32));
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(intercept_id);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
/**
* Processes HTLCs which are pending waiting on random forward delay.
*
/**
* Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
- * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
+ * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
* along the path (including in our own channel on which we received it).
*
* Note that in some cases around unclean shutdown, it is possible the payment may have
* already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
- * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
+ * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
* may have already been failed automatically by LDK if it was nearing its expiration time.
*
* While LDK will never claim a payment automatically on your behalf (i.e. without you calling
}
/**
- * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
+ * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
* [`MessageSendEvent`]s needed to claim the payment.
*
* Note that calling this method does *not* guarantee that the payment has been claimed. You
* provided to your [`EventHandler`] when [`process_pending_events`] is next called.
*
* Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
- * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
+ * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
* event matches your expectation. If you fail to do so and call this method, you may provide
* the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
*
- * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
+ * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable
* [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
* [`process_pending_events`]: EventsProvider::process_pending_events
* [`create_inbound_payment`]: Self::create_inbound_payment
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
- * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
*/
public void claim_funds(byte[] payment_preimage) {
bindings.ChannelManager_claim_funds(this.ptr, InternalUtils.check_arr_len(payment_preimage, 32));
* [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
* [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
*/
- public Result_NoneAPIErrorZ accept_inbound_channel(byte[] temporary_channel_id, byte[] counterparty_node_id, long user_channel_id) {
- long ret = bindings.ChannelManager_accept_inbound_channel(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), user_channel_id);
+ public Result_NoneAPIErrorZ accept_inbound_channel(byte[] temporary_channel_id, byte[] counterparty_node_id, org.ldk.util.UInt128 user_channel_id) {
+ long ret = bindings.ChannelManager_accept_inbound_channel(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), user_channel_id.getLEBytes());
Reference.reachabilityFence(this);
Reference.reachabilityFence(temporary_channel_id);
Reference.reachabilityFence(counterparty_node_id);
* [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
* [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
*/
- public Result_NoneAPIErrorZ accept_inbound_channel_from_trusted_peer_0conf(byte[] temporary_channel_id, byte[] counterparty_node_id, long user_channel_id) {
- long ret = bindings.ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), user_channel_id);
+ public Result_NoneAPIErrorZ accept_inbound_channel_from_trusted_peer_0conf(byte[] temporary_channel_id, byte[] counterparty_node_id, org.ldk.util.UInt128 user_channel_id) {
+ long ret = bindings.ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), user_channel_id.getLEBytes());
Reference.reachabilityFence(this);
Reference.reachabilityFence(temporary_channel_id);
Reference.reachabilityFence(counterparty_node_id);
* This differs from [`create_inbound_payment_for_hash`] only in that it generates the
* [`PaymentHash`] and [`PaymentPreimage`] for you.
*
- * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
- * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
+ * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
+ * will have the [`PaymentClaimable::payment_preimage`] field filled in. That should then be
* passed directly to [`claim_funds`].
*
* See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
* Errors if `min_value_msat` is greater than total bitcoin supply.
*
* [`claim_funds`]: Self::claim_funds
- * [`PaymentReceived`]: events::Event::PaymentReceived
- * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
+ * [`PaymentClaimable`]: events::Event::PaymentClaimable
+ * [`PaymentClaimable::payment_preimage`]: events::Event::PaymentClaimable::payment_preimage
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
*/
- public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
+ public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
long ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs);
Reference.reachabilityFence(this);
Reference.reachabilityFence(min_value_msat);
*
* [`create_inbound_payment`]: Self::create_inbound_payment
*/
- public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ create_inbound_payment_legacy(Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
+ public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ create_inbound_payment_legacy(org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
long ret = bindings.ChannelManager_create_inbound_payment_legacy(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs);
Reference.reachabilityFence(this);
Reference.reachabilityFence(min_value_msat);
* Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
* stored external to LDK.
*
- * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
+ * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
* payment secret fetched via this method or [`create_inbound_payment`], and which is at least
* the `min_value_msat` provided here, if one is provided.
*
*
* `min_value_msat` should be set if the invoice being generated contains a value. Any payment
* received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
- * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
+ * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
* sender \"proof-of-payment\" unless they have paid the required amount.
*
* `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
*
* Note that we use block header time to time-out pending inbound payments (with some margin
* to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
- * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
+ * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
* If you need exact expiry semantics, you should enforce them upon receipt of
- * [`PaymentReceived`].
+ * [`PaymentClaimable`].
*
* Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
* set to at least [`MIN_FINAL_CLTV_EXPIRY`].
* Errors if `min_value_msat` is greater than total bitcoin supply.
*
* [`create_inbound_payment`]: Self::create_inbound_payment
- * [`PaymentReceived`]: events::Event::PaymentReceived
+ * [`PaymentClaimable`]: events::Event::PaymentClaimable
*/
- public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
+ public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs);
Reference.reachabilityFence(this);
Reference.reachabilityFence(payment_hash);
*
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
*/
- public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash_legacy(byte[] payment_hash, Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
+ public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash_legacy(byte[] payment_hash, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) {
long ret = bindings.ChannelManager_create_inbound_payment_for_hash_legacy(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs);
Reference.reachabilityFence(this);
Reference.reachabilityFence(payment_hash);
return ret_hu_conv;
}
+ /**
+ * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
+ * used when constructing the route hints for HTLCs intended to be intercepted. See
+ * [`ChannelManager::forward_intercepted_htlc`].
+ *
+ * Note that this method is not guaranteed to return unique values, you may need to call it a few
+ * times to get a unique scid.
+ */
+ public long get_intercept_scid() {
+ long ret = bindings.ChannelManager_get_intercept_scid(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
+ /**
+ * Gets inflight HTLC information by processing pending outbound payments that are in
+ * our channels. May be used during pathfinding to account for in-use channel liquidity.
+ */
+ public InFlightHtlcs compute_inflight_htlcs() {
+ long ret = bindings.ChannelManager_compute_inflight_htlcs(this.ptr);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.InFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InFlightHtlcs(null, ret); }
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+ return ret_hu_conv;
+ }
+
/**
* Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
/**
* Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
* indicating whether persistence is necessary. Only one listener on
- * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
- * up.
+ * [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by
+ * [`get_persistable_update_future`] is guaranteed to be woken up.
*
* Note that this method is not available with the `no-std` feature.
+ *
+ * [`await_persistable_update`]: Self::await_persistable_update
+ * [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout
+ * [`get_persistable_update_future`]: Self::get_persistable_update_future
*/
public boolean await_persistable_update_timeout(long max_wait) {
boolean ret = bindings.ChannelManager_await_persistable_update_timeout(this.ptr, max_wait);
/**
* Blocks until ChannelManager needs to be persisted. Only one listener on
- * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
- * up.
+ * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by
+ * [`get_persistable_update_future`] is guaranteed to be woken up.
+ *
+ * [`await_persistable_update`]: Self::await_persistable_update
+ * [`get_persistable_update_future`]: Self::get_persistable_update_future
*/
public void await_persistable_update() {
bindings.ChannelManager_await_persistable_update(this.ptr);