[Java] Update auto-generated bindings to 0.0.115
[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.PaymentClaimable.class) {
32                         return new PaymentClaimable(ptr, (bindings.LDKEvent.PaymentClaimable)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.HTLCIntercepted.class) {
59                         return new HTLCIntercepted(ptr, (bindings.LDKEvent.HTLCIntercepted)raw_val);
60                 }
61                 if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
62                         return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
63                 }
64                 if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
65                         return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
66                 }
67                 if (raw_val.getClass() == bindings.LDKEvent.ChannelPending.class) {
68                         return new ChannelPending(ptr, (bindings.LDKEvent.ChannelPending)raw_val);
69                 }
70                 if (raw_val.getClass() == bindings.LDKEvent.ChannelReady.class) {
71                         return new ChannelReady(ptr, (bindings.LDKEvent.ChannelReady)raw_val);
72                 }
73                 if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
74                         return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
75                 }
76                 if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) {
77                         return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val);
78                 }
79                 if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
80                         return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
81                 }
82                 if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
83                         return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
84                 }
85                 assert false; return null; // Unreachable without extending the (internal) bindings interface
86         }
87
88         /**
89          * Used to indicate that the client should generate a funding transaction with the given
90          * parameters and then call [`ChannelManager::funding_transaction_generated`].
91          * Generated in [`ChannelManager`] message handling.
92          * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
93          * counterparty can steal your funds!
94          * 
95          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
96          * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
97          */
98         public final static class FundingGenerationReady extends Event {
99                 /**
100                  * The random channel_id we picked which you'll need to pass into
101                  * [`ChannelManager::funding_transaction_generated`].
102                  * 
103                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
104                 */
105                 public final byte[] temporary_channel_id;
106                 /**
107                  * The counterparty's node_id, which you'll need to pass back into
108                  * [`ChannelManager::funding_transaction_generated`].
109                  * 
110                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
111                 */
112                 public final byte[] counterparty_node_id;
113                 /**
114                  * The value, in satoshis, that the output should have.
115                 */
116                 public final long channel_value_satoshis;
117                 /**
118                  * The script which should be used in the transaction output.
119                 */
120                 public final byte[] output_script;
121                 /**
122                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
123                  * random value for an inbound channel. This may be zero for objects serialized with LDK
124                  * versions prior to 0.0.113.
125                  * 
126                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
127                 */
128                 public final org.ldk.util.UInt128 user_channel_id;
129                 private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
130                         super(null, ptr);
131                         this.temporary_channel_id = obj.temporary_channel_id;
132                         this.counterparty_node_id = obj.counterparty_node_id;
133                         this.channel_value_satoshis = obj.channel_value_satoshis;
134                         this.output_script = obj.output_script;
135                         byte[] user_channel_id = obj.user_channel_id;
136                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
137                         this.user_channel_id = user_channel_id_conv;
138                 }
139         }
140         /**
141          * Indicates that we've been offered a payment and it needs to be claimed via calling
142          * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
143          * 
144          * Note that if the preimage is not known, you should call
145          * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
146          * to free up resources for this HTLC and avoid network congestion.
147          * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
148          * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
149          * automatically failed.
150          * 
151          * # Note
152          * LDK will not stop an inbound payment from being paid multiple times, so multiple
153          * `PaymentClaimable` events may be generated for the same payment. In such a case it is
154          * polite (and required in the lightning specification) to fail the payment the second time
155          * and give the sender their money back rather than accepting double payment.
156          * 
157          * # Note
158          * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
159          * 
160          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
161          * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
162          * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
163          */
164         public final static class PaymentClaimable extends Event {
165                 /**
166                  * The node that will receive the payment after it has been claimed.
167                  * This is useful to identify payments received via [phantom nodes].
168                  * This field will always be filled in when the event was generated by LDK versions
169                  * 0.0.113 and above.
170                  * 
171                  * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
172                  * 
173                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
174                 */
175                 @Nullable public final byte[] receiver_node_id;
176                 /**
177                  * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
178                  * not stop you from registering duplicate payment hashes for inbound payments.
179                 */
180                 public final byte[] payment_hash;
181                 /**
182                  * The fields in the onion which were received with each HTLC. Only fields which were
183                  * identical in each HTLC involved in the payment will be included here.
184                  * 
185                  * Payments received on LDK versions prior to 0.0.115 will have this field unset.
186                  * 
187                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
188                 */
189                 @Nullable public final org.ldk.structs.RecipientOnionFields onion_fields;
190                 /**
191                  * The value, in thousandths of a satoshi, that this payment is for.
192                 */
193                 public final long amount_msat;
194                 /**
195                  * Information for claiming this received payment, based on whether the purpose of the
196                  * payment is to pay an invoice or to send a spontaneous payment.
197                 */
198                 public final org.ldk.structs.PaymentPurpose purpose;
199                 /**
200                  * The `channel_id` indicating over which channel we received the payment.
201                  * 
202                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
203                 */
204                 @Nullable public final byte[] via_channel_id;
205                 /**
206                  * The `user_channel_id` indicating over which channel we received the payment.
207                 */
208                 public final org.ldk.structs.Option_u128Z via_user_channel_id;
209                 /**
210                  * The block height at which this payment will be failed back and will no longer be
211                  * eligible for claiming.
212                  * 
213                  * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
214                  * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
215                  * 
216                  * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
217                 */
218                 public final org.ldk.structs.Option_u32Z claim_deadline;
219                 private PaymentClaimable(long ptr, bindings.LDKEvent.PaymentClaimable obj) {
220                         super(null, ptr);
221                         this.receiver_node_id = obj.receiver_node_id;
222                         this.payment_hash = obj.payment_hash;
223                         long onion_fields = obj.onion_fields;
224                         org.ldk.structs.RecipientOnionFields onion_fields_hu_conv = null; if (onion_fields < 0 || onion_fields > 4096) { onion_fields_hu_conv = new org.ldk.structs.RecipientOnionFields(null, onion_fields); }
225                         if (onion_fields_hu_conv != null) { onion_fields_hu_conv.ptrs_to.add(this); };
226                         this.onion_fields = onion_fields_hu_conv;
227                         this.amount_msat = obj.amount_msat;
228                         long purpose = obj.purpose;
229                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
230                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
231                         this.purpose = purpose_hu_conv;
232                         this.via_channel_id = obj.via_channel_id;
233                         long via_user_channel_id = obj.via_user_channel_id;
234                         org.ldk.structs.Option_u128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_u128Z.constr_from_ptr(via_user_channel_id);
235                         if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.add(this); };
236                         this.via_user_channel_id = via_user_channel_id_hu_conv;
237                         long claim_deadline = obj.claim_deadline;
238                         org.ldk.structs.Option_u32Z claim_deadline_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(claim_deadline);
239                         if (claim_deadline_hu_conv != null) { claim_deadline_hu_conv.ptrs_to.add(this); };
240                         this.claim_deadline = claim_deadline_hu_conv;
241                 }
242         }
243         /**
244          * Indicates a payment has been claimed and we've received money!
245          * 
246          * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
247          * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
248          * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
249          * [`Event::PaymentClaimable`] event.
250          * 
251          * # Note
252          * LDK will not stop an inbound payment from being paid multiple times, so multiple
253          * `PaymentClaimable` events may be generated for the same payment. If you then call
254          * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
255          * multiple `PaymentClaimed` events.
256          * 
257          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
258          */
259         public final static class PaymentClaimed extends Event {
260                 /**
261                  * The node that received the payment.
262                  * This is useful to identify payments which were received via [phantom nodes].
263                  * This field will always be filled in when the event was generated by LDK versions
264                  * 0.0.113 and above.
265                  * 
266                  * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
267                  * 
268                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
269                 */
270                 @Nullable public final byte[] receiver_node_id;
271                 /**
272                  * The payment hash of the claimed payment. Note that LDK will not stop you from
273                  * registering duplicate payment hashes for inbound payments.
274                 */
275                 public final byte[] payment_hash;
276                 /**
277                  * The value, in thousandths of a satoshi, that this payment is for.
278                 */
279                 public final long amount_msat;
280                 /**
281                  * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
282                  * spontaneous payment.
283                 */
284                 public final org.ldk.structs.PaymentPurpose purpose;
285                 private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
286                         super(null, ptr);
287                         this.receiver_node_id = obj.receiver_node_id;
288                         this.payment_hash = obj.payment_hash;
289                         this.amount_msat = obj.amount_msat;
290                         long purpose = obj.purpose;
291                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
292                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
293                         this.purpose = purpose_hu_conv;
294                 }
295         }
296         /**
297          * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
298          * and we got back the payment preimage for it).
299          * 
300          * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
301          * event. In this situation, you SHOULD treat this payment as having succeeded.
302          */
303         public final static class PaymentSent extends Event {
304                 /**
305                  * The `payment_id` passed to [`ChannelManager::send_payment`].
306                  * 
307                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
308                  * 
309                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
310                 */
311                 @Nullable public final byte[] payment_id;
312                 /**
313                  * The preimage to the hash given to ChannelManager::send_payment.
314                  * Note that this serves as a payment receipt, if you wish to have such a thing, you must
315                  * store it somehow!
316                 */
317                 public final byte[] payment_preimage;
318                 /**
319                  * The hash that was given to [`ChannelManager::send_payment`].
320                  * 
321                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
322                 */
323                 public final byte[] payment_hash;
324                 /**
325                  * The total fee which was spent at intermediate hops in this payment, across all paths.
326                  * 
327                  * Note that, like [`Route::get_total_fees`] this does *not* include any potential
328                  * overpayment to the recipient node.
329                  * 
330                  * If the recipient or an intermediate node misbehaves and gives us free money, this may
331                  * overstate the amount paid, though this is unlikely.
332                  * 
333                  * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
334                 */
335                 public final org.ldk.structs.Option_u64Z fee_paid_msat;
336                 private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
337                         super(null, ptr);
338                         this.payment_id = obj.payment_id;
339                         this.payment_preimage = obj.payment_preimage;
340                         this.payment_hash = obj.payment_hash;
341                         long fee_paid_msat = obj.fee_paid_msat;
342                         org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
343                         if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
344                         this.fee_paid_msat = fee_paid_msat_hu_conv;
345                 }
346         }
347         /**
348          * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
349          * provide failure information for each path attempt in the payment, including retries.
350          * 
351          * This event is provided once there are no further pending HTLCs for the payment and the
352          * payment is no longer retryable, due either to the [`Retry`] provided or
353          * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
354          * 
355          * [`Retry`]: crate::ln::channelmanager::Retry
356          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
357          */
358         public final static class PaymentFailed extends Event {
359                 /**
360                  * The `payment_id` passed to [`ChannelManager::send_payment`].
361                  * 
362                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
363                 */
364                 public final byte[] payment_id;
365                 /**
366                  * The hash that was given to [`ChannelManager::send_payment`].
367                  * 
368                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
369                 */
370                 public final byte[] payment_hash;
371                 /**
372                  * The reason the payment failed. This is only `None` for events generated or serialized
373                  * by versions prior to 0.0.115.
374                 */
375                 public final org.ldk.structs.Option_PaymentFailureReasonZ reason;
376                 private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
377                         super(null, ptr);
378                         this.payment_id = obj.payment_id;
379                         this.payment_hash = obj.payment_hash;
380                         long reason = obj.reason;
381                         org.ldk.structs.Option_PaymentFailureReasonZ reason_hu_conv = org.ldk.structs.Option_PaymentFailureReasonZ.constr_from_ptr(reason);
382                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
383                         this.reason = reason_hu_conv;
384                 }
385         }
386         /**
387          * Indicates that a path for an outbound payment was successful.
388          * 
389          * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
390          * [`Event::PaymentSent`] for obtaining the payment preimage.
391          */
392         public final static class PaymentPathSuccessful extends Event {
393                 /**
394                  * The `payment_id` passed to [`ChannelManager::send_payment`].
395                  * 
396                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
397                 */
398                 public final byte[] payment_id;
399                 /**
400                  * The hash that was given to [`ChannelManager::send_payment`].
401                  * 
402                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
403                  * 
404                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
405                 */
406                 @Nullable public final byte[] payment_hash;
407                 /**
408                  * The payment path that was successful.
409                  * 
410                  * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
411                 */
412                 public final org.ldk.structs.Path path;
413                 private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
414                         super(null, ptr);
415                         this.payment_id = obj.payment_id;
416                         this.payment_hash = obj.payment_hash;
417                         long path = obj.path;
418                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
419                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
420                         this.path = path_hu_conv;
421                 }
422         }
423         /**
424          * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
425          * handle the HTLC.
426          * 
427          * Note that this does *not* indicate that all paths for an MPP payment have failed, see
428          * [`Event::PaymentFailed`].
429          * 
430          * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
431          * been exhausted.
432          * 
433          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
434          */
435         public final static class PaymentPathFailed extends Event {
436                 /**
437                  * The `payment_id` passed to [`ChannelManager::send_payment`].
438                  * 
439                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
440                  * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
441                  * 
442                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
443                 */
444                 @Nullable public final byte[] payment_id;
445                 /**
446                  * The hash that was given to [`ChannelManager::send_payment`].
447                  * 
448                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
449                 */
450                 public final byte[] payment_hash;
451                 /**
452                  * Indicates the payment was rejected for some reason by the recipient. This implies that
453                  * the payment has failed, not just the route in question. If this is not set, the payment may
454                  * be retried via a different route.
455                 */
456                 public final boolean payment_failed_permanently;
457                 /**
458                  * Extra error details based on the failure type. May contain an update that needs to be
459                  * applied to the [`NetworkGraph`].
460                  * 
461                  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
462                 */
463                 public final org.ldk.structs.PathFailure failure;
464                 /**
465                  * The payment path that failed.
466                 */
467                 public final org.ldk.structs.Path path;
468                 /**
469                  * The channel responsible for the failed payment path.
470                  * 
471                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
472                  * may not refer to a channel in the public network graph. These aliases may also collide
473                  * with channels in the public network graph.
474                  * 
475                  * If this is `Some`, then the corresponding channel should be avoided when the payment is
476                  * retried. May be `None` for older [`Event`] serializations.
477                 */
478                 public final org.ldk.structs.Option_u64Z short_channel_id;
479                 private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
480                         super(null, ptr);
481                         this.payment_id = obj.payment_id;
482                         this.payment_hash = obj.payment_hash;
483                         this.payment_failed_permanently = obj.payment_failed_permanently;
484                         long failure = obj.failure;
485                         org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure);
486                         if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.add(this); };
487                         this.failure = failure_hu_conv;
488                         long path = obj.path;
489                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
490                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
491                         this.path = path_hu_conv;
492                         long short_channel_id = obj.short_channel_id;
493                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
494                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
495                         this.short_channel_id = short_channel_id_hu_conv;
496                 }
497         }
498         /**
499          * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
500          */
501         public final static class ProbeSuccessful extends Event {
502                 /**
503                  * The id returned by [`ChannelManager::send_probe`].
504                  * 
505                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
506                 */
507                 public final byte[] payment_id;
508                 /**
509                  * The hash generated by [`ChannelManager::send_probe`].
510                  * 
511                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
512                 */
513                 public final byte[] payment_hash;
514                 /**
515                  * The payment path that was successful.
516                 */
517                 public final org.ldk.structs.Path path;
518                 private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
519                         super(null, ptr);
520                         this.payment_id = obj.payment_id;
521                         this.payment_hash = obj.payment_hash;
522                         long path = obj.path;
523                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
524                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
525                         this.path = path_hu_conv;
526                 }
527         }
528         /**
529          * Indicates that a probe payment we sent failed at an intermediary node on the path.
530          */
531         public final static class ProbeFailed extends Event {
532                 /**
533                  * The id returned by [`ChannelManager::send_probe`].
534                  * 
535                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
536                 */
537                 public final byte[] payment_id;
538                 /**
539                  * The hash generated by [`ChannelManager::send_probe`].
540                  * 
541                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
542                 */
543                 public final byte[] payment_hash;
544                 /**
545                  * The payment path that failed.
546                 */
547                 public final org.ldk.structs.Path path;
548                 /**
549                  * The channel responsible for the failed probe.
550                  * 
551                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
552                  * may not refer to a channel in the public network graph. These aliases may also collide
553                  * with channels in the public network graph.
554                 */
555                 public final org.ldk.structs.Option_u64Z short_channel_id;
556                 private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
557                         super(null, ptr);
558                         this.payment_id = obj.payment_id;
559                         this.payment_hash = obj.payment_hash;
560                         long path = obj.path;
561                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
562                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
563                         this.path = path_hu_conv;
564                         long short_channel_id = obj.short_channel_id;
565                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
566                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
567                         this.short_channel_id = short_channel_id_hu_conv;
568                 }
569         }
570         /**
571          * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
572          * a time in the future.
573          * 
574          * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
575          */
576         public final static class PendingHTLCsForwardable extends Event {
577                 /**
578                  * The minimum amount of time that should be waited prior to calling
579                  * process_pending_htlc_forwards. To increase the effort required to correlate payments,
580                  * you should wait a random amount of time in roughly the range (now + time_forwardable,
581                  * now + 5*time_forwardable).
582                 */
583                 public final long time_forwardable;
584                 private PendingHTLCsForwardable(long ptr, bindings.LDKEvent.PendingHTLCsForwardable obj) {
585                         super(null, ptr);
586                         this.time_forwardable = obj.time_forwardable;
587                 }
588         }
589         /**
590          * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
591          * you've encoded an intercept scid in the receiver's invoice route hints using
592          * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
593          * 
594          * [`ChannelManager::forward_intercepted_htlc`] or
595          * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
596          * their docs for more information.
597          * 
598          * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
599          * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
600          * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
601          * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
602          */
603         public final static class HTLCIntercepted extends Event {
604                 /**
605                  * An id to help LDK identify which HTLC is being forwarded or failed.
606                 */
607                 public final byte[] intercept_id;
608                 /**
609                  * The fake scid that was programmed as the next hop's scid, generated using
610                  * [`ChannelManager::get_intercept_scid`].
611                  * 
612                  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
613                 */
614                 public final long requested_next_hop_scid;
615                 /**
616                  * The payment hash used for this HTLC.
617                 */
618                 public final byte[] payment_hash;
619                 /**
620                  * How many msats were received on the inbound edge of this HTLC.
621                 */
622                 public final long inbound_amount_msat;
623                 /**
624                  * How many msats the payer intended to route to the next node. Depending on the reason you are
625                  * intercepting this payment, you might take a fee by forwarding less than this amount.
626                  * 
627                  * Note that LDK will NOT check that expected fees were factored into this value. You MUST
628                  * check that whatever fee you want has been included here or subtract it as required. Further,
629                  * LDK will not stop you from forwarding more than you received.
630                 */
631                 public final long expected_outbound_amount_msat;
632                 private HTLCIntercepted(long ptr, bindings.LDKEvent.HTLCIntercepted obj) {
633                         super(null, ptr);
634                         this.intercept_id = obj.intercept_id;
635                         this.requested_next_hop_scid = obj.requested_next_hop_scid;
636                         this.payment_hash = obj.payment_hash;
637                         this.inbound_amount_msat = obj.inbound_amount_msat;
638                         this.expected_outbound_amount_msat = obj.expected_outbound_amount_msat;
639                 }
640         }
641         /**
642          * Used to indicate that an output which you should know how to spend was confirmed on chain
643          * and is now spendable.
644          * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
645          * counterparty spending them due to some kind of timeout. Thus, you need to store them
646          * somewhere and spend them when you create on-chain transactions.
647          */
648         public final static class SpendableOutputs extends Event {
649                 /**
650                  * The outputs which you should store as spendable by you.
651                 */
652                 public final SpendableOutputDescriptor[] outputs;
653                 private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) {
654                         super(null, ptr);
655                         long[] outputs = obj.outputs;
656                         int outputs_conv_27_len = outputs.length;
657                         SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
658                         for (int b = 0; b < outputs_conv_27_len; b++) {
659                                 long outputs_conv_27 = outputs[b];
660                                 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
661                                 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
662                                 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
663                         }
664                         this.outputs = outputs_conv_27_arr;
665                 }
666         }
667         /**
668          * This event is generated when a payment has been successfully forwarded through us and a
669          * forwarding fee earned.
670          */
671         public final static class PaymentForwarded extends Event {
672                 /**
673                  * The incoming channel between the previous node and us. This is only `None` for events
674                  * generated or serialized by versions prior to 0.0.107.
675                  * 
676                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
677                 */
678                 @Nullable public final byte[] prev_channel_id;
679                 /**
680                  * The outgoing channel between the next node and us. This is only `None` for events
681                  * generated or serialized by versions prior to 0.0.107.
682                  * 
683                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
684                 */
685                 @Nullable public final byte[] next_channel_id;
686                 /**
687                  * The fee, in milli-satoshis, which was earned as a result of the payment.
688                  * 
689                  * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
690                  * was pending, the amount the next hop claimed will have been rounded down to the nearest
691                  * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
692                  * claimed the full value in millisatoshis from the source. In this case,
693                  * `claim_from_onchain_tx` will be set.
694                  * 
695                  * If the channel which sent us the payment has been force-closed, we will claim the funds
696                  * via an on-chain transaction. In that case we do not yet know the on-chain transaction
697                  * fees which we will spend and will instead set this to `None`. It is possible duplicate
698                  * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
699                  * `None`.
700                 */
701                 public final org.ldk.structs.Option_u64Z fee_earned_msat;
702                 /**
703                  * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
704                  * transaction.
705                 */
706                 public final boolean claim_from_onchain_tx;
707                 /**
708                  * The final amount forwarded, in milli-satoshis, after the fee is deducted.
709                  * 
710                  * The caveat described above the `fee_earned_msat` field applies here as well.
711                 */
712                 public final org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat;
713                 private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
714                         super(null, ptr);
715                         this.prev_channel_id = obj.prev_channel_id;
716                         this.next_channel_id = obj.next_channel_id;
717                         long fee_earned_msat = obj.fee_earned_msat;
718                         org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
719                         if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
720                         this.fee_earned_msat = fee_earned_msat_hu_conv;
721                         this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
722                         long outbound_amount_forwarded_msat = obj.outbound_amount_forwarded_msat;
723                         org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat);
724                         if (outbound_amount_forwarded_msat_hu_conv != null) { outbound_amount_forwarded_msat_hu_conv.ptrs_to.add(this); };
725                         this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv;
726                 }
727         }
728         /**
729          * Used to indicate that a channel with the given `channel_id` is being opened and pending
730          * confirmation on-chain.
731          * 
732          * This event is emitted when the funding transaction has been signed and is broadcast to the
733          * network. For 0conf channels it will be immediately followed by the corresponding
734          * [`Event::ChannelReady`] event.
735          */
736         public final static class ChannelPending extends Event {
737                 /**
738                  * The `channel_id` of the channel that is pending confirmation.
739                 */
740                 public final byte[] channel_id;
741                 /**
742                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
743                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
744                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
745                  * `user_channel_id` will be randomized for an inbound channel.
746                  * 
747                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
748                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
749                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
750                 */
751                 public final org.ldk.util.UInt128 user_channel_id;
752                 /**
753                  * The `temporary_channel_id` this channel used to be known by during channel establishment.
754                  * 
755                  * Will be `None` for channels created prior to LDK version 0.0.115.
756                  * 
757                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
758                 */
759                 @Nullable public final byte[] former_temporary_channel_id;
760                 /**
761                  * The `node_id` of the channel counterparty.
762                 */
763                 public final byte[] counterparty_node_id;
764                 /**
765                  * The outpoint of the channel's funding transaction.
766                 */
767                 public final org.ldk.structs.OutPoint funding_txo;
768                 private ChannelPending(long ptr, bindings.LDKEvent.ChannelPending obj) {
769                         super(null, ptr);
770                         this.channel_id = obj.channel_id;
771                         byte[] user_channel_id = obj.user_channel_id;
772                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
773                         this.user_channel_id = user_channel_id_conv;
774                         this.former_temporary_channel_id = obj.former_temporary_channel_id;
775                         this.counterparty_node_id = obj.counterparty_node_id;
776                         long funding_txo = obj.funding_txo;
777                         org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); }
778                         if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
779                         this.funding_txo = funding_txo_hu_conv;
780                 }
781         }
782         /**
783          * Used to indicate that a channel with the given `channel_id` is ready to
784          * be used. This event is emitted either when the funding transaction has been confirmed
785          * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
786          * establishment.
787          */
788         public final static class ChannelReady extends Event {
789                 /**
790                  * The `channel_id` of the channel that is ready.
791                 */
792                 public final byte[] channel_id;
793                 /**
794                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
795                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
796                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
797                  * `user_channel_id` will be randomized for an inbound channel.
798                  * 
799                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
800                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
801                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
802                 */
803                 public final org.ldk.util.UInt128 user_channel_id;
804                 /**
805                  * The `node_id` of the channel counterparty.
806                 */
807                 public final byte[] counterparty_node_id;
808                 /**
809                  * The features that this channel will operate with.
810                 */
811                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
812                 private ChannelReady(long ptr, bindings.LDKEvent.ChannelReady obj) {
813                         super(null, ptr);
814                         this.channel_id = obj.channel_id;
815                         byte[] user_channel_id = obj.user_channel_id;
816                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
817                         this.user_channel_id = user_channel_id_conv;
818                         this.counterparty_node_id = obj.counterparty_node_id;
819                         long channel_type = obj.channel_type;
820                         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); }
821                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
822                         this.channel_type = channel_type_hu_conv;
823                 }
824         }
825         /**
826          * Used to indicate that a previously opened channel with the given `channel_id` is in the
827          * process of closure.
828          */
829         public final static class ChannelClosed extends Event {
830                 /**
831                  * The `channel_id` of the channel which has been closed. Note that on-chain transactions
832                  * resolving the channel are likely still awaiting confirmation.
833                 */
834                 public final byte[] channel_id;
835                 /**
836                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
837                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
838                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
839                  * `user_channel_id` will be randomized for inbound channels.
840                  * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
841                  * zero for objects serialized with LDK versions prior to 0.0.102.
842                  * 
843                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
844                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
845                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
846                 */
847                 public final org.ldk.util.UInt128 user_channel_id;
848                 /**
849                  * The reason the channel was closed.
850                 */
851                 public final org.ldk.structs.ClosureReason reason;
852                 private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
853                         super(null, ptr);
854                         this.channel_id = obj.channel_id;
855                         byte[] user_channel_id = obj.user_channel_id;
856                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
857                         this.user_channel_id = user_channel_id_conv;
858                         long reason = obj.reason;
859                         org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
860                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
861                         this.reason = reason_hu_conv;
862                 }
863         }
864         /**
865          * Used to indicate to the user that they can abandon the funding transaction and recycle the
866          * inputs for another purpose.
867          */
868         public final static class DiscardFunding extends Event {
869                 /**
870                  * The channel_id of the channel which has been closed.
871                 */
872                 public final byte[] channel_id;
873                 /**
874                  * The full transaction received from the user
875                 */
876                 public final byte[] transaction;
877                 private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
878                         super(null, ptr);
879                         this.channel_id = obj.channel_id;
880                         this.transaction = obj.transaction;
881                 }
882         }
883         /**
884          * Indicates a request to open a new channel by a peer.
885          * 
886          * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
887          * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
888          * 
889          * The event is only triggered when a new open channel request is received and the
890          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
891          * 
892          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
893          * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
894          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
895          */
896         public final static class OpenChannelRequest extends Event {
897                 /**
898                  * The temporary channel ID of the channel requested to be opened.
899                  * 
900                  * When responding to the request, the `temporary_channel_id` should be passed
901                  * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
902                  * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
903                  * 
904                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
905                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
906                 */
907                 public final byte[] temporary_channel_id;
908                 /**
909                  * The node_id of the counterparty requesting to open the channel.
910                  * 
911                  * When responding to the request, the `counterparty_node_id` should be passed
912                  * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
913                  * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
914                  * request.
915                  * 
916                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
917                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
918                 */
919                 public final byte[] counterparty_node_id;
920                 /**
921                  * The channel value of the requested channel.
922                 */
923                 public final long funding_satoshis;
924                 /**
925                  * Our starting balance in the channel if the request is accepted, in milli-satoshi.
926                 */
927                 public final long push_msat;
928                 /**
929                  * The features that this channel will operate with. If you reject the channel, a
930                  * well-behaved counterparty may automatically re-attempt the channel with a new set of
931                  * feature flags.
932                  * 
933                  * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
934                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
935                  * 0.0.106.
936                  * 
937                  * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
938                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
939                  * 0.0.107. Channels setting this type also need to get manually accepted via
940                  * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
941                  * or will be rejected otherwise.
942                  * 
943                  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
944                 */
945                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
946                 private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
947                         super(null, ptr);
948                         this.temporary_channel_id = obj.temporary_channel_id;
949                         this.counterparty_node_id = obj.counterparty_node_id;
950                         this.funding_satoshis = obj.funding_satoshis;
951                         this.push_msat = obj.push_msat;
952                         long channel_type = obj.channel_type;
953                         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); }
954                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
955                         this.channel_type = channel_type_hu_conv;
956                 }
957         }
958         /**
959          * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
960          * forward it.
961          * 
962          * Some scenarios where this event may be sent include:
963          * Insufficient capacity in the outbound channel
964          * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
965          * When an unknown SCID is requested for forwarding a payment.
966          * Expected MPP amount has already been reached
967          * The HTLC has timed out
968          * 
969          * This event, however, does not get generated if an HTLC fails to meet the forwarding
970          * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
971          */
972         public final static class HTLCHandlingFailed extends Event {
973                 /**
974                  * The channel over which the HTLC was received.
975                 */
976                 public final byte[] prev_channel_id;
977                 /**
978                  * Destination of the HTLC that failed to be processed.
979                 */
980                 public final org.ldk.structs.HTLCDestination failed_next_destination;
981                 private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
982                         super(null, ptr);
983                         this.prev_channel_id = obj.prev_channel_id;
984                         long failed_next_destination = obj.failed_next_destination;
985                         org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
986                         if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
987                         this.failed_next_destination = failed_next_destination_hu_conv;
988                 }
989         }
990         long clone_ptr() {
991                 long ret = bindings.Event_clone_ptr(this.ptr);
992                 Reference.reachabilityFence(this);
993                 return ret;
994         }
995
996         /**
997          * Creates a copy of the Event
998          */
999         public Event clone() {
1000                 long ret = bindings.Event_clone(this.ptr);
1001                 Reference.reachabilityFence(this);
1002                 if (ret >= 0 && ret <= 4096) { return null; }
1003                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1004                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1005                 return ret_hu_conv;
1006         }
1007
1008         /**
1009          * Utility method to constructs a new FundingGenerationReady-variant Event
1010          */
1011         public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) {
1012                 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.getLEBytes());
1013                 Reference.reachabilityFence(temporary_channel_id);
1014                 Reference.reachabilityFence(counterparty_node_id);
1015                 Reference.reachabilityFence(channel_value_satoshis);
1016                 Reference.reachabilityFence(output_script);
1017                 Reference.reachabilityFence(user_channel_id);
1018                 if (ret >= 0 && ret <= 4096) { return null; }
1019                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1020                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1021                 return ret_hu_conv;
1022         }
1023
1024         /**
1025          * Utility method to constructs a new PaymentClaimable-variant Event
1026          */
1027         public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
1028                 long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr, claim_deadline.ptr);
1029                 Reference.reachabilityFence(receiver_node_id);
1030                 Reference.reachabilityFence(payment_hash);
1031                 Reference.reachabilityFence(onion_fields);
1032                 Reference.reachabilityFence(amount_msat);
1033                 Reference.reachabilityFence(purpose);
1034                 Reference.reachabilityFence(via_channel_id);
1035                 Reference.reachabilityFence(via_user_channel_id);
1036                 Reference.reachabilityFence(claim_deadline);
1037                 if (ret >= 0 && ret <= 4096) { return null; }
1038                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1039                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1040                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(onion_fields); };
1041                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1042                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_user_channel_id); };
1043                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(claim_deadline); };
1044                 return ret_hu_conv;
1045         }
1046
1047         /**
1048          * Utility method to constructs a new PaymentClaimed-variant Event
1049          */
1050         public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose) {
1051                 long ret = bindings.Event_payment_claimed(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
1052                 Reference.reachabilityFence(receiver_node_id);
1053                 Reference.reachabilityFence(payment_hash);
1054                 Reference.reachabilityFence(amount_msat);
1055                 Reference.reachabilityFence(purpose);
1056                 if (ret >= 0 && ret <= 4096) { return null; }
1057                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1058                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1059                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1060                 return ret_hu_conv;
1061         }
1062
1063         /**
1064          * Utility method to constructs a new PaymentSent-variant Event
1065          */
1066         public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
1067                 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);
1068                 Reference.reachabilityFence(payment_id);
1069                 Reference.reachabilityFence(payment_preimage);
1070                 Reference.reachabilityFence(payment_hash);
1071                 Reference.reachabilityFence(fee_paid_msat);
1072                 if (ret >= 0 && ret <= 4096) { return null; }
1073                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1074                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1075                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); };
1076                 return ret_hu_conv;
1077         }
1078
1079         /**
1080          * Utility method to constructs a new PaymentFailed-variant Event
1081          */
1082         public static Event payment_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Option_PaymentFailureReasonZ reason) {
1083                 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), reason.ptr);
1084                 Reference.reachabilityFence(payment_id);
1085                 Reference.reachabilityFence(payment_hash);
1086                 Reference.reachabilityFence(reason);
1087                 if (ret >= 0 && ret <= 4096) { return null; }
1088                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1089                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1090                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1091                 return ret_hu_conv;
1092         }
1093
1094         /**
1095          * Utility method to constructs a new PaymentPathSuccessful-variant Event
1096          */
1097         public static Event payment_path_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
1098                 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr);
1099                 Reference.reachabilityFence(payment_id);
1100                 Reference.reachabilityFence(payment_hash);
1101                 Reference.reachabilityFence(path);
1102                 if (ret >= 0 && ret <= 4096) { return null; }
1103                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1104                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1105                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1106                 return ret_hu_conv;
1107         }
1108
1109         /**
1110          * Utility method to constructs a new PaymentPathFailed-variant Event
1111          */
1112         public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.PathFailure failure, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
1113                 long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path == null ? 0 : path.ptr, short_channel_id.ptr);
1114                 Reference.reachabilityFence(payment_id);
1115                 Reference.reachabilityFence(payment_hash);
1116                 Reference.reachabilityFence(payment_failed_permanently);
1117                 Reference.reachabilityFence(failure);
1118                 Reference.reachabilityFence(path);
1119                 Reference.reachabilityFence(short_channel_id);
1120                 if (ret >= 0 && ret <= 4096) { return null; }
1121                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1122                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1123                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
1124                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1125                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1126                 return ret_hu_conv;
1127         }
1128
1129         /**
1130          * Utility method to constructs a new ProbeSuccessful-variant Event
1131          */
1132         public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
1133                 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr);
1134                 Reference.reachabilityFence(payment_id);
1135                 Reference.reachabilityFence(payment_hash);
1136                 Reference.reachabilityFence(path);
1137                 if (ret >= 0 && ret <= 4096) { return null; }
1138                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1139                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1140                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1141                 return ret_hu_conv;
1142         }
1143
1144         /**
1145          * Utility method to constructs a new ProbeFailed-variant Event
1146          */
1147         public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
1148                 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr, short_channel_id.ptr);
1149                 Reference.reachabilityFence(payment_id);
1150                 Reference.reachabilityFence(payment_hash);
1151                 Reference.reachabilityFence(path);
1152                 Reference.reachabilityFence(short_channel_id);
1153                 if (ret >= 0 && ret <= 4096) { return null; }
1154                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1155                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1156                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1157                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1158                 return ret_hu_conv;
1159         }
1160
1161         /**
1162          * Utility method to constructs a new PendingHTLCsForwardable-variant Event
1163          */
1164         public static Event pending_htlcs_forwardable(long time_forwardable) {
1165                 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
1166                 Reference.reachabilityFence(time_forwardable);
1167                 if (ret >= 0 && ret <= 4096) { return null; }
1168                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1169                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1170                 return ret_hu_conv;
1171         }
1172
1173         /**
1174          * Utility method to constructs a new HTLCIntercepted-variant Event
1175          */
1176         public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
1177                 long ret = bindings.Event_htlcintercepted(InternalUtils.check_arr_len(intercept_id, 32), requested_next_hop_scid, InternalUtils.check_arr_len(payment_hash, 32), inbound_amount_msat, expected_outbound_amount_msat);
1178                 Reference.reachabilityFence(intercept_id);
1179                 Reference.reachabilityFence(requested_next_hop_scid);
1180                 Reference.reachabilityFence(payment_hash);
1181                 Reference.reachabilityFence(inbound_amount_msat);
1182                 Reference.reachabilityFence(expected_outbound_amount_msat);
1183                 if (ret >= 0 && ret <= 4096) { return null; }
1184                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1185                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1186                 return ret_hu_conv;
1187         }
1188
1189         /**
1190          * Utility method to constructs a new SpendableOutputs-variant Event
1191          */
1192         public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) {
1193                 long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null);
1194                 Reference.reachabilityFence(outputs);
1195                 if (ret >= 0 && ret <= 4096) { return null; }
1196                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1197                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1198                 for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; };
1199                 return ret_hu_conv;
1200         }
1201
1202         /**
1203          * Utility method to constructs a new PaymentForwarded-variant Event
1204          */
1205         public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) {
1206                 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, outbound_amount_forwarded_msat.ptr);
1207                 Reference.reachabilityFence(prev_channel_id);
1208                 Reference.reachabilityFence(next_channel_id);
1209                 Reference.reachabilityFence(fee_earned_msat);
1210                 Reference.reachabilityFence(claim_from_onchain_tx);
1211                 Reference.reachabilityFence(outbound_amount_forwarded_msat);
1212                 if (ret >= 0 && ret <= 4096) { return null; }
1213                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1214                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1215                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_earned_msat); };
1216                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_amount_forwarded_msat); };
1217                 return ret_hu_conv;
1218         }
1219
1220         /**
1221          * Utility method to constructs a new ChannelPending-variant Event
1222          */
1223         public static Event channel_pending(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo) {
1224                 long ret = bindings.Event_channel_pending(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(former_temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_txo == null ? 0 : funding_txo.ptr);
1225                 Reference.reachabilityFence(channel_id);
1226                 Reference.reachabilityFence(user_channel_id);
1227                 Reference.reachabilityFence(former_temporary_channel_id);
1228                 Reference.reachabilityFence(counterparty_node_id);
1229                 Reference.reachabilityFence(funding_txo);
1230                 if (ret >= 0 && ret <= 4096) { return null; }
1231                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1232                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1233                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
1234                 return ret_hu_conv;
1235         }
1236
1237         /**
1238          * Utility method to constructs a new ChannelReady-variant Event
1239          */
1240         public static Event channel_ready(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) {
1241                 long ret = bindings.Event_channel_ready(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_type == null ? 0 : channel_type.ptr);
1242                 Reference.reachabilityFence(channel_id);
1243                 Reference.reachabilityFence(user_channel_id);
1244                 Reference.reachabilityFence(counterparty_node_id);
1245                 Reference.reachabilityFence(channel_type);
1246                 if (ret >= 0 && ret <= 4096) { return null; }
1247                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1248                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1249                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1250                 return ret_hu_conv;
1251         }
1252
1253         /**
1254          * Utility method to constructs a new ChannelClosed-variant Event
1255          */
1256         public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason) {
1257                 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr);
1258                 Reference.reachabilityFence(channel_id);
1259                 Reference.reachabilityFence(user_channel_id);
1260                 Reference.reachabilityFence(reason);
1261                 if (ret >= 0 && ret <= 4096) { return null; }
1262                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1263                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1264                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1265                 return ret_hu_conv;
1266         }
1267
1268         /**
1269          * Utility method to constructs a new DiscardFunding-variant Event
1270          */
1271         public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1272                 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1273                 Reference.reachabilityFence(channel_id);
1274                 Reference.reachabilityFence(transaction);
1275                 if (ret >= 0 && ret <= 4096) { return null; }
1276                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1277                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1278                 return ret_hu_conv;
1279         }
1280
1281         /**
1282          * Utility method to constructs a new OpenChannelRequest-variant Event
1283          */
1284         public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) {
1285                 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);
1286                 Reference.reachabilityFence(temporary_channel_id);
1287                 Reference.reachabilityFence(counterparty_node_id);
1288                 Reference.reachabilityFence(funding_satoshis);
1289                 Reference.reachabilityFence(push_msat);
1290                 Reference.reachabilityFence(channel_type);
1291                 if (ret >= 0 && ret <= 4096) { return null; }
1292                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1293                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1294                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1295                 return ret_hu_conv;
1296         }
1297
1298         /**
1299          * Utility method to constructs a new HTLCHandlingFailed-variant Event
1300          */
1301         public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
1302                 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1303                 Reference.reachabilityFence(prev_channel_id);
1304                 Reference.reachabilityFence(failed_next_destination);
1305                 if (ret >= 0 && ret <= 4096) { return null; }
1306                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1307                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1308                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); };
1309                 return ret_hu_conv;
1310         }
1311
1312         /**
1313          * Checks if two Events contain equal inner contents.
1314          * This ignores pointers and is_owned flags and looks at the values in fields.
1315          */
1316         public boolean eq(org.ldk.structs.Event b) {
1317                 boolean ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr);
1318                 Reference.reachabilityFence(this);
1319                 Reference.reachabilityFence(b);
1320                 return ret;
1321         }
1322
1323         @Override public boolean equals(Object o) {
1324                 if (!(o instanceof Event)) return false;
1325                 return this.eq((Event)o);
1326         }
1327         /**
1328          * Serialize the Event object into a byte array which can be read by Event_read
1329          */
1330         public byte[] write() {
1331                 byte[] ret = bindings.Event_write(this.ptr);
1332                 Reference.reachabilityFence(this);
1333                 return ret;
1334         }
1335
1336 }