+ /**
+ * Sends a payment along a given route.
+ *
+ * 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.
+ *
+ * May generate SendHTLCs message(s) event on success, which should be relayed.
+ *
+ * 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,
+ * 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
+ * failure).
+ * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
+ * relevant updates.
+ *
+ * Note that depending on the type of the PaymentSendFailure the HTLC may have been
+ * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
+ * different route unless you intend to pay twice!
+ *
+ * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
+ * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
+ * 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.
+ *
+ * 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 & ~1, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32));
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret);
+ this.ptrs_to.add(route);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Retries a payment along the given [`Route`].
+ *
+ * Errors returned are a superset of those returned from [`send_payment`], so see
+ * [`send_payment`] documentation for more details on errors. This method will also error if the
+ * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
+ * for the given `payment_id` cannot be found (likely due to timeout or success).
+ *
+ * [`send_payment`]: [`ChannelManager::send_payment`]
+ */
+ public Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id) {
+ long ret = bindings.ChannelManager_retry_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_id, 32));
+ if (ret >= 0 && ret <= 4096) { return null; }