[Java] Print error stack trace when tests fail
[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.ConnectionNeeded.class) {
38                         return new ConnectionNeeded(ptr, (bindings.LDKEvent.ConnectionNeeded)raw_val);
39                 }
40                 if (raw_val.getClass() == bindings.LDKEvent.InvoiceRequestFailed.class) {
41                         return new InvoiceRequestFailed(ptr, (bindings.LDKEvent.InvoiceRequestFailed)raw_val);
42                 }
43                 if (raw_val.getClass() == bindings.LDKEvent.PaymentSent.class) {
44                         return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val);
45                 }
46                 if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) {
47                         return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val);
48                 }
49                 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) {
50                         return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val);
51                 }
52                 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
53                         return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
54                 }
55                 if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) {
56                         return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val);
57                 }
58                 if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) {
59                         return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val);
60                 }
61                 if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
62                         return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
63                 }
64                 if (raw_val.getClass() == bindings.LDKEvent.HTLCIntercepted.class) {
65                         return new HTLCIntercepted(ptr, (bindings.LDKEvent.HTLCIntercepted)raw_val);
66                 }
67                 if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
68                         return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
69                 }
70                 if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
71                         return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
72                 }
73                 if (raw_val.getClass() == bindings.LDKEvent.ChannelPending.class) {
74                         return new ChannelPending(ptr, (bindings.LDKEvent.ChannelPending)raw_val);
75                 }
76                 if (raw_val.getClass() == bindings.LDKEvent.ChannelReady.class) {
77                         return new ChannelReady(ptr, (bindings.LDKEvent.ChannelReady)raw_val);
78                 }
79                 if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
80                         return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
81                 }
82                 if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) {
83                         return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val);
84                 }
85                 if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
86                         return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
87                 }
88                 if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
89                         return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
90                 }
91                 if (raw_val.getClass() == bindings.LDKEvent.BumpTransaction.class) {
92                         return new BumpTransaction(ptr, (bindings.LDKEvent.BumpTransaction)raw_val);
93                 }
94                 assert false; return null; // Unreachable without extending the (internal) bindings interface
95         }
96
97         /**
98          * Used to indicate that the client should generate a funding transaction with the given
99          * parameters and then call [`ChannelManager::funding_transaction_generated`].
100          * Generated in [`ChannelManager`] message handling.
101          * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
102          * counterparty can steal your funds!
103          * 
104          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
105          * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
106          */
107         public final static class FundingGenerationReady extends Event {
108                 /**
109                  * The random channel_id we picked which you'll need to pass into
110                  * [`ChannelManager::funding_transaction_generated`].
111                  * 
112                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
113                 */
114                 public final org.ldk.structs.ChannelId temporary_channel_id;
115                 /**
116                  * The counterparty's node_id, which you'll need to pass back into
117                  * [`ChannelManager::funding_transaction_generated`].
118                  * 
119                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
120                 */
121                 public final byte[] counterparty_node_id;
122                 /**
123                  * The value, in satoshis, that the output should have.
124                 */
125                 public final long channel_value_satoshis;
126                 /**
127                  * The script which should be used in the transaction output.
128                 */
129                 public final byte[] output_script;
130                 /**
131                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
132                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
133                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
134                  * `user_channel_id` will be randomized for an inbound channel.  This may be zero for objects
135                  * serialized with LDK versions prior to 0.0.113.
136                  * 
137                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
138                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
139                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
140                 */
141                 public final org.ldk.util.UInt128 user_channel_id;
142                 private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
143                         super(null, ptr);
144                         long temporary_channel_id = obj.temporary_channel_id;
145                         org.ldk.structs.ChannelId temporary_channel_id_hu_conv = null; if (temporary_channel_id < 0 || temporary_channel_id > 4096) { temporary_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, temporary_channel_id); }
146                         if (temporary_channel_id_hu_conv != null) { temporary_channel_id_hu_conv.ptrs_to.add(this); };
147                         this.temporary_channel_id = temporary_channel_id_hu_conv;
148                         this.counterparty_node_id = obj.counterparty_node_id;
149                         this.channel_value_satoshis = obj.channel_value_satoshis;
150                         this.output_script = obj.output_script;
151                         byte[] user_channel_id = obj.user_channel_id;
152                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
153                         this.user_channel_id = user_channel_id_conv;
154                 }
155         }
156         /**
157          * Indicates that we've been offered a payment and it needs to be claimed via calling
158          * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
159          * 
160          * Note that if the preimage is not known, you should call
161          * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
162          * to free up resources for this HTLC and avoid network congestion.
163          * 
164          * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type
165          * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with
166          * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or
167          * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling.
168          * If you don't intend to check for custom TLVs, you can simply use
169          * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs.
170          * 
171          * If you fail to call [`ChannelManager::claim_funds`],
172          * [`ChannelManager::claim_funds_with_known_custom_tlvs`],
173          * [`ChannelManager::fail_htlc_backwards`], or
174          * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will
175          * be automatically failed.
176          * 
177          * # Note
178          * LDK will not stop an inbound payment from being paid multiple times, so multiple
179          * `PaymentClaimable` events may be generated for the same payment. In such a case it is
180          * polite (and required in the lightning specification) to fail the payment the second time
181          * and give the sender their money back rather than accepting double payment.
182          * 
183          * # Note
184          * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
185          * 
186          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
187          * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs
188          * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload
189          * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
190          * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
191          */
192         public final static class PaymentClaimable extends Event {
193                 /**
194                  * The node that will receive the payment after it has been claimed.
195                  * This is useful to identify payments received via [phantom nodes].
196                  * This field will always be filled in when the event was generated by LDK versions
197                  * 0.0.113 and above.
198                  * 
199                  * [phantom nodes]: crate::sign::PhantomKeysManager
200                  * 
201                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
202                 */
203                 @Nullable public final byte[] receiver_node_id;
204                 /**
205                  * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
206                  * not stop you from registering duplicate payment hashes for inbound payments.
207                 */
208                 public final byte[] payment_hash;
209                 /**
210                  * The fields in the onion which were received with each HTLC. Only fields which were
211                  * identical in each HTLC involved in the payment will be included here.
212                  * 
213                  * Payments received on LDK versions prior to 0.0.115 will have this field unset.
214                  * 
215                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
216                 */
217                 @Nullable public final org.ldk.structs.RecipientOnionFields onion_fields;
218                 /**
219                  * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
220                  * than the invoice amount.
221                  * 
222                  * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
223                  * and the previous hop took an extra fee.
224                  * 
225                  * # Note
226                  * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
227                  * field, you may lose money!
228                  * 
229                  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
230                 */
231                 public final long amount_msat;
232                 /**
233                  * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
234                  * taken by our channel counterparty.
235                  * 
236                  * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
237                  * 
238                  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
239                 */
240                 public final long counterparty_skimmed_fee_msat;
241                 /**
242                  * Information for claiming this received payment, based on whether the purpose of the
243                  * payment is to pay an invoice or to send a spontaneous payment.
244                 */
245                 public final org.ldk.structs.PaymentPurpose purpose;
246                 /**
247                  * The `channel_id` indicating over which channel we received the payment.
248                  * 
249                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
250                 */
251                 @Nullable public final org.ldk.structs.ChannelId via_channel_id;
252                 /**
253                  * The `user_channel_id` indicating over which channel we received the payment.
254                 */
255                 public final org.ldk.structs.Option_U128Z via_user_channel_id;
256                 /**
257                  * The block height at which this payment will be failed back and will no longer be
258                  * eligible for claiming.
259                  * 
260                  * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
261                  * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
262                  * 
263                  * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
264                 */
265                 public final org.ldk.structs.Option_u32Z claim_deadline;
266                 private PaymentClaimable(long ptr, bindings.LDKEvent.PaymentClaimable obj) {
267                         super(null, ptr);
268                         this.receiver_node_id = obj.receiver_node_id;
269                         this.payment_hash = obj.payment_hash;
270                         long onion_fields = obj.onion_fields;
271                         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); }
272                         if (onion_fields_hu_conv != null) { onion_fields_hu_conv.ptrs_to.add(this); };
273                         this.onion_fields = onion_fields_hu_conv;
274                         this.amount_msat = obj.amount_msat;
275                         this.counterparty_skimmed_fee_msat = obj.counterparty_skimmed_fee_msat;
276                         long purpose = obj.purpose;
277                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
278                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
279                         this.purpose = purpose_hu_conv;
280                         long via_channel_id = obj.via_channel_id;
281                         org.ldk.structs.ChannelId via_channel_id_hu_conv = null; if (via_channel_id < 0 || via_channel_id > 4096) { via_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, via_channel_id); }
282                         if (via_channel_id_hu_conv != null) { via_channel_id_hu_conv.ptrs_to.add(this); };
283                         this.via_channel_id = via_channel_id_hu_conv;
284                         long via_user_channel_id = obj.via_user_channel_id;
285                         org.ldk.structs.Option_U128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_U128Z.constr_from_ptr(via_user_channel_id);
286                         if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.add(this); };
287                         this.via_user_channel_id = via_user_channel_id_hu_conv;
288                         long claim_deadline = obj.claim_deadline;
289                         org.ldk.structs.Option_u32Z claim_deadline_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(claim_deadline);
290                         if (claim_deadline_hu_conv != null) { claim_deadline_hu_conv.ptrs_to.add(this); };
291                         this.claim_deadline = claim_deadline_hu_conv;
292                 }
293         }
294         /**
295          * Indicates a payment has been claimed and we've received money!
296          * 
297          * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
298          * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
299          * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
300          * [`Event::PaymentClaimable`] event.
301          * 
302          * # Note
303          * LDK will not stop an inbound payment from being paid multiple times, so multiple
304          * `PaymentClaimable` events may be generated for the same payment. If you then call
305          * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
306          * multiple `PaymentClaimed` events.
307          * 
308          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
309          */
310         public final static class PaymentClaimed extends Event {
311                 /**
312                  * The node that received the payment.
313                  * This is useful to identify payments which were received via [phantom nodes].
314                  * This field will always be filled in when the event was generated by LDK versions
315                  * 0.0.113 and above.
316                  * 
317                  * [phantom nodes]: crate::sign::PhantomKeysManager
318                  * 
319                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
320                 */
321                 @Nullable public final byte[] receiver_node_id;
322                 /**
323                  * The payment hash of the claimed payment. Note that LDK will not stop you from
324                  * registering duplicate payment hashes for inbound payments.
325                 */
326                 public final byte[] payment_hash;
327                 /**
328                  * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
329                  * invoice amount.
330                 */
331                 public final long amount_msat;
332                 /**
333                  * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
334                  * spontaneous payment.
335                 */
336                 public final org.ldk.structs.PaymentPurpose purpose;
337                 /**
338                  * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior
339                  * to LDK version 0.0.117.
340                 */
341                 public final ClaimedHTLC[] htlcs;
342                 /**
343                  * The sender-intended sum total of all the MPP parts. This will be `None` for events
344                  * serialized prior to LDK version 0.0.117.
345                 */
346                 public final org.ldk.structs.Option_u64Z sender_intended_total_msat;
347                 private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
348                         super(null, ptr);
349                         this.receiver_node_id = obj.receiver_node_id;
350                         this.payment_hash = obj.payment_hash;
351                         this.amount_msat = obj.amount_msat;
352                         long purpose = obj.purpose;
353                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
354                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
355                         this.purpose = purpose_hu_conv;
356                         long[] htlcs = obj.htlcs;
357                         int htlcs_conv_13_len = htlcs.length;
358                         ClaimedHTLC[] htlcs_conv_13_arr = new ClaimedHTLC[htlcs_conv_13_len];
359                         for (int n = 0; n < htlcs_conv_13_len; n++) {
360                                 long htlcs_conv_13 = htlcs[n];
361                                 org.ldk.structs.ClaimedHTLC htlcs_conv_13_hu_conv = null; if (htlcs_conv_13 < 0 || htlcs_conv_13 > 4096) { htlcs_conv_13_hu_conv = new org.ldk.structs.ClaimedHTLC(null, htlcs_conv_13); }
362                                 if (htlcs_conv_13_hu_conv != null) { htlcs_conv_13_hu_conv.ptrs_to.add(this); };
363                                 htlcs_conv_13_arr[n] = htlcs_conv_13_hu_conv;
364                         }
365                         this.htlcs = htlcs_conv_13_arr;
366                         long sender_intended_total_msat = obj.sender_intended_total_msat;
367                         org.ldk.structs.Option_u64Z sender_intended_total_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(sender_intended_total_msat);
368                         if (sender_intended_total_msat_hu_conv != null) { sender_intended_total_msat_hu_conv.ptrs_to.add(this); };
369                         this.sender_intended_total_msat = sender_intended_total_msat_hu_conv;
370                 }
371         }
372         /**
373          * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`].
374          * 
375          * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a
376          * [`Destination`]. Once a connection is established, any messages buffered by an
377          * [`OnionMessageHandler`] may be sent.
378          * 
379          * This event will not be generated for onion message forwards; only for sends including
380          * replies. Handlers should connect to the node otherwise any buffered messages may be lost.
381          * 
382          * [`OnionMessage`]: msgs::OnionMessage
383          * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter
384          * [`Destination`]: crate::onion_message::messenger::Destination
385          * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler
386          */
387         public final static class ConnectionNeeded extends Event {
388                 /**
389                  * The node id for the node needing a connection.
390                 */
391                 public final byte[] node_id;
392                 /**
393                  * Sockets for connecting to the node.
394                 */
395                 public final SocketAddress[] addresses;
396                 private ConnectionNeeded(long ptr, bindings.LDKEvent.ConnectionNeeded obj) {
397                         super(null, ptr);
398                         this.node_id = obj.node_id;
399                         long[] addresses = obj.addresses;
400                         int addresses_conv_15_len = addresses.length;
401                         SocketAddress[] addresses_conv_15_arr = new SocketAddress[addresses_conv_15_len];
402                         for (int p = 0; p < addresses_conv_15_len; p++) {
403                                 long addresses_conv_15 = addresses[p];
404                                 org.ldk.structs.SocketAddress addresses_conv_15_hu_conv = org.ldk.structs.SocketAddress.constr_from_ptr(addresses_conv_15);
405                                 if (addresses_conv_15_hu_conv != null) { addresses_conv_15_hu_conv.ptrs_to.add(this); };
406                                 addresses_conv_15_arr[p] = addresses_conv_15_hu_conv;
407                         }
408                         this.addresses = addresses_conv_15_arr;
409                 }
410         }
411         /**
412          * Indicates a request for an invoice failed to yield a response in a reasonable amount of time
413          * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an
414          * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed.
415          * 
416          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
417          * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
418          * [`Offer`]: crate::offers::offer::Offer
419          * [`Refund`]: crate::offers::refund::Refund
420          */
421         public final static class InvoiceRequestFailed extends Event {
422                 /**
423                  * The `payment_id` to have been associated with payment for the requested invoice.
424                 */
425                 public final byte[] payment_id;
426                 private InvoiceRequestFailed(long ptr, bindings.LDKEvent.InvoiceRequestFailed obj) {
427                         super(null, ptr);
428                         this.payment_id = obj.payment_id;
429                 }
430         }
431         /**
432          * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
433          * and we got back the payment preimage for it).
434          * 
435          * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
436          * event. In this situation, you SHOULD treat this payment as having succeeded.
437          */
438         public final static class PaymentSent extends Event {
439                 /**
440                  * The `payment_id` passed to [`ChannelManager::send_payment`].
441                  * 
442                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
443                 */
444                 public final org.ldk.structs.Option_ThirtyTwoBytesZ payment_id;
445                 /**
446                  * The preimage to the hash given to ChannelManager::send_payment.
447                  * Note that this serves as a payment receipt, if you wish to have such a thing, you must
448                  * store it somehow!
449                 */
450                 public final byte[] payment_preimage;
451                 /**
452                  * The hash that was given to [`ChannelManager::send_payment`].
453                  * 
454                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
455                 */
456                 public final byte[] payment_hash;
457                 /**
458                  * The total fee which was spent at intermediate hops in this payment, across all paths.
459                  * 
460                  * Note that, like [`Route::get_total_fees`] this does *not* include any potential
461                  * overpayment to the recipient node.
462                  * 
463                  * If the recipient or an intermediate node misbehaves and gives us free money, this may
464                  * overstate the amount paid, though this is unlikely.
465                  * 
466                  * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
467                 */
468                 public final org.ldk.structs.Option_u64Z fee_paid_msat;
469                 private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
470                         super(null, ptr);
471                         long payment_id = obj.payment_id;
472                         org.ldk.structs.Option_ThirtyTwoBytesZ payment_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id);
473                         if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
474                         this.payment_id = payment_id_hu_conv;
475                         this.payment_preimage = obj.payment_preimage;
476                         this.payment_hash = obj.payment_hash;
477                         long fee_paid_msat = obj.fee_paid_msat;
478                         org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
479                         if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
480                         this.fee_paid_msat = fee_paid_msat_hu_conv;
481                 }
482         }
483         /**
484          * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
485          * provide failure information for each path attempt in the payment, including retries.
486          * 
487          * This event is provided once there are no further pending HTLCs for the payment and the
488          * payment is no longer retryable, due either to the [`Retry`] provided or
489          * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
490          * 
491          * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for
492          * a payment after an [`Event::PaymentSent`] event for this same payment has already been
493          * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored,
494          * and the payment MUST be treated as having succeeded.
495          * 
496          * [`Retry`]: crate::ln::channelmanager::Retry
497          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
498          */
499         public final static class PaymentFailed extends Event {
500                 /**
501                  * The `payment_id` passed to [`ChannelManager::send_payment`].
502                  * 
503                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
504                 */
505                 public final byte[] payment_id;
506                 /**
507                  * The hash that was given to [`ChannelManager::send_payment`].
508                  * 
509                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
510                 */
511                 public final byte[] payment_hash;
512                 /**
513                  * The reason the payment failed. This is only `None` for events generated or serialized
514                  * by versions prior to 0.0.115.
515                 */
516                 public final org.ldk.structs.Option_PaymentFailureReasonZ reason;
517                 private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
518                         super(null, ptr);
519                         this.payment_id = obj.payment_id;
520                         this.payment_hash = obj.payment_hash;
521                         long reason = obj.reason;
522                         org.ldk.structs.Option_PaymentFailureReasonZ reason_hu_conv = org.ldk.structs.Option_PaymentFailureReasonZ.constr_from_ptr(reason);
523                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
524                         this.reason = reason_hu_conv;
525                 }
526         }
527         /**
528          * Indicates that a path for an outbound payment was successful.
529          * 
530          * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
531          * [`Event::PaymentSent`] for obtaining the payment preimage.
532          */
533         public final static class PaymentPathSuccessful extends Event {
534                 /**
535                  * The `payment_id` passed to [`ChannelManager::send_payment`].
536                  * 
537                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
538                 */
539                 public final byte[] payment_id;
540                 /**
541                  * The hash that was given to [`ChannelManager::send_payment`].
542                  * 
543                  * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
544                  * 
545                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
546                 */
547                 public final org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash;
548                 /**
549                  * The payment path that was successful.
550                  * 
551                  * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
552                 */
553                 public final org.ldk.structs.Path path;
554                 private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
555                         super(null, ptr);
556                         this.payment_id = obj.payment_id;
557                         long payment_hash = obj.payment_hash;
558                         org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(payment_hash);
559                         if (payment_hash_hu_conv != null) { payment_hash_hu_conv.ptrs_to.add(this); };
560                         this.payment_hash = payment_hash_hu_conv;
561                         long path = obj.path;
562                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
563                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
564                         this.path = path_hu_conv;
565                 }
566         }
567         /**
568          * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
569          * handle the HTLC.
570          * 
571          * Note that this does *not* indicate that all paths for an MPP payment have failed, see
572          * [`Event::PaymentFailed`].
573          * 
574          * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
575          * been exhausted.
576          * 
577          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
578          */
579         public final static class PaymentPathFailed extends Event {
580                 /**
581                  * The `payment_id` passed to [`ChannelManager::send_payment`].
582                  * 
583                  * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
584                  * 
585                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
586                  * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
587                 */
588                 public final org.ldk.structs.Option_ThirtyTwoBytesZ payment_id;
589                 /**
590                  * The hash that was given to [`ChannelManager::send_payment`].
591                  * 
592                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
593                 */
594                 public final byte[] payment_hash;
595                 /**
596                  * Indicates the payment was rejected for some reason by the recipient. This implies that
597                  * the payment has failed, not just the route in question. If this is not set, the payment may
598                  * be retried via a different route.
599                 */
600                 public final boolean payment_failed_permanently;
601                 /**
602                  * Extra error details based on the failure type. May contain an update that needs to be
603                  * applied to the [`NetworkGraph`].
604                  * 
605                  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
606                 */
607                 public final org.ldk.structs.PathFailure failure;
608                 /**
609                  * The payment path that failed.
610                 */
611                 public final org.ldk.structs.Path path;
612                 /**
613                  * The channel responsible for the failed payment path.
614                  * 
615                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
616                  * may not refer to a channel in the public network graph. These aliases may also collide
617                  * with channels in the public network graph.
618                  * 
619                  * If this is `Some`, then the corresponding channel should be avoided when the payment is
620                  * retried. May be `None` for older [`Event`] serializations.
621                 */
622                 public final org.ldk.structs.Option_u64Z short_channel_id;
623                 private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
624                         super(null, ptr);
625                         long payment_id = obj.payment_id;
626                         org.ldk.structs.Option_ThirtyTwoBytesZ payment_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id);
627                         if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
628                         this.payment_id = payment_id_hu_conv;
629                         this.payment_hash = obj.payment_hash;
630                         this.payment_failed_permanently = obj.payment_failed_permanently;
631                         long failure = obj.failure;
632                         org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure);
633                         if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.add(this); };
634                         this.failure = failure_hu_conv;
635                         long path = obj.path;
636                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
637                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
638                         this.path = path_hu_conv;
639                         long short_channel_id = obj.short_channel_id;
640                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
641                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
642                         this.short_channel_id = short_channel_id_hu_conv;
643                 }
644         }
645         /**
646          * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
647          */
648         public final static class ProbeSuccessful extends Event {
649                 /**
650                  * The id returned by [`ChannelManager::send_probe`].
651                  * 
652                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
653                 */
654                 public final byte[] payment_id;
655                 /**
656                  * The hash generated by [`ChannelManager::send_probe`].
657                  * 
658                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
659                 */
660                 public final byte[] payment_hash;
661                 /**
662                  * The payment path that was successful.
663                 */
664                 public final org.ldk.structs.Path path;
665                 private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
666                         super(null, ptr);
667                         this.payment_id = obj.payment_id;
668                         this.payment_hash = obj.payment_hash;
669                         long path = obj.path;
670                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
671                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
672                         this.path = path_hu_conv;
673                 }
674         }
675         /**
676          * Indicates that a probe payment we sent failed at an intermediary node on the path.
677          */
678         public final static class ProbeFailed extends Event {
679                 /**
680                  * The id returned by [`ChannelManager::send_probe`].
681                  * 
682                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
683                 */
684                 public final byte[] payment_id;
685                 /**
686                  * The hash generated by [`ChannelManager::send_probe`].
687                  * 
688                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
689                 */
690                 public final byte[] payment_hash;
691                 /**
692                  * The payment path that failed.
693                 */
694                 public final org.ldk.structs.Path path;
695                 /**
696                  * The channel responsible for the failed probe.
697                  * 
698                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
699                  * may not refer to a channel in the public network graph. These aliases may also collide
700                  * with channels in the public network graph.
701                 */
702                 public final org.ldk.structs.Option_u64Z short_channel_id;
703                 private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
704                         super(null, ptr);
705                         this.payment_id = obj.payment_id;
706                         this.payment_hash = obj.payment_hash;
707                         long path = obj.path;
708                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
709                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
710                         this.path = path_hu_conv;
711                         long short_channel_id = obj.short_channel_id;
712                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
713                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
714                         this.short_channel_id = short_channel_id_hu_conv;
715                 }
716         }
717         /**
718          * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
719          * a time in the future.
720          * 
721          * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
722          */
723         public final static class PendingHTLCsForwardable extends Event {
724                 /**
725                  * The minimum amount of time that should be waited prior to calling
726                  * process_pending_htlc_forwards. To increase the effort required to correlate payments,
727                  * you should wait a random amount of time in roughly the range (now + time_forwardable,
728                  * now + 5*time_forwardable).
729                 */
730                 public final long time_forwardable;
731                 private PendingHTLCsForwardable(long ptr, bindings.LDKEvent.PendingHTLCsForwardable obj) {
732                         super(null, ptr);
733                         this.time_forwardable = obj.time_forwardable;
734                 }
735         }
736         /**
737          * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
738          * you've encoded an intercept scid in the receiver's invoice route hints using
739          * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
740          * 
741          * [`ChannelManager::forward_intercepted_htlc`] or
742          * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
743          * their docs for more information.
744          * 
745          * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
746          * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
747          * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
748          * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
749          */
750         public final static class HTLCIntercepted extends Event {
751                 /**
752                  * An id to help LDK identify which HTLC is being forwarded or failed.
753                 */
754                 public final byte[] intercept_id;
755                 /**
756                  * The fake scid that was programmed as the next hop's scid, generated using
757                  * [`ChannelManager::get_intercept_scid`].
758                  * 
759                  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
760                 */
761                 public final long requested_next_hop_scid;
762                 /**
763                  * The payment hash used for this HTLC.
764                 */
765                 public final byte[] payment_hash;
766                 /**
767                  * How many msats were received on the inbound edge of this HTLC.
768                 */
769                 public final long inbound_amount_msat;
770                 /**
771                  * How many msats the payer intended to route to the next node. Depending on the reason you are
772                  * intercepting this payment, you might take a fee by forwarding less than this amount.
773                  * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
774                  * 
775                  * Note that LDK will NOT check that expected fees were factored into this value. You MUST
776                  * check that whatever fee you want has been included here or subtract it as required. Further,
777                  * LDK will not stop you from forwarding more than you received.
778                 */
779                 public final long expected_outbound_amount_msat;
780                 private HTLCIntercepted(long ptr, bindings.LDKEvent.HTLCIntercepted obj) {
781                         super(null, ptr);
782                         this.intercept_id = obj.intercept_id;
783                         this.requested_next_hop_scid = obj.requested_next_hop_scid;
784                         this.payment_hash = obj.payment_hash;
785                         this.inbound_amount_msat = obj.inbound_amount_msat;
786                         this.expected_outbound_amount_msat = obj.expected_outbound_amount_msat;
787                 }
788         }
789         /**
790          * Used to indicate that an output which you should know how to spend was confirmed on chain
791          * and is now spendable.
792          * 
793          * Such an output will *never* be spent directly by LDK, and are not at risk of your
794          * counterparty spending them due to some kind of timeout. Thus, you need to store them
795          * somewhere and spend them when you create on-chain transactions.
796          * 
797          * You may hand them to the [`OutputSweeper`] utility which will store and (re-)generate spending
798          * transactions for you.
799          * 
800          * [`OutputSweeper`]: crate::util::sweep::OutputSweeper
801          */
802         public final static class SpendableOutputs extends Event {
803                 /**
804                  * The outputs which you should store as spendable by you.
805                 */
806                 public final SpendableOutputDescriptor[] outputs;
807                 /**
808                  * The `channel_id` indicating which channel the spendable outputs belong to.
809                  * 
810                  * This will always be `Some` for events generated by LDK versions 0.0.117 and above.
811                  * 
812                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
813                 */
814                 @Nullable public final org.ldk.structs.ChannelId channel_id;
815                 private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) {
816                         super(null, ptr);
817                         long[] outputs = obj.outputs;
818                         int outputs_conv_27_len = outputs.length;
819                         SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
820                         for (int b = 0; b < outputs_conv_27_len; b++) {
821                                 long outputs_conv_27 = outputs[b];
822                                 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
823                                 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
824                                 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
825                         }
826                         this.outputs = outputs_conv_27_arr;
827                         long channel_id = obj.channel_id;
828                         org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); }
829                         if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
830                         this.channel_id = channel_id_hu_conv;
831                 }
832         }
833         /**
834          * This event is generated when a payment has been successfully forwarded through us and a
835          * forwarding fee earned.
836          */
837         public final static class PaymentForwarded extends Event {
838                 /**
839                  * The channel id of the incoming channel between the previous node and us.
840                  * 
841                  * This is only `None` for events generated or serialized by versions prior to 0.0.107.
842                  * 
843                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
844                 */
845                 @Nullable public final org.ldk.structs.ChannelId prev_channel_id;
846                 /**
847                  * The channel id of the outgoing channel between the next node and us.
848                  * 
849                  * This is only `None` for events generated or serialized by versions prior to 0.0.107.
850                  * 
851                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
852                 */
853                 @Nullable public final org.ldk.structs.ChannelId next_channel_id;
854                 /**
855                  * The `user_channel_id` of the incoming channel between the previous node and us.
856                  * 
857                  * This is only `None` for events generated or serialized by versions prior to 0.0.122.
858                 */
859                 public final org.ldk.structs.Option_U128Z prev_user_channel_id;
860                 /**
861                  * The `user_channel_id` of the outgoing channel between the next node and us.
862                  * 
863                  * This will be `None` if the payment was settled via an on-chain transaction. See the
864                  * caveat described for the `total_fee_earned_msat` field. Moreover it will be `None` for
865                  * events generated or serialized by versions prior to 0.0.122.
866                 */
867                 public final org.ldk.structs.Option_U128Z next_user_channel_id;
868                 /**
869                  * The total fee, in milli-satoshis, which was earned as a result of the payment.
870                  * 
871                  * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
872                  * was pending, the amount the next hop claimed will have been rounded down to the nearest
873                  * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
874                  * claimed the full value in millisatoshis from the source. In this case,
875                  * `claim_from_onchain_tx` will be set.
876                  * 
877                  * If the channel which sent us the payment has been force-closed, we will claim the funds
878                  * via an on-chain transaction. In that case we do not yet know the on-chain transaction
879                  * fees which we will spend and will instead set this to `None`. It is possible duplicate
880                  * `PaymentForwarded` events are generated for the same payment iff `total_fee_earned_msat` is
881                  * `None`.
882                 */
883                 public final org.ldk.structs.Option_u64Z total_fee_earned_msat;
884                 /**
885                  * The share of the total fee, in milli-satoshis, which was withheld in addition to the
886                  * forwarding fee.
887                  * 
888                  * This will only be `Some` if we forwarded an intercepted HTLC with less than the
889                  * expected amount. This means our counterparty accepted to receive less than the invoice
890                  * amount, e.g., by claiming the payment featuring a corresponding
891                  * [`PaymentClaimable::counterparty_skimmed_fee_msat`].
892                  * 
893                  * Will also always be `None` for events serialized with LDK prior to version 0.0.122.
894                  * 
895                  * The caveat described above the `total_fee_earned_msat` field applies here as well.
896                  * 
897                  * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: Self::PaymentClaimable::counterparty_skimmed_fee_msat
898                 */
899                 public final org.ldk.structs.Option_u64Z skimmed_fee_msat;
900                 /**
901                  * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
902                  * transaction.
903                 */
904                 public final boolean claim_from_onchain_tx;
905                 /**
906                  * The final amount forwarded, in milli-satoshis, after the fee is deducted.
907                  * 
908                  * The caveat described above the `total_fee_earned_msat` field applies here as well.
909                 */
910                 public final org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat;
911                 private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
912                         super(null, ptr);
913                         long prev_channel_id = obj.prev_channel_id;
914                         org.ldk.structs.ChannelId prev_channel_id_hu_conv = null; if (prev_channel_id < 0 || prev_channel_id > 4096) { prev_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, prev_channel_id); }
915                         if (prev_channel_id_hu_conv != null) { prev_channel_id_hu_conv.ptrs_to.add(this); };
916                         this.prev_channel_id = prev_channel_id_hu_conv;
917                         long next_channel_id = obj.next_channel_id;
918                         org.ldk.structs.ChannelId next_channel_id_hu_conv = null; if (next_channel_id < 0 || next_channel_id > 4096) { next_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, next_channel_id); }
919                         if (next_channel_id_hu_conv != null) { next_channel_id_hu_conv.ptrs_to.add(this); };
920                         this.next_channel_id = next_channel_id_hu_conv;
921                         long prev_user_channel_id = obj.prev_user_channel_id;
922                         org.ldk.structs.Option_U128Z prev_user_channel_id_hu_conv = org.ldk.structs.Option_U128Z.constr_from_ptr(prev_user_channel_id);
923                         if (prev_user_channel_id_hu_conv != null) { prev_user_channel_id_hu_conv.ptrs_to.add(this); };
924                         this.prev_user_channel_id = prev_user_channel_id_hu_conv;
925                         long next_user_channel_id = obj.next_user_channel_id;
926                         org.ldk.structs.Option_U128Z next_user_channel_id_hu_conv = org.ldk.structs.Option_U128Z.constr_from_ptr(next_user_channel_id);
927                         if (next_user_channel_id_hu_conv != null) { next_user_channel_id_hu_conv.ptrs_to.add(this); };
928                         this.next_user_channel_id = next_user_channel_id_hu_conv;
929                         long total_fee_earned_msat = obj.total_fee_earned_msat;
930                         org.ldk.structs.Option_u64Z total_fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(total_fee_earned_msat);
931                         if (total_fee_earned_msat_hu_conv != null) { total_fee_earned_msat_hu_conv.ptrs_to.add(this); };
932                         this.total_fee_earned_msat = total_fee_earned_msat_hu_conv;
933                         long skimmed_fee_msat = obj.skimmed_fee_msat;
934                         org.ldk.structs.Option_u64Z skimmed_fee_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(skimmed_fee_msat);
935                         if (skimmed_fee_msat_hu_conv != null) { skimmed_fee_msat_hu_conv.ptrs_to.add(this); };
936                         this.skimmed_fee_msat = skimmed_fee_msat_hu_conv;
937                         this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
938                         long outbound_amount_forwarded_msat = obj.outbound_amount_forwarded_msat;
939                         org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat);
940                         if (outbound_amount_forwarded_msat_hu_conv != null) { outbound_amount_forwarded_msat_hu_conv.ptrs_to.add(this); };
941                         this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv;
942                 }
943         }
944         /**
945          * Used to indicate that a channel with the given `channel_id` is being opened and pending
946          * confirmation on-chain.
947          * 
948          * This event is emitted when the funding transaction has been signed and is broadcast to the
949          * network. For 0conf channels it will be immediately followed by the corresponding
950          * [`Event::ChannelReady`] event.
951          */
952         public final static class ChannelPending extends Event {
953                 /**
954                  * The `channel_id` of the channel that is pending confirmation.
955                 */
956                 public final org.ldk.structs.ChannelId channel_id;
957                 /**
958                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
959                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
960                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
961                  * `user_channel_id` will be randomized for an inbound channel.
962                  * 
963                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
964                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
965                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
966                 */
967                 public final org.ldk.util.UInt128 user_channel_id;
968                 /**
969                  * The `temporary_channel_id` this channel used to be known by during channel establishment.
970                  * 
971                  * Will be `None` for channels created prior to LDK version 0.0.115.
972                  * 
973                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
974                 */
975                 @Nullable public final org.ldk.structs.ChannelId former_temporary_channel_id;
976                 /**
977                  * The `node_id` of the channel counterparty.
978                 */
979                 public final byte[] counterparty_node_id;
980                 /**
981                  * The outpoint of the channel's funding transaction.
982                 */
983                 public final org.ldk.structs.OutPoint funding_txo;
984                 /**
985                  * The features that this channel will operate with.
986                  * 
987                  * Will be `None` for channels created prior to LDK version 0.0.122.
988                  * 
989                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
990                 */
991                 @Nullable public final org.ldk.structs.ChannelTypeFeatures channel_type;
992                 private ChannelPending(long ptr, bindings.LDKEvent.ChannelPending obj) {
993                         super(null, ptr);
994                         long channel_id = obj.channel_id;
995                         org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); }
996                         if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
997                         this.channel_id = channel_id_hu_conv;
998                         byte[] user_channel_id = obj.user_channel_id;
999                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
1000                         this.user_channel_id = user_channel_id_conv;
1001                         long former_temporary_channel_id = obj.former_temporary_channel_id;
1002                         org.ldk.structs.ChannelId former_temporary_channel_id_hu_conv = null; if (former_temporary_channel_id < 0 || former_temporary_channel_id > 4096) { former_temporary_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, former_temporary_channel_id); }
1003                         if (former_temporary_channel_id_hu_conv != null) { former_temporary_channel_id_hu_conv.ptrs_to.add(this); };
1004                         this.former_temporary_channel_id = former_temporary_channel_id_hu_conv;
1005                         this.counterparty_node_id = obj.counterparty_node_id;
1006                         long funding_txo = obj.funding_txo;
1007                         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); }
1008                         if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
1009                         this.funding_txo = funding_txo_hu_conv;
1010                         long channel_type = obj.channel_type;
1011                         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); }
1012                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
1013                         this.channel_type = channel_type_hu_conv;
1014                 }
1015         }
1016         /**
1017          * Used to indicate that a channel with the given `channel_id` is ready to
1018          * be used. This event is emitted either when the funding transaction has been confirmed
1019          * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
1020          * establishment.
1021          */
1022         public final static class ChannelReady extends Event {
1023                 /**
1024                  * The `channel_id` of the channel that is ready.
1025                 */
1026                 public final org.ldk.structs.ChannelId channel_id;
1027                 /**
1028                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1029                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1030                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1031                  * `user_channel_id` will be randomized for an inbound channel.
1032                  * 
1033                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1034                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1035                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1036                 */
1037                 public final org.ldk.util.UInt128 user_channel_id;
1038                 /**
1039                  * The `node_id` of the channel counterparty.
1040                 */
1041                 public final byte[] counterparty_node_id;
1042                 /**
1043                  * The features that this channel will operate with.
1044                 */
1045                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
1046                 private ChannelReady(long ptr, bindings.LDKEvent.ChannelReady obj) {
1047                         super(null, ptr);
1048                         long channel_id = obj.channel_id;
1049                         org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); }
1050                         if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
1051                         this.channel_id = channel_id_hu_conv;
1052                         byte[] user_channel_id = obj.user_channel_id;
1053                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
1054                         this.user_channel_id = user_channel_id_conv;
1055                         this.counterparty_node_id = obj.counterparty_node_id;
1056                         long channel_type = obj.channel_type;
1057                         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); }
1058                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
1059                         this.channel_type = channel_type_hu_conv;
1060                 }
1061         }
1062         /**
1063          * Used to indicate that a channel that got past the initial handshake with the given `channel_id` is in the
1064          * process of closure. This includes previously opened channels, and channels that time out from not being funded.
1065          * 
1066          * Note that this event is only triggered for accepted channels: if the
1067          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is
1068          * rejected, no `ChannelClosed` event will be sent.
1069          * 
1070          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1071          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1072          */
1073         public final static class ChannelClosed extends Event {
1074                 /**
1075                  * The `channel_id` of the channel which has been closed. Note that on-chain transactions
1076                  * resolving the channel are likely still awaiting confirmation.
1077                 */
1078                 public final org.ldk.structs.ChannelId channel_id;
1079                 /**
1080                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1081                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1082                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1083                  * `user_channel_id` will be randomized for inbound channels.
1084                  * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
1085                  * zero for objects serialized with LDK versions prior to 0.0.102.
1086                  * 
1087                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1088                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1089                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1090                 */
1091                 public final org.ldk.util.UInt128 user_channel_id;
1092                 /**
1093                  * The reason the channel was closed.
1094                 */
1095                 public final org.ldk.structs.ClosureReason reason;
1096                 /**
1097                  * Counterparty in the closed channel.
1098                  * 
1099                  * This field will be `None` for objects serialized prior to LDK 0.0.117.
1100                  * 
1101                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1102                 */
1103                 @Nullable public final byte[] counterparty_node_id;
1104                 /**
1105                  * Channel capacity of the closing channel (sats).
1106                  * 
1107                  * This field will be `None` for objects serialized prior to LDK 0.0.117.
1108                 */
1109                 public final org.ldk.structs.Option_u64Z channel_capacity_sats;
1110                 /**
1111                  * The original channel funding TXO; this helps checking for the existence and confirmation
1112                  * status of the closing tx.
1113                  * Note that for instances serialized in v0.0.119 or prior this will be missing (None).
1114                  * 
1115                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1116                 */
1117                 @Nullable public final org.ldk.structs.OutPoint channel_funding_txo;
1118                 private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
1119                         super(null, ptr);
1120                         long channel_id = obj.channel_id;
1121                         org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); }
1122                         if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
1123                         this.channel_id = channel_id_hu_conv;
1124                         byte[] user_channel_id = obj.user_channel_id;
1125                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
1126                         this.user_channel_id = user_channel_id_conv;
1127                         long reason = obj.reason;
1128                         org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
1129                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
1130                         this.reason = reason_hu_conv;
1131                         this.counterparty_node_id = obj.counterparty_node_id;
1132                         long channel_capacity_sats = obj.channel_capacity_sats;
1133                         org.ldk.structs.Option_u64Z channel_capacity_sats_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(channel_capacity_sats);
1134                         if (channel_capacity_sats_hu_conv != null) { channel_capacity_sats_hu_conv.ptrs_to.add(this); };
1135                         this.channel_capacity_sats = channel_capacity_sats_hu_conv;
1136                         long channel_funding_txo = obj.channel_funding_txo;
1137                         org.ldk.structs.OutPoint channel_funding_txo_hu_conv = null; if (channel_funding_txo < 0 || channel_funding_txo > 4096) { channel_funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, channel_funding_txo); }
1138                         if (channel_funding_txo_hu_conv != null) { channel_funding_txo_hu_conv.ptrs_to.add(this); };
1139                         this.channel_funding_txo = channel_funding_txo_hu_conv;
1140                 }
1141         }
1142         /**
1143          * Used to indicate to the user that they can abandon the funding transaction and recycle the
1144          * inputs for another purpose.
1145          * 
1146          * This event is not guaranteed to be generated for channels that are closed due to a restart.
1147          */
1148         public final static class DiscardFunding extends Event {
1149                 /**
1150                  * The channel_id of the channel which has been closed.
1151                 */
1152                 public final org.ldk.structs.ChannelId channel_id;
1153                 /**
1154                  * The full transaction received from the user
1155                 */
1156                 public final byte[] transaction;
1157                 private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
1158                         super(null, ptr);
1159                         long channel_id = obj.channel_id;
1160                         org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); }
1161                         if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
1162                         this.channel_id = channel_id_hu_conv;
1163                         this.transaction = obj.transaction;
1164                 }
1165         }
1166         /**
1167          * Indicates a request to open a new channel by a peer.
1168          * 
1169          * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request,
1170          * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`]
1171          * event will _not_ be triggered if the channel is rejected.
1172          * 
1173          * The event is only triggered when a new open channel request is received and the
1174          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
1175          * 
1176          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1177          * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1178          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1179          */
1180         public final static class OpenChannelRequest extends Event {
1181                 /**
1182                  * The temporary channel ID of the channel requested to be opened.
1183                  * 
1184                  * When responding to the request, the `temporary_channel_id` should be passed
1185                  * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
1186                  * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
1187                  * 
1188                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1189                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1190                 */
1191                 public final org.ldk.structs.ChannelId temporary_channel_id;
1192                 /**
1193                  * The node_id of the counterparty requesting to open the channel.
1194                  * 
1195                  * When responding to the request, the `counterparty_node_id` should be passed
1196                  * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
1197                  * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
1198                  * request.
1199                  * 
1200                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1201                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1202                 */
1203                 public final byte[] counterparty_node_id;
1204                 /**
1205                  * The channel value of the requested channel.
1206                 */
1207                 public final long funding_satoshis;
1208                 /**
1209                  * Our starting balance in the channel if the request is accepted, in milli-satoshi.
1210                 */
1211                 public final long push_msat;
1212                 /**
1213                  * The features that this channel will operate with. If you reject the channel, a
1214                  * well-behaved counterparty may automatically re-attempt the channel with a new set of
1215                  * feature flags.
1216                  * 
1217                  * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
1218                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
1219                  * 0.0.106.
1220                  * 
1221                  * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
1222                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
1223                  * 0.0.107. Channels setting this type also need to get manually accepted via
1224                  * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
1225                  * or will be rejected otherwise.
1226                  * 
1227                  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
1228                 */
1229                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
1230                 private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
1231                         super(null, ptr);
1232                         long temporary_channel_id = obj.temporary_channel_id;
1233                         org.ldk.structs.ChannelId temporary_channel_id_hu_conv = null; if (temporary_channel_id < 0 || temporary_channel_id > 4096) { temporary_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, temporary_channel_id); }
1234                         if (temporary_channel_id_hu_conv != null) { temporary_channel_id_hu_conv.ptrs_to.add(this); };
1235                         this.temporary_channel_id = temporary_channel_id_hu_conv;
1236                         this.counterparty_node_id = obj.counterparty_node_id;
1237                         this.funding_satoshis = obj.funding_satoshis;
1238                         this.push_msat = obj.push_msat;
1239                         long channel_type = obj.channel_type;
1240                         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); }
1241                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
1242                         this.channel_type = channel_type_hu_conv;
1243                 }
1244         }
1245         /**
1246          * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
1247          * forward it.
1248          * 
1249          * Some scenarios where this event may be sent include:
1250          * Insufficient capacity in the outbound channel
1251          * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
1252          * When an unknown SCID is requested for forwarding a payment.
1253          * Expected MPP amount has already been reached
1254          * The HTLC has timed out
1255          * 
1256          * This event, however, does not get generated if an HTLC fails to meet the forwarding
1257          * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
1258          */
1259         public final static class HTLCHandlingFailed extends Event {
1260                 /**
1261                  * The channel over which the HTLC was received.
1262                 */
1263                 public final org.ldk.structs.ChannelId prev_channel_id;
1264                 /**
1265                  * Destination of the HTLC that failed to be processed.
1266                 */
1267                 public final org.ldk.structs.HTLCDestination failed_next_destination;
1268                 private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
1269                         super(null, ptr);
1270                         long prev_channel_id = obj.prev_channel_id;
1271                         org.ldk.structs.ChannelId prev_channel_id_hu_conv = null; if (prev_channel_id < 0 || prev_channel_id > 4096) { prev_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, prev_channel_id); }
1272                         if (prev_channel_id_hu_conv != null) { prev_channel_id_hu_conv.ptrs_to.add(this); };
1273                         this.prev_channel_id = prev_channel_id_hu_conv;
1274                         long failed_next_destination = obj.failed_next_destination;
1275                         org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
1276                         if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
1277                         this.failed_next_destination = failed_next_destination_hu_conv;
1278                 }
1279         }
1280         /**
1281          * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
1282          * requires confirmed external funds to be readily available to spend.
1283          * 
1284          * LDK does not currently generate this event unless the
1285          * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
1286          * It is limited to the scope of channels with anchor outputs.
1287          * 
1288          * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
1289          */
1290         public final static class BumpTransaction extends Event {
1291                 public final org.ldk.structs.BumpTransactionEvent bump_transaction;
1292                 private BumpTransaction(long ptr, bindings.LDKEvent.BumpTransaction obj) {
1293                         super(null, ptr);
1294                         long bump_transaction = obj.bump_transaction;
1295                         org.ldk.structs.BumpTransactionEvent bump_transaction_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(bump_transaction);
1296                         if (bump_transaction_hu_conv != null) { bump_transaction_hu_conv.ptrs_to.add(this); };
1297                         this.bump_transaction = bump_transaction_hu_conv;
1298                 }
1299         }
1300         long clone_ptr() {
1301                 long ret = bindings.Event_clone_ptr(this.ptr);
1302                 Reference.reachabilityFence(this);
1303                 return ret;
1304         }
1305
1306         /**
1307          * Creates a copy of the Event
1308          */
1309         public Event clone() {
1310                 long ret = bindings.Event_clone(this.ptr);
1311                 Reference.reachabilityFence(this);
1312                 if (ret >= 0 && ret <= 4096) { return null; }
1313                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1314                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1315                 return ret_hu_conv;
1316         }
1317
1318         /**
1319          * Utility method to constructs a new FundingGenerationReady-variant Event
1320          */
1321         public static Event funding_generation_ready(org.ldk.structs.ChannelId temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) {
1322                 long ret = bindings.Event_funding_generation_ready(temporary_channel_id.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), channel_value_satoshis, output_script, user_channel_id.getLEBytes());
1323                 Reference.reachabilityFence(temporary_channel_id);
1324                 Reference.reachabilityFence(counterparty_node_id);
1325                 Reference.reachabilityFence(channel_value_satoshis);
1326                 Reference.reachabilityFence(output_script);
1327                 Reference.reachabilityFence(user_channel_id);
1328                 if (ret >= 0 && ret <= 4096) { return null; }
1329                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1330                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1331                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(temporary_channel_id); };
1332                 return ret_hu_conv;
1333         }
1334
1335         /**
1336          * Utility method to constructs a new PaymentClaimable-variant Event
1337          */
1338         public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, org.ldk.structs.PaymentPurpose purpose, org.ldk.structs.ChannelId via_channel_id, org.ldk.structs.Option_U128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
1339                 long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, via_channel_id.ptr, via_user_channel_id.ptr, claim_deadline.ptr);
1340                 Reference.reachabilityFence(receiver_node_id);
1341                 Reference.reachabilityFence(payment_hash);
1342                 Reference.reachabilityFence(onion_fields);
1343                 Reference.reachabilityFence(amount_msat);
1344                 Reference.reachabilityFence(counterparty_skimmed_fee_msat);
1345                 Reference.reachabilityFence(purpose);
1346                 Reference.reachabilityFence(via_channel_id);
1347                 Reference.reachabilityFence(via_user_channel_id);
1348                 Reference.reachabilityFence(claim_deadline);
1349                 if (ret >= 0 && ret <= 4096) { return null; }
1350                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1351                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1352                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(onion_fields); };
1353                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1354                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_channel_id); };
1355                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_user_channel_id); };
1356                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(claim_deadline); };
1357                 return ret_hu_conv;
1358         }
1359
1360         /**
1361          * Utility method to constructs a new PaymentClaimed-variant Event
1362          */
1363         public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose, ClaimedHTLC[] htlcs, org.ldk.structs.Option_u64Z sender_intended_total_msat) {
1364                 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, htlcs != null ? Arrays.stream(htlcs).mapToLong(htlcs_conv_13 -> htlcs_conv_13.ptr).toArray() : null, sender_intended_total_msat.ptr);
1365                 Reference.reachabilityFence(receiver_node_id);
1366                 Reference.reachabilityFence(payment_hash);
1367                 Reference.reachabilityFence(amount_msat);
1368                 Reference.reachabilityFence(purpose);
1369                 Reference.reachabilityFence(htlcs);
1370                 Reference.reachabilityFence(sender_intended_total_msat);
1371                 if (ret >= 0 && ret <= 4096) { return null; }
1372                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1373                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1374                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1375                 for (ClaimedHTLC htlcs_conv_13: htlcs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(htlcs_conv_13); }; };
1376                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(sender_intended_total_msat); };
1377                 return ret_hu_conv;
1378         }
1379
1380         /**
1381          * Utility method to constructs a new ConnectionNeeded-variant Event
1382          */
1383         public static Event connection_needed(byte[] node_id, SocketAddress[] addresses) {
1384                 long ret = bindings.Event_connection_needed(InternalUtils.check_arr_len(node_id, 33), addresses != null ? Arrays.stream(addresses).mapToLong(addresses_conv_15 -> addresses_conv_15.ptr).toArray() : null);
1385                 Reference.reachabilityFence(node_id);
1386                 Reference.reachabilityFence(addresses);
1387                 if (ret >= 0 && ret <= 4096) { return null; }
1388                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1389                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1390                 for (SocketAddress addresses_conv_15: addresses) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(addresses_conv_15); }; };
1391                 return ret_hu_conv;
1392         }
1393
1394         /**
1395          * Utility method to constructs a new InvoiceRequestFailed-variant Event
1396          */
1397         public static Event invoice_request_failed(byte[] payment_id) {
1398                 long ret = bindings.Event_invoice_request_failed(InternalUtils.check_arr_len(payment_id, 32));
1399                 Reference.reachabilityFence(payment_id);
1400                 if (ret >= 0 && ret <= 4096) { return null; }
1401                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1402                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1403                 return ret_hu_conv;
1404         }
1405
1406         /**
1407          * Utility method to constructs a new PaymentSent-variant Event
1408          */
1409         public static Event payment_sent(org.ldk.structs.Option_ThirtyTwoBytesZ payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
1410                 long ret = bindings.Event_payment_sent(payment_id.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
1411                 Reference.reachabilityFence(payment_id);
1412                 Reference.reachabilityFence(payment_preimage);
1413                 Reference.reachabilityFence(payment_hash);
1414                 Reference.reachabilityFence(fee_paid_msat);
1415                 if (ret >= 0 && ret <= 4096) { return null; }
1416                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1417                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1418                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_id); };
1419                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); };
1420                 return ret_hu_conv;
1421         }
1422
1423         /**
1424          * Utility method to constructs a new PaymentFailed-variant Event
1425          */
1426         public static Event payment_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Option_PaymentFailureReasonZ reason) {
1427                 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), reason.ptr);
1428                 Reference.reachabilityFence(payment_id);
1429                 Reference.reachabilityFence(payment_hash);
1430                 Reference.reachabilityFence(reason);
1431                 if (ret >= 0 && ret <= 4096) { return null; }
1432                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1433                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1434                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1435                 return ret_hu_conv;
1436         }
1437
1438         /**
1439          * Utility method to constructs a new PaymentPathSuccessful-variant Event
1440          */
1441         public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, org.ldk.structs.Path path) {
1442                 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), payment_hash.ptr, path.ptr);
1443                 Reference.reachabilityFence(payment_id);
1444                 Reference.reachabilityFence(payment_hash);
1445                 Reference.reachabilityFence(path);
1446                 if (ret >= 0 && ret <= 4096) { return null; }
1447                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1448                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1449                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
1450                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1451                 return ret_hu_conv;
1452         }
1453
1454         /**
1455          * Utility method to constructs a new PaymentPathFailed-variant Event
1456          */
1457         public static Event payment_path_failed(org.ldk.structs.Option_ThirtyTwoBytesZ 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) {
1458                 long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path.ptr, short_channel_id.ptr);
1459                 Reference.reachabilityFence(payment_id);
1460                 Reference.reachabilityFence(payment_hash);
1461                 Reference.reachabilityFence(payment_failed_permanently);
1462                 Reference.reachabilityFence(failure);
1463                 Reference.reachabilityFence(path);
1464                 Reference.reachabilityFence(short_channel_id);
1465                 if (ret >= 0 && ret <= 4096) { return null; }
1466                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1467                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1468                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_id); };
1469                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
1470                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1471                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1472                 return ret_hu_conv;
1473         }
1474
1475         /**
1476          * Utility method to constructs a new ProbeSuccessful-variant Event
1477          */
1478         public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
1479                 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path.ptr);
1480                 Reference.reachabilityFence(payment_id);
1481                 Reference.reachabilityFence(payment_hash);
1482                 Reference.reachabilityFence(path);
1483                 if (ret >= 0 && ret <= 4096) { return null; }
1484                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1485                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1486                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1487                 return ret_hu_conv;
1488         }
1489
1490         /**
1491          * Utility method to constructs a new ProbeFailed-variant Event
1492          */
1493         public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
1494                 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path.ptr, short_channel_id.ptr);
1495                 Reference.reachabilityFence(payment_id);
1496                 Reference.reachabilityFence(payment_hash);
1497                 Reference.reachabilityFence(path);
1498                 Reference.reachabilityFence(short_channel_id);
1499                 if (ret >= 0 && ret <= 4096) { return null; }
1500                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1501                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1502                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1503                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1504                 return ret_hu_conv;
1505         }
1506
1507         /**
1508          * Utility method to constructs a new PendingHTLCsForwardable-variant Event
1509          */
1510         public static Event pending_htlcs_forwardable(long time_forwardable) {
1511                 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
1512                 Reference.reachabilityFence(time_forwardable);
1513                 if (ret >= 0 && ret <= 4096) { return null; }
1514                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1515                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1516                 return ret_hu_conv;
1517         }
1518
1519         /**
1520          * Utility method to constructs a new HTLCIntercepted-variant Event
1521          */
1522         public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
1523                 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);
1524                 Reference.reachabilityFence(intercept_id);
1525                 Reference.reachabilityFence(requested_next_hop_scid);
1526                 Reference.reachabilityFence(payment_hash);
1527                 Reference.reachabilityFence(inbound_amount_msat);
1528                 Reference.reachabilityFence(expected_outbound_amount_msat);
1529                 if (ret >= 0 && ret <= 4096) { return null; }
1530                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1531                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1532                 return ret_hu_conv;
1533         }
1534
1535         /**
1536          * Utility method to constructs a new SpendableOutputs-variant Event
1537          */
1538         public static Event spendable_outputs(SpendableOutputDescriptor[] outputs, org.ldk.structs.ChannelId channel_id) {
1539                 long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null, channel_id.ptr);
1540                 Reference.reachabilityFence(outputs);
1541                 Reference.reachabilityFence(channel_id);
1542                 if (ret >= 0 && ret <= 4096) { return null; }
1543                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1544                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1545                 for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; };
1546                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
1547                 return ret_hu_conv;
1548         }
1549
1550         /**
1551          * Utility method to constructs a new PaymentForwarded-variant Event
1552          */
1553         public static Event payment_forwarded(org.ldk.structs.ChannelId prev_channel_id, org.ldk.structs.ChannelId next_channel_id, org.ldk.structs.Option_U128Z prev_user_channel_id, org.ldk.structs.Option_U128Z next_user_channel_id, org.ldk.structs.Option_u64Z total_fee_earned_msat, org.ldk.structs.Option_u64Z skimmed_fee_msat, boolean claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) {
1554                 long ret = bindings.Event_payment_forwarded(prev_channel_id.ptr, next_channel_id.ptr, prev_user_channel_id.ptr, next_user_channel_id.ptr, total_fee_earned_msat.ptr, skimmed_fee_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr);
1555                 Reference.reachabilityFence(prev_channel_id);
1556                 Reference.reachabilityFence(next_channel_id);
1557                 Reference.reachabilityFence(prev_user_channel_id);
1558                 Reference.reachabilityFence(next_user_channel_id);
1559                 Reference.reachabilityFence(total_fee_earned_msat);
1560                 Reference.reachabilityFence(skimmed_fee_msat);
1561                 Reference.reachabilityFence(claim_from_onchain_tx);
1562                 Reference.reachabilityFence(outbound_amount_forwarded_msat);
1563                 if (ret >= 0 && ret <= 4096) { return null; }
1564                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1565                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1566                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(prev_channel_id); };
1567                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(next_channel_id); };
1568                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(prev_user_channel_id); };
1569                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(next_user_channel_id); };
1570                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(total_fee_earned_msat); };
1571                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(skimmed_fee_msat); };
1572                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_amount_forwarded_msat); };
1573                 return ret_hu_conv;
1574         }
1575
1576         /**
1577          * Utility method to constructs a new ChannelPending-variant Event
1578          */
1579         public static Event channel_pending(org.ldk.structs.ChannelId channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ChannelId former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo, org.ldk.structs.ChannelTypeFeatures channel_type) {
1580                 long ret = bindings.Event_channel_pending(channel_id.ptr, user_channel_id.getLEBytes(), former_temporary_channel_id.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), funding_txo.ptr, channel_type.ptr);
1581                 Reference.reachabilityFence(channel_id);
1582                 Reference.reachabilityFence(user_channel_id);
1583                 Reference.reachabilityFence(former_temporary_channel_id);
1584                 Reference.reachabilityFence(counterparty_node_id);
1585                 Reference.reachabilityFence(funding_txo);
1586                 Reference.reachabilityFence(channel_type);
1587                 if (ret >= 0 && ret <= 4096) { return null; }
1588                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1589                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1590                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
1591                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(former_temporary_channel_id); };
1592                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
1593                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1594                 return ret_hu_conv;
1595         }
1596
1597         /**
1598          * Utility method to constructs a new ChannelReady-variant Event
1599          */
1600         public static Event channel_ready(org.ldk.structs.ChannelId channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) {
1601                 long ret = bindings.Event_channel_ready(channel_id.ptr, user_channel_id.getLEBytes(), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_type.ptr);
1602                 Reference.reachabilityFence(channel_id);
1603                 Reference.reachabilityFence(user_channel_id);
1604                 Reference.reachabilityFence(counterparty_node_id);
1605                 Reference.reachabilityFence(channel_type);
1606                 if (ret >= 0 && ret <= 4096) { return null; }
1607                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1608                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1609                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
1610                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1611                 return ret_hu_conv;
1612         }
1613
1614         /**
1615          * Utility method to constructs a new ChannelClosed-variant Event
1616          */
1617         public static Event channel_closed(org.ldk.structs.ChannelId channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason, byte[] counterparty_node_id, org.ldk.structs.Option_u64Z channel_capacity_sats, org.ldk.structs.OutPoint channel_funding_txo) {
1618                 long ret = bindings.Event_channel_closed(channel_id.ptr, user_channel_id.getLEBytes(), reason.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), channel_capacity_sats.ptr, channel_funding_txo.ptr);
1619                 Reference.reachabilityFence(channel_id);
1620                 Reference.reachabilityFence(user_channel_id);
1621                 Reference.reachabilityFence(reason);
1622                 Reference.reachabilityFence(counterparty_node_id);
1623                 Reference.reachabilityFence(channel_capacity_sats);
1624                 Reference.reachabilityFence(channel_funding_txo);
1625                 if (ret >= 0 && ret <= 4096) { return null; }
1626                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1627                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1628                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
1629                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1630                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_capacity_sats); };
1631                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_funding_txo); };
1632                 return ret_hu_conv;
1633         }
1634
1635         /**
1636          * Utility method to constructs a new DiscardFunding-variant Event
1637          */
1638         public static Event discard_funding(org.ldk.structs.ChannelId channel_id, byte[] transaction) {
1639                 long ret = bindings.Event_discard_funding(channel_id.ptr, transaction);
1640                 Reference.reachabilityFence(channel_id);
1641                 Reference.reachabilityFence(transaction);
1642                 if (ret >= 0 && ret <= 4096) { return null; }
1643                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1644                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1645                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
1646                 return ret_hu_conv;
1647         }
1648
1649         /**
1650          * Utility method to constructs a new OpenChannelRequest-variant Event
1651          */
1652         public static Event open_channel_request(org.ldk.structs.ChannelId temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) {
1653                 long ret = bindings.Event_open_channel_request(temporary_channel_id.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type.ptr);
1654                 Reference.reachabilityFence(temporary_channel_id);
1655                 Reference.reachabilityFence(counterparty_node_id);
1656                 Reference.reachabilityFence(funding_satoshis);
1657                 Reference.reachabilityFence(push_msat);
1658                 Reference.reachabilityFence(channel_type);
1659                 if (ret >= 0 && ret <= 4096) { return null; }
1660                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1661                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1662                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(temporary_channel_id); };
1663                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1664                 return ret_hu_conv;
1665         }
1666
1667         /**
1668          * Utility method to constructs a new HTLCHandlingFailed-variant Event
1669          */
1670         public static Event htlchandling_failed(org.ldk.structs.ChannelId prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
1671                 long ret = bindings.Event_htlchandling_failed(prev_channel_id.ptr, failed_next_destination.ptr);
1672                 Reference.reachabilityFence(prev_channel_id);
1673                 Reference.reachabilityFence(failed_next_destination);
1674                 if (ret >= 0 && ret <= 4096) { return null; }
1675                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1676                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1677                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(prev_channel_id); };
1678                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); };
1679                 return ret_hu_conv;
1680         }
1681
1682         /**
1683          * Utility method to constructs a new BumpTransaction-variant Event
1684          */
1685         public static Event bump_transaction(org.ldk.structs.BumpTransactionEvent a) {
1686                 long ret = bindings.Event_bump_transaction(a.ptr);
1687                 Reference.reachabilityFence(a);
1688                 if (ret >= 0 && ret <= 4096) { return null; }
1689                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1690                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1691                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
1692                 return ret_hu_conv;
1693         }
1694
1695         /**
1696          * Checks if two Events contain equal inner contents.
1697          * This ignores pointers and is_owned flags and looks at the values in fields.
1698          */
1699         public boolean eq(org.ldk.structs.Event b) {
1700                 boolean ret = bindings.Event_eq(this.ptr, b.ptr);
1701                 Reference.reachabilityFence(this);
1702                 Reference.reachabilityFence(b);
1703                 return ret;
1704         }
1705
1706         @Override public boolean equals(Object o) {
1707                 if (!(o instanceof Event)) return false;
1708                 return this.eq((Event)o);
1709         }
1710         /**
1711          * Serialize the Event object into a byte array which can be read by Event_read
1712          */
1713         public byte[] write() {
1714                 byte[] ret = bindings.Event_write(this.ptr);
1715                 Reference.reachabilityFence(this);
1716                 return ret;
1717         }
1718
1719 }