@@ -95,28 +95,37 @@ public UserConfig get_current_default_configuration() {
9595 /**
9696 * Creates a new outbound channel to the given remote node and with the given value.
9797 *
98- * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
99- * tracking of which events correspond with which create_channel call. Note that the
100- * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
101- * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
102- * otherwise ignored.
98+ * `user_channel_id` will be provided back as in
99+ * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
100+ * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
101+ * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
102+ * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
103+ * ignored.
103104 *
104- * If successful, will generate a SendOpenChannel message event, so you should probably poll
105- * PeerManager::process_events afterwards.
106- *
107- * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
108- * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
105+ * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
106+ * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
109107 *
110108 * Note that we do not check if you are currently connected to the given peer. If no
111109 * connection is available, the outbound `open_channel` message may fail to send, resulting in
112- * the channel eventually being silently forgotten.
110+ * the channel eventually being silently forgotten (dropped on reload).
111+ *
112+ * Returns the new Channel's temporary `channel_id`. This ID will appear as
113+ * [`Event::FundingGenerationReady::temporary_channel_id`] and in
114+ * [`ChannelDetails::channel_id`] until after
115+ * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
116+ * one derived from the funding transaction's TXID. If the counterparty rejects the channel
117+ * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
118+ *
119+ * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
120+ * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
121+ * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
113122 *
114123 * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
115124 */
116- public Result_NoneAPIErrorZ create_channel (byte [] their_network_key , long channel_value_satoshis , long push_msat , long user_id , @ Nullable UserConfig override_config ) {
117- long ret = bindings .ChannelManager_create_channel (this .ptr , their_network_key , channel_value_satoshis , push_msat , user_id , override_config == null ? 0 : override_config .ptr & ~1 );
125+ public Result__u832APIErrorZ create_channel (byte [] their_network_key , long channel_value_satoshis , long push_msat , long user_channel_id , @ Nullable UserConfig override_config ) {
126+ long ret = bindings .ChannelManager_create_channel (this .ptr , their_network_key , channel_value_satoshis , push_msat , user_channel_id , override_config == null ? 0 : override_config .ptr & ~1 );
118127 if (ret >= 0 && ret < 1024 ) { return null ; }
119- Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ .constr_from_ptr (ret );
128+ Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ .constr_from_ptr (ret );
120129 return ret_hu_conv ;
121130 }
122131
@@ -272,9 +281,27 @@ public void force_close_all_channels() {
272281 *
273282 * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
274283 */
275- public Result_NonePaymentSendFailureZ send_payment (Route route , byte [] payment_hash , @ Nullable byte [] payment_secret ) {
284+ public Result_PaymentIdPaymentSendFailureZ send_payment (Route route , byte [] payment_hash , @ Nullable byte [] payment_secret ) {
276285 long ret = bindings .ChannelManager_send_payment (this .ptr , route == null ? 0 : route .ptr & ~1 , payment_hash , payment_secret );
277286 if (ret >= 0 && ret < 1024 ) { return null ; }
287+ Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ .constr_from_ptr (ret );
288+ this .ptrs_to .add (route );
289+ return ret_hu_conv ;
290+ }
291+
292+ /**
293+ * Retries a payment along the given [`Route`].
294+ *
295+ * Errors returned are a superset of those returned from [`send_payment`], so see
296+ * [`send_payment`] documentation for more details on errors. This method will also error if the
297+ * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
298+ * for the given `payment_id` cannot be found (likely due to timeout or success).
299+ *
300+ * [`send_payment`]: [`ChannelManager::send_payment`]
301+ */
302+ public Result_NonePaymentSendFailureZ retry_payment (Route route , PaymentId payment_id ) {
303+ long ret = bindings .ChannelManager_retry_payment (this .ptr , route == null ? 0 : route .ptr & ~1 , payment_id == null ? 0 : payment_id .ptr & ~1 );
304+ if (ret >= 0 && ret < 1024 ) { return null ; }
278305 Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ .constr_from_ptr (ret );
279306 this .ptrs_to .add (route );
280307 return ret_hu_conv ;
@@ -298,10 +325,10 @@ public Result_NonePaymentSendFailureZ send_payment(Route route, byte[] payment_h
298325 *
299326 * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
300327 */
301- public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment (Route route , @ Nullable byte [] payment_preimage ) {
328+ public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_spontaneous_payment (Route route , @ Nullable byte [] payment_preimage ) {
302329 long ret = bindings .ChannelManager_send_spontaneous_payment (this .ptr , route == null ? 0 : route .ptr & ~1 , payment_preimage );
303330 if (ret >= 0 && ret < 1024 ) { return null ; }
304- Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ .constr_from_ptr (ret );
331+ Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ .constr_from_ptr (ret );
305332 this .ptrs_to .add (route );
306333 return ret_hu_conv ;
307334 }
0 commit comments