+ public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ create_inbound_payment_legacy(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);
+ Reference.reachabilityFence(invoice_expiry_delta_secs);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * 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
+ * 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.
+ *
+ * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
+ * note that LDK will not stop you from registering duplicate payment hashes for inbound
+ * payments.
+ *
+ * `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
+ * 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
+ * in excess of the current time. This should roughly match the expiry time set in the invoice.
+ * After this many seconds, we will remove the inbound payment, resulting in any attempts to
+ * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
+ * invoices when no timeout is set.
+ *
+ * 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.
+ * If you need exact expiry semantics, you should enforce them upon receipt of
+ * [`PaymentReceived`].
+ *
+ * May panic if `invoice_expiry_delta_secs` is greater than one year.
+ *
+ * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
+ * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
+ *
+ * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
+ * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
+ *
+ * # Note
+ *
+ * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
+ * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
+ *
+ * Errors if `min_value_msat` is greater than total bitcoin supply.
+ *
+ * [`create_inbound_payment`]: Self::create_inbound_payment
+ * [`PaymentReceived`]: events::Event::PaymentReceived
+ */
+ public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, 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);
+ Reference.reachabilityFence(min_value_msat);
+ Reference.reachabilityFence(invoice_expiry_delta_secs);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
+ * serialized state with LDK node(s) running 0.0.103 and earlier.
+ *
+ * # Note
+ * This method is deprecated and will be removed soon.
+ *
+ * [`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) {
+ 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);
+ Reference.reachabilityFence(min_value_msat);
+ Reference.reachabilityFence(invoice_expiry_delta_secs);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
+ * previously returned from [`create_inbound_payment`].
+ *
+ * [`create_inbound_payment`]: Self::create_inbound_payment
+ */
+ public Result_PaymentPreimageAPIErrorZ get_payment_preimage(byte[] payment_hash, byte[] payment_secret) {
+ long ret = bindings.ChannelManager_get_payment_preimage(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32));
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(payment_secret);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
+ * are used when constructing the phantom invoice's route hints.
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+ public long get_phantom_scid() {
+ long ret = bindings.ChannelManager_get_phantom_scid(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
+ /**
+ * Gets route hints for use in receiving [phantom node payments].
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+ public PhantomRouteHints get_phantom_route_hints() {
+ long ret = bindings.ChannelManager_get_phantom_route_hints(this.ptr);
+ Reference.reachabilityFence(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PhantomRouteHints(null, ret); }
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;