52659eb1cbfcfa7b117ea037e60fdaa4fd88b0eb
[ldk-java] / src / main / java / org / ldk / structs / Event.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An Event which you should probably take some action in response to.
13  * 
14  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
15  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
16  * written as it makes no sense to respond to it after reconnecting to peers).
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class Event extends CommonBase {
20         private Event(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.Event_free(ptr); }
25         }
26         static Event constr_from_ptr(long ptr) {
27                 bindings.LDKEvent raw_val = bindings.LDKEvent_ref_from_ptr(ptr);
28                 if (raw_val.getClass() == bindings.LDKEvent.FundingGenerationReady.class) {
29                         return new FundingGenerationReady(ptr, (bindings.LDKEvent.FundingGenerationReady)raw_val);
30                 }
31                 if (raw_val.getClass() == bindings.LDKEvent.PaymentReceived.class) {
32                         return new PaymentReceived(ptr, (bindings.LDKEvent.PaymentReceived)raw_val);
33                 }
34                 if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimed.class) {
35                         return new PaymentClaimed(ptr, (bindings.LDKEvent.PaymentClaimed)raw_val);
36                 }
37                 if (raw_val.getClass() == bindings.LDKEvent.PaymentSent.class) {
38                         return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val);
39                 }
40                 if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) {
41                         return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val);
42                 }
43                 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) {
44                         return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val);
45                 }
46                 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
47                         return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
48                 }
49                 if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) {
50                         return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val);
51                 }
52                 if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) {
53                         return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val);
54                 }
55                 if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
56                         return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
57                 }
58                 if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
59                         return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
60                 }
61                 if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
62                         return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
63                 }
64                 if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
65                         return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
66                 }
67                 if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) {
68                         return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val);
69                 }
70                 if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
71                         return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
72                 }
73                 if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
74                         return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
75                 }
76                 assert false; return null; // Unreachable without extending the (internal) bindings interface
77         }
78
79         /**
80          * Used to indicate that the client should generate a funding transaction with the given
81          * parameters and then call [`ChannelManager::funding_transaction_generated`].
82          * Generated in [`ChannelManager`] message handling.
83          * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
84          * counterparty can steal your funds!
85          * 
86          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
87          * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
88          */
89         public final static class FundingGenerationReady extends Event {
90                 /**
91                  * The random channel_id we picked which you'll need to pass into
92                  * [`ChannelManager::funding_transaction_generated`].
93                  * 
94                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
95                 */
96                 public final byte[] temporary_channel_id;
97                 /**
98                  * The counterparty's node_id, which you'll need to pass back into
99                  * [`ChannelManager::funding_transaction_generated`].
100                  * 
101                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
102                 */
103                 public final byte[] counterparty_node_id;
104                 /**
105                  * The value, in satoshis, that the output should have.
106                 */
107                 public final long channel_value_satoshis;
108                 /**
109                  * The script which should be used in the transaction output.
110                 */
111                 public final byte[] output_script;
112                 /**
113                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
114                  * an inbound channel.
115                  * 
116                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
117                 */
118                 public final long user_channel_id;
119                 private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
120                         super(null, ptr);
121                         this.temporary_channel_id = obj.temporary_channel_id;
122                         this.counterparty_node_id = obj.counterparty_node_id;
123                         this.channel_value_satoshis = obj.channel_value_satoshis;
124                         this.output_script = obj.output_script;
125                         this.user_channel_id = obj.user_channel_id;
126                 }
127         }
128         /**
129          * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
130          * feed it to [`ChannelManager::claim_funds`] to get it....
131          * 
132          * Note that if the preimage is not known, you should call
133          * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
134          * network congestion.
135          * If you fail to call either [`ChannelManager::claim_funds`] or
136          * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
137          * automatically failed.
138          * 
139          * # Note
140          * LDK will not stop an inbound payment from being paid multiple times, so multiple
141          * `PaymentReceived` events may be generated for the same payment.
142          * 
143          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
144          * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
145          */
146         public final static class PaymentReceived extends Event {
147                 /**
148                  * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
149                  * not stop you from registering duplicate payment hashes for inbound payments.
150                 */
151                 public final byte[] payment_hash;
152                 /**
153                  * The value, in thousandths of a satoshi, that this payment is for.
154                 */
155                 public final long amount_msat;
156                 /**
157                  * Information for claiming this received payment, based on whether the purpose of the
158                  * payment is to pay an invoice or to send a spontaneous payment.
159                 */
160                 public final org.ldk.structs.PaymentPurpose purpose;
161                 private PaymentReceived(long ptr, bindings.LDKEvent.PaymentReceived obj) {
162                         super(null, ptr);
163                         this.payment_hash = obj.payment_hash;
164                         this.amount_msat = obj.amount_msat;
165                         long purpose = obj.purpose;
166                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
167                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
168                         this.purpose = purpose_hu_conv;
169                 }
170         }
171         /**
172          * Indicates a payment has been claimed and we've received money!
173          * 
174          * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
175          * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
176          * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
177          * [`Event::PaymentReceived`] event.
178          * 
179          * # Note
180          * LDK will not stop an inbound payment from being paid multiple times, so multiple
181          * `PaymentReceived` events may be generated for the same payment. If you then call
182          * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
183          * multiple `PaymentClaimed` events.
184          * 
185          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
186          */
187         public final static class PaymentClaimed extends Event {
188                 /**
189                  * The payment hash of the claimed payment. Note that LDK will not stop you from
190                  * registering duplicate payment hashes for inbound payments.
191                 */
192                 public final byte[] payment_hash;
193                 /**
194                  * The value, in thousandths of a satoshi, that this payment is for.
195                 */
196                 public final long amount_msat;
197                 /**
198                  * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
199                  * spontaneous payment.
200                 */
201                 public final org.ldk.structs.PaymentPurpose purpose;
202                 private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
203                         super(null, ptr);
204                         this.payment_hash = obj.payment_hash;
205                         this.amount_msat = obj.amount_msat;
206                         long purpose = obj.purpose;
207                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
208                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
209                         this.purpose = purpose_hu_conv;
210                 }
211         }
212         /**
213          * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
214          * and we got back the payment preimage for it).
215          * 
216          * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
217          * event. In this situation, you SHOULD treat this payment as having succeeded.
218          */
219         public final static class PaymentSent extends Event {
220                 /**
221                  * The id returned by [`ChannelManager::send_payment`] and used with
222                  * [`ChannelManager::retry_payment`].
223                  * 
224                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
225                  * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
226                  * 
227                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
228                 */
229                 @Nullable public final byte[] payment_id;
230                 /**
231                  * The preimage to the hash given to ChannelManager::send_payment.
232                  * Note that this serves as a payment receipt, if you wish to have such a thing, you must
233                  * store it somehow!
234                 */
235                 public final byte[] payment_preimage;
236                 /**
237                  * The hash that was given to [`ChannelManager::send_payment`].
238                  * 
239                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
240                 */
241                 public final byte[] payment_hash;
242                 /**
243                  * The total fee which was spent at intermediate hops in this payment, across all paths.
244                  * 
245                  * Note that, like [`Route::get_total_fees`] this does *not* include any potential
246                  * overpayment to the recipient node.
247                  * 
248                  * If the recipient or an intermediate node misbehaves and gives us free money, this may
249                  * overstate the amount paid, though this is unlikely.
250                  * 
251                  * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
252                 */
253                 public final org.ldk.structs.Option_u64Z fee_paid_msat;
254                 private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
255                         super(null, ptr);
256                         this.payment_id = obj.payment_id;
257                         this.payment_preimage = obj.payment_preimage;
258                         this.payment_hash = obj.payment_hash;
259                         long fee_paid_msat = obj.fee_paid_msat;
260                         org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
261                         if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
262                         this.fee_paid_msat = fee_paid_msat_hu_conv;
263                 }
264         }
265         /**
266          * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
267          * provide failure information for each MPP part in the payment.
268          * 
269          * This event is provided once there are no further pending HTLCs for the payment and the
270          * payment is no longer retryable, either due to a several-block timeout or because
271          * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
272          * 
273          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
274          */
275         public final static class PaymentFailed extends Event {
276                 /**
277                  * The id returned by [`ChannelManager::send_payment`] and used with
278                  * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
279                  * 
280                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
281                  * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
282                  * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
283                 */
284                 public final byte[] payment_id;
285                 /**
286                  * The hash that was given to [`ChannelManager::send_payment`].
287                  * 
288                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
289                 */
290                 public final byte[] payment_hash;
291                 private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
292                         super(null, ptr);
293                         this.payment_id = obj.payment_id;
294                         this.payment_hash = obj.payment_hash;
295                 }
296         }
297         /**
298          * Indicates that a path for an outbound payment was successful.
299          * 
300          * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
301          * [`Event::PaymentSent`] for obtaining the payment preimage.
302          */
303         public final static class PaymentPathSuccessful extends Event {
304                 /**
305                  * The id returned by [`ChannelManager::send_payment`] and used with
306                  * [`ChannelManager::retry_payment`].
307                  * 
308                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
309                  * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
310                 */
311                 public final byte[] payment_id;
312                 /**
313                  * The hash that was given to [`ChannelManager::send_payment`].
314                  * 
315                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
316                  * 
317                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
318                 */
319                 @Nullable public final byte[] payment_hash;
320                 /**
321                  * The payment path that was successful.
322                  * 
323                  * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
324                 */
325                 public final RouteHop[] path;
326                 private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
327                         super(null, ptr);
328                         this.payment_id = obj.payment_id;
329                         this.payment_hash = obj.payment_hash;
330                         long[] path = obj.path;
331                         int path_conv_10_len = path.length;
332                         RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
333                         for (int k = 0; k < path_conv_10_len; k++) {
334                                 long path_conv_10 = path[k];
335                                 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
336                                 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
337                                 path_conv_10_arr[k] = path_conv_10_hu_conv;
338                         }
339                         this.path = path_conv_10_arr;
340                 }
341         }
342         /**
343          * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
344          * something. You may wish to retry with a different route.
345          * 
346          * Note that this does *not* indicate that all paths for an MPP payment have failed, see
347          * [`Event::PaymentFailed`] and [`all_paths_failed`].
348          * 
349          * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
350          */
351         public final static class PaymentPathFailed extends Event {
352                 /**
353                  * The id returned by [`ChannelManager::send_payment`] and used with
354                  * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
355                  * 
356                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
357                  * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
358                  * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
359                  * 
360                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
361                 */
362                 @Nullable public final byte[] payment_id;
363                 /**
364                  * The hash that was given to [`ChannelManager::send_payment`].
365                  * 
366                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
367                 */
368                 public final byte[] payment_hash;
369                 /**
370                  * Indicates the payment was rejected for some reason by the recipient. This implies that
371                  * the payment has failed, not just the route in question. If this is not set, you may
372                  * retry the payment via a different route.
373                 */
374                 public final boolean rejected_by_dest;
375                 /**
376                  * Any failure information conveyed via the Onion return packet by a node along the failed
377                  * payment route.
378                  * 
379                  * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
380                  * account the update.
381                  * 
382                  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
383                 */
384                 public final org.ldk.structs.Option_NetworkUpdateZ network_update;
385                 /**
386                  * For both single-path and multi-path payments, this is set if all paths of the payment have
387                  * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
388                  * larger MPP payment were still in flight when this event was generated.
389                  * 
390                  * Note that if you are retrying individual MPP parts, using this value to determine if a
391                  * payment has fully failed is race-y. Because multiple failures can happen prior to events
392                  * being processed, you may retry in response to a first failure, with a second failure
393                  * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
394                  * you will see `all_paths_failed` set even though the retry of the first failure still
395                  * has an associated in-flight HTLC. See (1) for an example of such a failure.
396                  * 
397                  * If you wish to retry individual MPP parts and learn when a payment has failed, you must
398                  * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
399                  * 
400                  * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
401                  * 
402                  * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
403                 */
404                 public final boolean all_paths_failed;
405                 /**
406                  * The payment path that failed.
407                 */
408                 public final RouteHop[] path;
409                 /**
410                  * The channel responsible for the failed payment path.
411                  * 
412                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
413                  * may not refer to a channel in the public network graph. These aliases may also collide
414                  * with channels in the public network graph.
415                  * 
416                  * If this is `Some`, then the corresponding channel should be avoided when the payment is
417                  * retried. May be `None` for older [`Event`] serializations.
418                 */
419                 public final org.ldk.structs.Option_u64Z short_channel_id;
420                 /**
421                  * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
422                  * 
423                  * See [`find_route`] for details.
424                  * 
425                  * [`Route`]: crate::routing::router::Route
426                  * [`find_route`]: crate::routing::router::find_route
427                  * 
428                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
429                 */
430                 @Nullable public final org.ldk.structs.RouteParameters retry;
431                 private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
432                         super(null, ptr);
433                         this.payment_id = obj.payment_id;
434                         this.payment_hash = obj.payment_hash;
435                         this.rejected_by_dest = obj.rejected_by_dest;
436                         long network_update = obj.network_update;
437                         org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update);
438                         if (network_update_hu_conv != null) { network_update_hu_conv.ptrs_to.add(this); };
439                         this.network_update = network_update_hu_conv;
440                         this.all_paths_failed = obj.all_paths_failed;
441                         long[] path = obj.path;
442                         int path_conv_10_len = path.length;
443                         RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
444                         for (int k = 0; k < path_conv_10_len; k++) {
445                                 long path_conv_10 = path[k];
446                                 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
447                                 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
448                                 path_conv_10_arr[k] = path_conv_10_hu_conv;
449                         }
450                         this.path = path_conv_10_arr;
451                         long short_channel_id = obj.short_channel_id;
452                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
453                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
454                         this.short_channel_id = short_channel_id_hu_conv;
455                         long retry = obj.retry;
456                         org.ldk.structs.RouteParameters retry_hu_conv = null; if (retry < 0 || retry > 4096) { retry_hu_conv = new org.ldk.structs.RouteParameters(null, retry); }
457                         if (retry_hu_conv != null) { retry_hu_conv.ptrs_to.add(this); };
458                         this.retry = retry_hu_conv;
459                 }
460         }
461         /**
462          * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
463          */
464         public final static class ProbeSuccessful extends Event {
465                 /**
466                  * The id returned by [`ChannelManager::send_probe`].
467                  * 
468                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
469                 */
470                 public final byte[] payment_id;
471                 /**
472                  * The hash generated by [`ChannelManager::send_probe`].
473                  * 
474                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
475                 */
476                 public final byte[] payment_hash;
477                 /**
478                  * The payment path that was successful.
479                 */
480                 public final RouteHop[] path;
481                 private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
482                         super(null, ptr);
483                         this.payment_id = obj.payment_id;
484                         this.payment_hash = obj.payment_hash;
485                         long[] path = obj.path;
486                         int path_conv_10_len = path.length;
487                         RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
488                         for (int k = 0; k < path_conv_10_len; k++) {
489                                 long path_conv_10 = path[k];
490                                 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
491                                 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
492                                 path_conv_10_arr[k] = path_conv_10_hu_conv;
493                         }
494                         this.path = path_conv_10_arr;
495                 }
496         }
497         /**
498          * Indicates that a probe payment we sent failed at an intermediary node on the path.
499          */
500         public final static class ProbeFailed extends Event {
501                 /**
502                  * The id returned by [`ChannelManager::send_probe`].
503                  * 
504                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
505                 */
506                 public final byte[] payment_id;
507                 /**
508                  * The hash generated by [`ChannelManager::send_probe`].
509                  * 
510                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
511                 */
512                 public final byte[] payment_hash;
513                 /**
514                  * The payment path that failed.
515                 */
516                 public final RouteHop[] path;
517                 /**
518                  * The channel responsible for the failed probe.
519                  * 
520                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
521                  * may not refer to a channel in the public network graph. These aliases may also collide
522                  * with channels in the public network graph.
523                 */
524                 public final org.ldk.structs.Option_u64Z short_channel_id;
525                 private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
526                         super(null, ptr);
527                         this.payment_id = obj.payment_id;
528                         this.payment_hash = obj.payment_hash;
529                         long[] path = obj.path;
530                         int path_conv_10_len = path.length;
531                         RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
532                         for (int k = 0; k < path_conv_10_len; k++) {
533                                 long path_conv_10 = path[k];
534                                 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
535                                 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
536                                 path_conv_10_arr[k] = path_conv_10_hu_conv;
537                         }
538                         this.path = path_conv_10_arr;
539                         long short_channel_id = obj.short_channel_id;
540                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
541                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
542                         this.short_channel_id = short_channel_id_hu_conv;
543                 }
544         }
545         /**
546          * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
547          * a time in the future.
548          * 
549          * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
550          */
551         public final static class PendingHTLCsForwardable extends Event {
552                 /**
553                  * The minimum amount of time that should be waited prior to calling
554                  * process_pending_htlc_forwards. To increase the effort required to correlate payments,
555                  * you should wait a random amount of time in roughly the range (now + time_forwardable,
556                  * now + 5*time_forwardable).
557                 */
558                 public final long time_forwardable;
559                 private PendingHTLCsForwardable(long ptr, bindings.LDKEvent.PendingHTLCsForwardable obj) {
560                         super(null, ptr);
561                         this.time_forwardable = obj.time_forwardable;
562                 }
563         }
564         /**
565          * Used to indicate that an output which you should know how to spend was confirmed on chain
566          * and is now spendable.
567          * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
568          * counterparty spending them due to some kind of timeout. Thus, you need to store them
569          * somewhere and spend them when you create on-chain transactions.
570          */
571         public final static class SpendableOutputs extends Event {
572                 /**
573                  * The outputs which you should store as spendable by you.
574                 */
575                 public final SpendableOutputDescriptor[] outputs;
576                 private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) {
577                         super(null, ptr);
578                         long[] outputs = obj.outputs;
579                         int outputs_conv_27_len = outputs.length;
580                         SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
581                         for (int b = 0; b < outputs_conv_27_len; b++) {
582                                 long outputs_conv_27 = outputs[b];
583                                 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
584                                 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
585                                 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
586                         }
587                         this.outputs = outputs_conv_27_arr;
588                 }
589         }
590         /**
591          * This event is generated when a payment has been successfully forwarded through us and a
592          * forwarding fee earned.
593          */
594         public final static class PaymentForwarded extends Event {
595                 /**
596                  * The incoming channel between the previous node and us. This is only `None` for events
597                  * generated or serialized by versions prior to 0.0.107.
598                  * 
599                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
600                 */
601                 @Nullable public final byte[] prev_channel_id;
602                 /**
603                  * The outgoing channel between the next node and us. This is only `None` for events
604                  * generated or serialized by versions prior to 0.0.107.
605                  * 
606                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
607                 */
608                 @Nullable public final byte[] next_channel_id;
609                 /**
610                  * The fee, in milli-satoshis, which was earned as a result of the payment.
611                  * 
612                  * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
613                  * was pending, the amount the next hop claimed will have been rounded down to the nearest
614                  * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
615                  * claimed the full value in millisatoshis from the source. In this case,
616                  * `claim_from_onchain_tx` will be set.
617                  * 
618                  * If the channel which sent us the payment has been force-closed, we will claim the funds
619                  * via an on-chain transaction. In that case we do not yet know the on-chain transaction
620                  * fees which we will spend and will instead set this to `None`. It is possible duplicate
621                  * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
622                  * `None`.
623                 */
624                 public final org.ldk.structs.Option_u64Z fee_earned_msat;
625                 /**
626                  * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
627                  * transaction.
628                 */
629                 public final boolean claim_from_onchain_tx;
630                 private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
631                         super(null, ptr);
632                         this.prev_channel_id = obj.prev_channel_id;
633                         this.next_channel_id = obj.next_channel_id;
634                         long fee_earned_msat = obj.fee_earned_msat;
635                         org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
636                         if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
637                         this.fee_earned_msat = fee_earned_msat_hu_conv;
638                         this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
639                 }
640         }
641         /**
642          * Used to indicate that a previously opened channel with the given `channel_id` is in the
643          * process of closure.
644          */
645         public final static class ChannelClosed extends Event {
646                 /**
647                  * The channel_id of the channel which has been closed. Note that on-chain transactions
648                  * resolving the channel are likely still awaiting confirmation.
649                 */
650                 public final byte[] channel_id;
651                 /**
652                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
653                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
654                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
655                  * `user_channel_id` will be 0 for an inbound channel.
656                  * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
657                  * 
658                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
659                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
660                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
661                 */
662                 public final long user_channel_id;
663                 /**
664                  * The reason the channel was closed.
665                 */
666                 public final org.ldk.structs.ClosureReason reason;
667                 private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
668                         super(null, ptr);
669                         this.channel_id = obj.channel_id;
670                         this.user_channel_id = obj.user_channel_id;
671                         long reason = obj.reason;
672                         org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
673                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
674                         this.reason = reason_hu_conv;
675                 }
676         }
677         /**
678          * Used to indicate to the user that they can abandon the funding transaction and recycle the
679          * inputs for another purpose.
680          */
681         public final static class DiscardFunding extends Event {
682                 /**
683                  * The channel_id of the channel which has been closed.
684                 */
685                 public final byte[] channel_id;
686                 /**
687                  * The full transaction received from the user
688                 */
689                 public final byte[] transaction;
690                 private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
691                         super(null, ptr);
692                         this.channel_id = obj.channel_id;
693                         this.transaction = obj.transaction;
694                 }
695         }
696         /**
697          * Indicates a request to open a new channel by a peer.
698          * 
699          * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
700          * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
701          * 
702          * The event is only triggered when a new open channel request is received and the
703          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
704          * 
705          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
706          * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
707          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
708          */
709         public final static class OpenChannelRequest extends Event {
710                 /**
711                  * The temporary channel ID of the channel requested to be opened.
712                  * 
713                  * When responding to the request, the `temporary_channel_id` should be passed
714                  * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
715                  * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
716                  * 
717                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
718                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
719                 */
720                 public final byte[] temporary_channel_id;
721                 /**
722                  * The node_id of the counterparty requesting to open the channel.
723                  * 
724                  * When responding to the request, the `counterparty_node_id` should be passed
725                  * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
726                  * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
727                  * request.
728                  * 
729                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
730                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
731                 */
732                 public final byte[] counterparty_node_id;
733                 /**
734                  * The channel value of the requested channel.
735                 */
736                 public final long funding_satoshis;
737                 /**
738                  * Our starting balance in the channel if the request is accepted, in milli-satoshi.
739                 */
740                 public final long push_msat;
741                 /**
742                  * The features that this channel will operate with. If you reject the channel, a
743                  * well-behaved counterparty may automatically re-attempt the channel with a new set of
744                  * feature flags.
745                  * 
746                  * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
747                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
748                  * 0.0.106.
749                  * 
750                  * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
751                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
752                  * 0.0.107. Channels setting this type also need to get manually accepted via
753                  * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
754                  * or will be rejected otherwise.
755                  * 
756                  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
757                 */
758                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
759                 private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
760                         super(null, ptr);
761                         this.temporary_channel_id = obj.temporary_channel_id;
762                         this.counterparty_node_id = obj.counterparty_node_id;
763                         this.funding_satoshis = obj.funding_satoshis;
764                         this.push_msat = obj.push_msat;
765                         long channel_type = obj.channel_type;
766                         org.ldk.structs.ChannelTypeFeatures channel_type_hu_conv = null; if (channel_type < 0 || channel_type > 4096) { channel_type_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, channel_type); }
767                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
768                         this.channel_type = channel_type_hu_conv;
769                 }
770         }
771         /**
772          * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
773          * forward it.
774          * 
775          * Some scenarios where this event may be sent include:
776          * Insufficient capacity in the outbound channel
777          * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
778          * When an unknown SCID is requested for forwarding a payment.
779          * Claiming an amount for an MPP payment that exceeds the HTLC total
780          * The HTLC has timed out
781          * 
782          * This event, however, does not get generated if an HTLC fails to meet the forwarding
783          * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
784          */
785         public final static class HTLCHandlingFailed extends Event {
786                 /**
787                  * The channel over which the HTLC was received.
788                 */
789                 public final byte[] prev_channel_id;
790                 /**
791                  * Destination of the HTLC that failed to be processed.
792                 */
793                 public final org.ldk.structs.HTLCDestination failed_next_destination;
794                 private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
795                         super(null, ptr);
796                         this.prev_channel_id = obj.prev_channel_id;
797                         long failed_next_destination = obj.failed_next_destination;
798                         org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
799                         if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
800                         this.failed_next_destination = failed_next_destination_hu_conv;
801                 }
802         }
803         long clone_ptr() {
804                 long ret = bindings.Event_clone_ptr(this.ptr);
805                 Reference.reachabilityFence(this);
806                 return ret;
807         }
808
809         /**
810          * Creates a copy of the Event
811          */
812         public Event clone() {
813                 long ret = bindings.Event_clone(this.ptr);
814                 Reference.reachabilityFence(this);
815                 if (ret >= 0 && ret <= 4096) { return null; }
816                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
817                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
818                 return ret_hu_conv;
819         }
820
821         /**
822          * Utility method to constructs a new FundingGenerationReady-variant Event
823          */
824         public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, long user_channel_id) {
825                 long ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_value_satoshis, output_script, user_channel_id);
826                 Reference.reachabilityFence(temporary_channel_id);
827                 Reference.reachabilityFence(counterparty_node_id);
828                 Reference.reachabilityFence(channel_value_satoshis);
829                 Reference.reachabilityFence(output_script);
830                 Reference.reachabilityFence(user_channel_id);
831                 if (ret >= 0 && ret <= 4096) { return null; }
832                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
833                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
834                 return ret_hu_conv;
835         }
836
837         /**
838          * Utility method to constructs a new PaymentReceived-variant Event
839          */
840         public static Event payment_received(byte[] payment_hash, long amount_msat, PaymentPurpose purpose) {
841                 long ret = bindings.Event_payment_received(InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
842                 Reference.reachabilityFence(payment_hash);
843                 Reference.reachabilityFence(amount_msat);
844                 Reference.reachabilityFence(purpose);
845                 if (ret >= 0 && ret <= 4096) { return null; }
846                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
847                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
848                 return ret_hu_conv;
849         }
850
851         /**
852          * Utility method to constructs a new PaymentClaimed-variant Event
853          */
854         public static Event payment_claimed(byte[] payment_hash, long amount_msat, PaymentPurpose purpose) {
855                 long ret = bindings.Event_payment_claimed(InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
856                 Reference.reachabilityFence(payment_hash);
857                 Reference.reachabilityFence(amount_msat);
858                 Reference.reachabilityFence(purpose);
859                 if (ret >= 0 && ret <= 4096) { return null; }
860                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
861                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
862                 return ret_hu_conv;
863         }
864
865         /**
866          * Utility method to constructs a new PaymentSent-variant Event
867          */
868         public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, Option_u64Z fee_paid_msat) {
869                 long ret = bindings.Event_payment_sent(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
870                 Reference.reachabilityFence(payment_id);
871                 Reference.reachabilityFence(payment_preimage);
872                 Reference.reachabilityFence(payment_hash);
873                 Reference.reachabilityFence(fee_paid_msat);
874                 if (ret >= 0 && ret <= 4096) { return null; }
875                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
876                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
877                 return ret_hu_conv;
878         }
879
880         /**
881          * Utility method to constructs a new PaymentFailed-variant Event
882          */
883         public static Event payment_failed(byte[] payment_id, byte[] payment_hash) {
884                 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32));
885                 Reference.reachabilityFence(payment_id);
886                 Reference.reachabilityFence(payment_hash);
887                 if (ret >= 0 && ret <= 4096) { return null; }
888                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
889                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
890                 return ret_hu_conv;
891         }
892
893         /**
894          * Utility method to constructs a new PaymentPathSuccessful-variant Event
895          */
896         public static Event payment_path_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
897                 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null);
898                 Reference.reachabilityFence(payment_id);
899                 Reference.reachabilityFence(payment_hash);
900                 Reference.reachabilityFence(path);
901                 if (ret >= 0 && ret <= 4096) { return null; }
902                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
903                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
904                 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
905                 return ret_hu_conv;
906         }
907
908         /**
909          * Utility method to constructs a new PaymentPathFailed-variant Event
910          */
911         public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id, RouteParameters retry) {
912                 long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr);
913                 Reference.reachabilityFence(payment_id);
914                 Reference.reachabilityFence(payment_hash);
915                 Reference.reachabilityFence(rejected_by_dest);
916                 Reference.reachabilityFence(network_update);
917                 Reference.reachabilityFence(all_paths_failed);
918                 Reference.reachabilityFence(path);
919                 Reference.reachabilityFence(short_channel_id);
920                 Reference.reachabilityFence(retry);
921                 if (ret >= 0 && ret <= 4096) { return null; }
922                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
923                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
924                 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
925                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry); };
926                 return ret_hu_conv;
927         }
928
929         /**
930          * Utility method to constructs a new ProbeSuccessful-variant Event
931          */
932         public static Event probe_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
933                 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null);
934                 Reference.reachabilityFence(payment_id);
935                 Reference.reachabilityFence(payment_hash);
936                 Reference.reachabilityFence(path);
937                 if (ret >= 0 && ret <= 4096) { return null; }
938                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
939                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
940                 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
941                 return ret_hu_conv;
942         }
943
944         /**
945          * Utility method to constructs a new ProbeFailed-variant Event
946          */
947         public static Event probe_failed(byte[] payment_id, byte[] payment_hash, RouteHop[] path, Option_u64Z short_channel_id) {
948                 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id.ptr);
949                 Reference.reachabilityFence(payment_id);
950                 Reference.reachabilityFence(payment_hash);
951                 Reference.reachabilityFence(path);
952                 Reference.reachabilityFence(short_channel_id);
953                 if (ret >= 0 && ret <= 4096) { return null; }
954                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
955                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
956                 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
957                 return ret_hu_conv;
958         }
959
960         /**
961          * Utility method to constructs a new PendingHTLCsForwardable-variant Event
962          */
963         public static Event pending_htlcs_forwardable(long time_forwardable) {
964                 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
965                 Reference.reachabilityFence(time_forwardable);
966                 if (ret >= 0 && ret <= 4096) { return null; }
967                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
968                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
969                 return ret_hu_conv;
970         }
971
972         /**
973          * Utility method to constructs a new SpendableOutputs-variant Event
974          */
975         public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) {
976                 long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null);
977                 Reference.reachabilityFence(outputs);
978                 if (ret >= 0 && ret <= 4096) { return null; }
979                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
980                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
981                 return ret_hu_conv;
982         }
983
984         /**
985          * Utility method to constructs a new PaymentForwarded-variant Event
986          */
987         public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) {
988                 long ret = bindings.Event_payment_forwarded(InternalUtils.check_arr_len(prev_channel_id, 32), InternalUtils.check_arr_len(next_channel_id, 32), fee_earned_msat.ptr, claim_from_onchain_tx);
989                 Reference.reachabilityFence(prev_channel_id);
990                 Reference.reachabilityFence(next_channel_id);
991                 Reference.reachabilityFence(fee_earned_msat);
992                 Reference.reachabilityFence(claim_from_onchain_tx);
993                 if (ret >= 0 && ret <= 4096) { return null; }
994                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
995                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
996                 return ret_hu_conv;
997         }
998
999         /**
1000          * Utility method to constructs a new ChannelClosed-variant Event
1001          */
1002         public static Event channel_closed(byte[] channel_id, long user_channel_id, ClosureReason reason) {
1003                 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id, reason.ptr);
1004                 Reference.reachabilityFence(channel_id);
1005                 Reference.reachabilityFence(user_channel_id);
1006                 Reference.reachabilityFence(reason);
1007                 if (ret >= 0 && ret <= 4096) { return null; }
1008                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1009                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1010                 return ret_hu_conv;
1011         }
1012
1013         /**
1014          * Utility method to constructs a new DiscardFunding-variant Event
1015          */
1016         public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1017                 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1018                 Reference.reachabilityFence(channel_id);
1019                 Reference.reachabilityFence(transaction);
1020                 if (ret >= 0 && ret <= 4096) { return null; }
1021                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1022                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1023                 return ret_hu_conv;
1024         }
1025
1026         /**
1027          * Utility method to constructs a new OpenChannelRequest-variant Event
1028          */
1029         public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, ChannelTypeFeatures channel_type) {
1030                 long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr);
1031                 Reference.reachabilityFence(temporary_channel_id);
1032                 Reference.reachabilityFence(counterparty_node_id);
1033                 Reference.reachabilityFence(funding_satoshis);
1034                 Reference.reachabilityFence(push_msat);
1035                 Reference.reachabilityFence(channel_type);
1036                 if (ret >= 0 && ret <= 4096) { return null; }
1037                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1038                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1039                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1040                 return ret_hu_conv;
1041         }
1042
1043         /**
1044          * Utility method to constructs a new HTLCHandlingFailed-variant Event
1045          */
1046         public static Event htlchandling_failed(byte[] prev_channel_id, HTLCDestination failed_next_destination) {
1047                 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1048                 Reference.reachabilityFence(prev_channel_id);
1049                 Reference.reachabilityFence(failed_next_destination);
1050                 if (ret >= 0 && ret <= 4096) { return null; }
1051                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1052                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1053                 return ret_hu_conv;
1054         }
1055
1056         /**
1057          * Serialize the Event object into a byte array which can be read by Event_read
1058          */
1059         public byte[] write() {
1060                 byte[] ret = bindings.Event_write(this.ptr);
1061                 Reference.reachabilityFence(this);
1062                 return ret;
1063         }
1064
1065 }