1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * An Event which you should probably take some action in response to.
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).
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 {
24 if (ptr != 0) { bindings.Event_free(ptr); }
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);
31 if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimable.class) {
32 return new PaymentClaimable(ptr, (bindings.LDKEvent.PaymentClaimable)raw_val);
34 if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimed.class) {
35 return new PaymentClaimed(ptr, (bindings.LDKEvent.PaymentClaimed)raw_val);
37 if (raw_val.getClass() == bindings.LDKEvent.ConnectionNeeded.class) {
38 return new ConnectionNeeded(ptr, (bindings.LDKEvent.ConnectionNeeded)raw_val);
40 if (raw_val.getClass() == bindings.LDKEvent.InvoiceRequestFailed.class) {
41 return new InvoiceRequestFailed(ptr, (bindings.LDKEvent.InvoiceRequestFailed)raw_val);
43 if (raw_val.getClass() == bindings.LDKEvent.PaymentSent.class) {
44 return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val);
46 if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) {
47 return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val);
49 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) {
50 return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val);
52 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
53 return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
55 if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) {
56 return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val);
58 if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) {
59 return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val);
61 if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
62 return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
64 if (raw_val.getClass() == bindings.LDKEvent.HTLCIntercepted.class) {
65 return new HTLCIntercepted(ptr, (bindings.LDKEvent.HTLCIntercepted)raw_val);
67 if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
68 return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
70 if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
71 return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
73 if (raw_val.getClass() == bindings.LDKEvent.ChannelPending.class) {
74 return new ChannelPending(ptr, (bindings.LDKEvent.ChannelPending)raw_val);
76 if (raw_val.getClass() == bindings.LDKEvent.ChannelReady.class) {
77 return new ChannelReady(ptr, (bindings.LDKEvent.ChannelReady)raw_val);
79 if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
80 return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
82 if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) {
83 return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val);
85 if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
86 return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
88 if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
89 return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
91 if (raw_val.getClass() == bindings.LDKEvent.BumpTransaction.class) {
92 return new BumpTransaction(ptr, (bindings.LDKEvent.BumpTransaction)raw_val);
94 assert false; return null; // Unreachable without extending the (internal) bindings interface
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!
104 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
105 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
107 public final static class FundingGenerationReady extends Event {
109 * The random channel_id we picked which you'll need to pass into
110 * [`ChannelManager::funding_transaction_generated`].
112 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
114 public final byte[] temporary_channel_id;
116 * The counterparty's node_id, which you'll need to pass back into
117 * [`ChannelManager::funding_transaction_generated`].
119 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
121 public final byte[] counterparty_node_id;
123 * The value, in satoshis, that the output should have.
125 public final long channel_value_satoshis;
127 * The script which should be used in the transaction output.
129 public final byte[] output_script;
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.
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
141 public final org.ldk.util.UInt128 user_channel_id;
142 private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
144 this.temporary_channel_id = obj.temporary_channel_id;
145 this.counterparty_node_id = obj.counterparty_node_id;
146 this.channel_value_satoshis = obj.channel_value_satoshis;
147 this.output_script = obj.output_script;
148 byte[] user_channel_id = obj.user_channel_id;
149 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
150 this.user_channel_id = user_channel_id_conv;
154 * Indicates that we've been offered a payment and it needs to be claimed via calling
155 * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
157 * Note that if the preimage is not known, you should call
158 * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
159 * to free up resources for this HTLC and avoid network congestion.
161 * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type
162 * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with
163 * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or
164 * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling.
165 * If you don't intend to check for custom TLVs, you can simply use
166 * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs.
168 * If you fail to call [`ChannelManager::claim_funds`],
169 * [`ChannelManager::claim_funds_with_known_custom_tlvs`],
170 * [`ChannelManager::fail_htlc_backwards`], or
171 * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will
172 * be automatically failed.
175 * LDK will not stop an inbound payment from being paid multiple times, so multiple
176 * `PaymentClaimable` events may be generated for the same payment. In such a case it is
177 * polite (and required in the lightning specification) to fail the payment the second time
178 * and give the sender their money back rather than accepting double payment.
181 * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
183 * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
184 * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs
185 * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload
186 * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
187 * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
189 public final static class PaymentClaimable extends Event {
191 * The node that will receive the payment after it has been claimed.
192 * This is useful to identify payments received via [phantom nodes].
193 * This field will always be filled in when the event was generated by LDK versions
196 * [phantom nodes]: crate::sign::PhantomKeysManager
198 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
200 @Nullable public final byte[] receiver_node_id;
202 * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
203 * not stop you from registering duplicate payment hashes for inbound payments.
205 public final byte[] payment_hash;
207 * The fields in the onion which were received with each HTLC. Only fields which were
208 * identical in each HTLC involved in the payment will be included here.
210 * Payments received on LDK versions prior to 0.0.115 will have this field unset.
212 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
214 @Nullable public final org.ldk.structs.RecipientOnionFields onion_fields;
216 * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
217 * than the invoice amount.
219 * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
220 * and the previous hop took an extra fee.
223 * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
224 * field, you may lose money!
226 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
228 public final long amount_msat;
230 * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
231 * taken by our channel counterparty.
233 * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
235 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
237 public final long counterparty_skimmed_fee_msat;
239 * Information for claiming this received payment, based on whether the purpose of the
240 * payment is to pay an invoice or to send a spontaneous payment.
242 public final org.ldk.structs.PaymentPurpose purpose;
244 * The `channel_id` indicating over which channel we received the payment.
246 public final org.ldk.structs.Option_ThirtyTwoBytesZ via_channel_id;
248 * The `user_channel_id` indicating over which channel we received the payment.
250 public final org.ldk.structs.Option_U128Z via_user_channel_id;
252 * The block height at which this payment will be failed back and will no longer be
253 * eligible for claiming.
255 * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
256 * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
258 * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
260 public final org.ldk.structs.Option_u32Z claim_deadline;
261 private PaymentClaimable(long ptr, bindings.LDKEvent.PaymentClaimable obj) {
263 this.receiver_node_id = obj.receiver_node_id;
264 this.payment_hash = obj.payment_hash;
265 long onion_fields = obj.onion_fields;
266 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); }
267 if (onion_fields_hu_conv != null) { onion_fields_hu_conv.ptrs_to.add(this); };
268 this.onion_fields = onion_fields_hu_conv;
269 this.amount_msat = obj.amount_msat;
270 this.counterparty_skimmed_fee_msat = obj.counterparty_skimmed_fee_msat;
271 long purpose = obj.purpose;
272 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
273 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
274 this.purpose = purpose_hu_conv;
275 long via_channel_id = obj.via_channel_id;
276 org.ldk.structs.Option_ThirtyTwoBytesZ via_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(via_channel_id);
277 if (via_channel_id_hu_conv != null) { via_channel_id_hu_conv.ptrs_to.add(this); };
278 this.via_channel_id = via_channel_id_hu_conv;
279 long via_user_channel_id = obj.via_user_channel_id;
280 org.ldk.structs.Option_U128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_U128Z.constr_from_ptr(via_user_channel_id);
281 if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.add(this); };
282 this.via_user_channel_id = via_user_channel_id_hu_conv;
283 long claim_deadline = obj.claim_deadline;
284 org.ldk.structs.Option_u32Z claim_deadline_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(claim_deadline);
285 if (claim_deadline_hu_conv != null) { claim_deadline_hu_conv.ptrs_to.add(this); };
286 this.claim_deadline = claim_deadline_hu_conv;
290 * Indicates a payment has been claimed and we've received money!
292 * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
293 * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
294 * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
295 * [`Event::PaymentClaimable`] event.
298 * LDK will not stop an inbound payment from being paid multiple times, so multiple
299 * `PaymentClaimable` events may be generated for the same payment. If you then call
300 * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
301 * multiple `PaymentClaimed` events.
303 * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
305 public final static class PaymentClaimed extends Event {
307 * The node that received the payment.
308 * This is useful to identify payments which were received via [phantom nodes].
309 * This field will always be filled in when the event was generated by LDK versions
312 * [phantom nodes]: crate::sign::PhantomKeysManager
314 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
316 @Nullable public final byte[] receiver_node_id;
318 * The payment hash of the claimed payment. Note that LDK will not stop you from
319 * registering duplicate payment hashes for inbound payments.
321 public final byte[] payment_hash;
323 * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
326 public final long amount_msat;
328 * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
329 * spontaneous payment.
331 public final org.ldk.structs.PaymentPurpose purpose;
333 * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior
334 * to LDK version 0.0.117.
336 public final ClaimedHTLC[] htlcs;
338 * The sender-intended sum total of all the MPP parts. This will be `None` for events
339 * serialized prior to LDK version 0.0.117.
341 public final org.ldk.structs.Option_u64Z sender_intended_total_msat;
342 private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
344 this.receiver_node_id = obj.receiver_node_id;
345 this.payment_hash = obj.payment_hash;
346 this.amount_msat = obj.amount_msat;
347 long purpose = obj.purpose;
348 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
349 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
350 this.purpose = purpose_hu_conv;
351 long[] htlcs = obj.htlcs;
352 int htlcs_conv_13_len = htlcs.length;
353 ClaimedHTLC[] htlcs_conv_13_arr = new ClaimedHTLC[htlcs_conv_13_len];
354 for (int n = 0; n < htlcs_conv_13_len; n++) {
355 long htlcs_conv_13 = htlcs[n];
356 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); }
357 if (htlcs_conv_13_hu_conv != null) { htlcs_conv_13_hu_conv.ptrs_to.add(this); };
358 htlcs_conv_13_arr[n] = htlcs_conv_13_hu_conv;
360 this.htlcs = htlcs_conv_13_arr;
361 long sender_intended_total_msat = obj.sender_intended_total_msat;
362 org.ldk.structs.Option_u64Z sender_intended_total_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(sender_intended_total_msat);
363 if (sender_intended_total_msat_hu_conv != null) { sender_intended_total_msat_hu_conv.ptrs_to.add(this); };
364 this.sender_intended_total_msat = sender_intended_total_msat_hu_conv;
368 * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`].
370 * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a
371 * [`Destination`]. Once a connection is established, any messages buffered by an
372 * [`OnionMessageHandler`] may be sent.
374 * This event will not be generated for onion message forwards; only for sends including
375 * replies. Handlers should connect to the node otherwise any buffered messages may be lost.
377 * [`OnionMessage`]: msgs::OnionMessage
378 * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter
379 * [`Destination`]: crate::onion_message::messenger::Destination
380 * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler
382 public final static class ConnectionNeeded extends Event {
384 * The node id for the node needing a connection.
386 public final byte[] node_id;
388 * Sockets for connecting to the node.
390 public final SocketAddress[] addresses;
391 private ConnectionNeeded(long ptr, bindings.LDKEvent.ConnectionNeeded obj) {
393 this.node_id = obj.node_id;
394 long[] addresses = obj.addresses;
395 int addresses_conv_15_len = addresses.length;
396 SocketAddress[] addresses_conv_15_arr = new SocketAddress[addresses_conv_15_len];
397 for (int p = 0; p < addresses_conv_15_len; p++) {
398 long addresses_conv_15 = addresses[p];
399 org.ldk.structs.SocketAddress addresses_conv_15_hu_conv = org.ldk.structs.SocketAddress.constr_from_ptr(addresses_conv_15);
400 if (addresses_conv_15_hu_conv != null) { addresses_conv_15_hu_conv.ptrs_to.add(this); };
401 addresses_conv_15_arr[p] = addresses_conv_15_hu_conv;
403 this.addresses = addresses_conv_15_arr;
407 * Indicates a request for an invoice failed to yield a response in a reasonable amount of time
408 * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an
409 * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed.
411 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
412 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
413 * [`Offer`]: crate::offers::offer::Offer
414 * [`Refund`]: crate::offers::refund::Refund
416 public final static class InvoiceRequestFailed extends Event {
418 * The `payment_id` to have been associated with payment for the requested invoice.
420 public final byte[] payment_id;
421 private InvoiceRequestFailed(long ptr, bindings.LDKEvent.InvoiceRequestFailed obj) {
423 this.payment_id = obj.payment_id;
427 * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
428 * and we got back the payment preimage for it).
430 * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
431 * event. In this situation, you SHOULD treat this payment as having succeeded.
433 public final static class PaymentSent extends Event {
435 * The `payment_id` passed to [`ChannelManager::send_payment`].
437 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
439 public final org.ldk.structs.Option_ThirtyTwoBytesZ payment_id;
441 * The preimage to the hash given to ChannelManager::send_payment.
442 * Note that this serves as a payment receipt, if you wish to have such a thing, you must
445 public final byte[] payment_preimage;
447 * The hash that was given to [`ChannelManager::send_payment`].
449 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
451 public final byte[] payment_hash;
453 * The total fee which was spent at intermediate hops in this payment, across all paths.
455 * Note that, like [`Route::get_total_fees`] this does *not* include any potential
456 * overpayment to the recipient node.
458 * If the recipient or an intermediate node misbehaves and gives us free money, this may
459 * overstate the amount paid, though this is unlikely.
461 * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
463 public final org.ldk.structs.Option_u64Z fee_paid_msat;
464 private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
466 long payment_id = obj.payment_id;
467 org.ldk.structs.Option_ThirtyTwoBytesZ payment_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id);
468 if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
469 this.payment_id = payment_id_hu_conv;
470 this.payment_preimage = obj.payment_preimage;
471 this.payment_hash = obj.payment_hash;
472 long fee_paid_msat = obj.fee_paid_msat;
473 org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
474 if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
475 this.fee_paid_msat = fee_paid_msat_hu_conv;
479 * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
480 * provide failure information for each path attempt in the payment, including retries.
482 * This event is provided once there are no further pending HTLCs for the payment and the
483 * payment is no longer retryable, due either to the [`Retry`] provided or
484 * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
486 * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for
487 * a payment after an [`Event::PaymentSent`] event for this same payment has already been
488 * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored,
489 * and the payment MUST be treated as having succeeded.
491 * [`Retry`]: crate::ln::channelmanager::Retry
492 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
494 public final static class PaymentFailed extends Event {
496 * The `payment_id` passed to [`ChannelManager::send_payment`].
498 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
500 public final byte[] payment_id;
502 * The hash that was given to [`ChannelManager::send_payment`].
504 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
506 public final byte[] payment_hash;
508 * The reason the payment failed. This is only `None` for events generated or serialized
509 * by versions prior to 0.0.115.
511 public final org.ldk.structs.Option_PaymentFailureReasonZ reason;
512 private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
514 this.payment_id = obj.payment_id;
515 this.payment_hash = obj.payment_hash;
516 long reason = obj.reason;
517 org.ldk.structs.Option_PaymentFailureReasonZ reason_hu_conv = org.ldk.structs.Option_PaymentFailureReasonZ.constr_from_ptr(reason);
518 if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
519 this.reason = reason_hu_conv;
523 * Indicates that a path for an outbound payment was successful.
525 * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
526 * [`Event::PaymentSent`] for obtaining the payment preimage.
528 public final static class PaymentPathSuccessful extends Event {
530 * The `payment_id` passed to [`ChannelManager::send_payment`].
532 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
534 public final byte[] payment_id;
536 * The hash that was given to [`ChannelManager::send_payment`].
538 * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
540 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
542 public final org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash;
544 * The payment path that was successful.
546 * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
548 public final org.ldk.structs.Path path;
549 private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
551 this.payment_id = obj.payment_id;
552 long payment_hash = obj.payment_hash;
553 org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(payment_hash);
554 if (payment_hash_hu_conv != null) { payment_hash_hu_conv.ptrs_to.add(this); };
555 this.payment_hash = payment_hash_hu_conv;
556 long path = obj.path;
557 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
558 if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
559 this.path = path_hu_conv;
563 * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
566 * Note that this does *not* indicate that all paths for an MPP payment have failed, see
567 * [`Event::PaymentFailed`].
569 * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
572 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
574 public final static class PaymentPathFailed extends Event {
576 * The `payment_id` passed to [`ChannelManager::send_payment`].
578 * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
580 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
581 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
583 public final org.ldk.structs.Option_ThirtyTwoBytesZ payment_id;
585 * The hash that was given to [`ChannelManager::send_payment`].
587 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
589 public final byte[] payment_hash;
591 * Indicates the payment was rejected for some reason by the recipient. This implies that
592 * the payment has failed, not just the route in question. If this is not set, the payment may
593 * be retried via a different route.
595 public final boolean payment_failed_permanently;
597 * Extra error details based on the failure type. May contain an update that needs to be
598 * applied to the [`NetworkGraph`].
600 * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
602 public final org.ldk.structs.PathFailure failure;
604 * The payment path that failed.
606 public final org.ldk.structs.Path path;
608 * The channel responsible for the failed payment path.
610 * Note that for route hints or for the first hop in a path this may be an SCID alias and
611 * may not refer to a channel in the public network graph. These aliases may also collide
612 * with channels in the public network graph.
614 * If this is `Some`, then the corresponding channel should be avoided when the payment is
615 * retried. May be `None` for older [`Event`] serializations.
617 public final org.ldk.structs.Option_u64Z short_channel_id;
618 private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
620 long payment_id = obj.payment_id;
621 org.ldk.structs.Option_ThirtyTwoBytesZ payment_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(payment_id);
622 if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
623 this.payment_id = payment_id_hu_conv;
624 this.payment_hash = obj.payment_hash;
625 this.payment_failed_permanently = obj.payment_failed_permanently;
626 long failure = obj.failure;
627 org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure);
628 if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.add(this); };
629 this.failure = failure_hu_conv;
630 long path = obj.path;
631 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
632 if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
633 this.path = path_hu_conv;
634 long short_channel_id = obj.short_channel_id;
635 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
636 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
637 this.short_channel_id = short_channel_id_hu_conv;
641 * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
643 public final static class ProbeSuccessful extends Event {
645 * The id returned by [`ChannelManager::send_probe`].
647 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
649 public final byte[] payment_id;
651 * The hash generated by [`ChannelManager::send_probe`].
653 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
655 public final byte[] payment_hash;
657 * The payment path that was successful.
659 public final org.ldk.structs.Path path;
660 private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
662 this.payment_id = obj.payment_id;
663 this.payment_hash = obj.payment_hash;
664 long path = obj.path;
665 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
666 if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
667 this.path = path_hu_conv;
671 * Indicates that a probe payment we sent failed at an intermediary node on the path.
673 public final static class ProbeFailed extends Event {
675 * The id returned by [`ChannelManager::send_probe`].
677 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
679 public final byte[] payment_id;
681 * The hash generated by [`ChannelManager::send_probe`].
683 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
685 public final byte[] payment_hash;
687 * The payment path that failed.
689 public final org.ldk.structs.Path path;
691 * The channel responsible for the failed probe.
693 * Note that for route hints or for the first hop in a path this may be an SCID alias and
694 * may not refer to a channel in the public network graph. These aliases may also collide
695 * with channels in the public network graph.
697 public final org.ldk.structs.Option_u64Z short_channel_id;
698 private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
700 this.payment_id = obj.payment_id;
701 this.payment_hash = obj.payment_hash;
702 long path = obj.path;
703 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
704 if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
705 this.path = path_hu_conv;
706 long short_channel_id = obj.short_channel_id;
707 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
708 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
709 this.short_channel_id = short_channel_id_hu_conv;
713 * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
714 * a time in the future.
716 * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
718 public final static class PendingHTLCsForwardable extends Event {
720 * The minimum amount of time that should be waited prior to calling
721 * process_pending_htlc_forwards. To increase the effort required to correlate payments,
722 * you should wait a random amount of time in roughly the range (now + time_forwardable,
723 * now + 5*time_forwardable).
725 public final long time_forwardable;
726 private PendingHTLCsForwardable(long ptr, bindings.LDKEvent.PendingHTLCsForwardable obj) {
728 this.time_forwardable = obj.time_forwardable;
732 * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
733 * you've encoded an intercept scid in the receiver's invoice route hints using
734 * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
736 * [`ChannelManager::forward_intercepted_htlc`] or
737 * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
738 * their docs for more information.
740 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
741 * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
742 * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
743 * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
745 public final static class HTLCIntercepted extends Event {
747 * An id to help LDK identify which HTLC is being forwarded or failed.
749 public final byte[] intercept_id;
751 * The fake scid that was programmed as the next hop's scid, generated using
752 * [`ChannelManager::get_intercept_scid`].
754 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
756 public final long requested_next_hop_scid;
758 * The payment hash used for this HTLC.
760 public final byte[] payment_hash;
762 * How many msats were received on the inbound edge of this HTLC.
764 public final long inbound_amount_msat;
766 * How many msats the payer intended to route to the next node. Depending on the reason you are
767 * intercepting this payment, you might take a fee by forwarding less than this amount.
768 * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
770 * Note that LDK will NOT check that expected fees were factored into this value. You MUST
771 * check that whatever fee you want has been included here or subtract it as required. Further,
772 * LDK will not stop you from forwarding more than you received.
774 public final long expected_outbound_amount_msat;
775 private HTLCIntercepted(long ptr, bindings.LDKEvent.HTLCIntercepted obj) {
777 this.intercept_id = obj.intercept_id;
778 this.requested_next_hop_scid = obj.requested_next_hop_scid;
779 this.payment_hash = obj.payment_hash;
780 this.inbound_amount_msat = obj.inbound_amount_msat;
781 this.expected_outbound_amount_msat = obj.expected_outbound_amount_msat;
785 * Used to indicate that an output which you should know how to spend was confirmed on chain
786 * and is now spendable.
787 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
788 * counterparty spending them due to some kind of timeout. Thus, you need to store them
789 * somewhere and spend them when you create on-chain transactions.
791 public final static class SpendableOutputs extends Event {
793 * The outputs which you should store as spendable by you.
795 public final SpendableOutputDescriptor[] outputs;
797 * The `channel_id` indicating which channel the spendable outputs belong to.
799 * This will always be `Some` for events generated by LDK versions 0.0.117 and above.
801 public final org.ldk.structs.Option_ThirtyTwoBytesZ channel_id;
802 private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) {
804 long[] outputs = obj.outputs;
805 int outputs_conv_27_len = outputs.length;
806 SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
807 for (int b = 0; b < outputs_conv_27_len; b++) {
808 long outputs_conv_27 = outputs[b];
809 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
810 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
811 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
813 this.outputs = outputs_conv_27_arr;
814 long channel_id = obj.channel_id;
815 org.ldk.structs.Option_ThirtyTwoBytesZ channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(channel_id);
816 if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
817 this.channel_id = channel_id_hu_conv;
821 * This event is generated when a payment has been successfully forwarded through us and a
822 * forwarding fee earned.
824 public final static class PaymentForwarded extends Event {
826 * The incoming channel between the previous node and us. This is only `None` for events
827 * generated or serialized by versions prior to 0.0.107.
829 public final org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id;
831 * The outgoing channel between the next node and us. This is only `None` for events
832 * generated or serialized by versions prior to 0.0.107.
834 public final org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id;
836 * The fee, in milli-satoshis, which was earned as a result of the payment.
838 * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
839 * was pending, the amount the next hop claimed will have been rounded down to the nearest
840 * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
841 * claimed the full value in millisatoshis from the source. In this case,
842 * `claim_from_onchain_tx` will be set.
844 * If the channel which sent us the payment has been force-closed, we will claim the funds
845 * via an on-chain transaction. In that case we do not yet know the on-chain transaction
846 * fees which we will spend and will instead set this to `None`. It is possible duplicate
847 * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
850 public final org.ldk.structs.Option_u64Z fee_earned_msat;
852 * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
855 public final boolean claim_from_onchain_tx;
857 * The final amount forwarded, in milli-satoshis, after the fee is deducted.
859 * The caveat described above the `fee_earned_msat` field applies here as well.
861 public final org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat;
862 private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
864 long prev_channel_id = obj.prev_channel_id;
865 org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(prev_channel_id);
866 if (prev_channel_id_hu_conv != null) { prev_channel_id_hu_conv.ptrs_to.add(this); };
867 this.prev_channel_id = prev_channel_id_hu_conv;
868 long next_channel_id = obj.next_channel_id;
869 org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(next_channel_id);
870 if (next_channel_id_hu_conv != null) { next_channel_id_hu_conv.ptrs_to.add(this); };
871 this.next_channel_id = next_channel_id_hu_conv;
872 long fee_earned_msat = obj.fee_earned_msat;
873 org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
874 if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
875 this.fee_earned_msat = fee_earned_msat_hu_conv;
876 this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
877 long outbound_amount_forwarded_msat = obj.outbound_amount_forwarded_msat;
878 org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat);
879 if (outbound_amount_forwarded_msat_hu_conv != null) { outbound_amount_forwarded_msat_hu_conv.ptrs_to.add(this); };
880 this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv;
884 * Used to indicate that a channel with the given `channel_id` is being opened and pending
885 * confirmation on-chain.
887 * This event is emitted when the funding transaction has been signed and is broadcast to the
888 * network. For 0conf channels it will be immediately followed by the corresponding
889 * [`Event::ChannelReady`] event.
891 public final static class ChannelPending extends Event {
893 * The `channel_id` of the channel that is pending confirmation.
895 public final byte[] channel_id;
897 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
898 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
899 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
900 * `user_channel_id` will be randomized for an inbound channel.
902 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
903 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
904 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
906 public final org.ldk.util.UInt128 user_channel_id;
908 * The `temporary_channel_id` this channel used to be known by during channel establishment.
910 * Will be `None` for channels created prior to LDK version 0.0.115.
912 public final org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id;
914 * The `node_id` of the channel counterparty.
916 public final byte[] counterparty_node_id;
918 * The outpoint of the channel's funding transaction.
920 public final org.ldk.structs.OutPoint funding_txo;
921 private ChannelPending(long ptr, bindings.LDKEvent.ChannelPending obj) {
923 this.channel_id = obj.channel_id;
924 byte[] user_channel_id = obj.user_channel_id;
925 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
926 this.user_channel_id = user_channel_id_conv;
927 long former_temporary_channel_id = obj.former_temporary_channel_id;
928 org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(former_temporary_channel_id);
929 if (former_temporary_channel_id_hu_conv != null) { former_temporary_channel_id_hu_conv.ptrs_to.add(this); };
930 this.former_temporary_channel_id = former_temporary_channel_id_hu_conv;
931 this.counterparty_node_id = obj.counterparty_node_id;
932 long funding_txo = obj.funding_txo;
933 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); }
934 if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
935 this.funding_txo = funding_txo_hu_conv;
939 * Used to indicate that a channel with the given `channel_id` is ready to
940 * be used. This event is emitted either when the funding transaction has been confirmed
941 * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
944 public final static class ChannelReady extends Event {
946 * The `channel_id` of the channel that is ready.
948 public final byte[] channel_id;
950 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
951 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
952 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
953 * `user_channel_id` will be randomized for an inbound channel.
955 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
956 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
957 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
959 public final org.ldk.util.UInt128 user_channel_id;
961 * The `node_id` of the channel counterparty.
963 public final byte[] counterparty_node_id;
965 * The features that this channel will operate with.
967 public final org.ldk.structs.ChannelTypeFeatures channel_type;
968 private ChannelReady(long ptr, bindings.LDKEvent.ChannelReady obj) {
970 this.channel_id = obj.channel_id;
971 byte[] user_channel_id = obj.user_channel_id;
972 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
973 this.user_channel_id = user_channel_id_conv;
974 this.counterparty_node_id = obj.counterparty_node_id;
975 long channel_type = obj.channel_type;
976 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); }
977 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
978 this.channel_type = channel_type_hu_conv;
982 * Used to indicate that a previously opened channel with the given `channel_id` is in the
983 * process of closure.
985 * Note that this event is only triggered for accepted channels: if the
986 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is
987 * rejected, no `ChannelClosed` event will be sent.
989 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
990 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
992 public final static class ChannelClosed extends Event {
994 * The `channel_id` of the channel which has been closed. Note that on-chain transactions
995 * resolving the channel are likely still awaiting confirmation.
997 public final byte[] channel_id;
999 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1000 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1001 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1002 * `user_channel_id` will be randomized for inbound channels.
1003 * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
1004 * zero for objects serialized with LDK versions prior to 0.0.102.
1006 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1007 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1008 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1010 public final org.ldk.util.UInt128 user_channel_id;
1012 * The reason the channel was closed.
1014 public final org.ldk.structs.ClosureReason reason;
1016 * Counterparty in the closed channel.
1018 * This field will be `None` for objects serialized prior to LDK 0.0.117.
1020 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1022 @Nullable public final byte[] counterparty_node_id;
1024 * Channel capacity of the closing channel (sats).
1026 * This field will be `None` for objects serialized prior to LDK 0.0.117.
1028 public final org.ldk.structs.Option_u64Z channel_capacity_sats;
1030 * The original channel funding TXO; this helps checking for the existence and confirmation
1031 * status of the closing tx.
1032 * Note that for instances serialized in v0.0.119 or prior this will be missing (None).
1034 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
1036 @Nullable public final org.ldk.structs.OutPoint channel_funding_txo;
1037 private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
1039 this.channel_id = obj.channel_id;
1040 byte[] user_channel_id = obj.user_channel_id;
1041 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
1042 this.user_channel_id = user_channel_id_conv;
1043 long reason = obj.reason;
1044 org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
1045 if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
1046 this.reason = reason_hu_conv;
1047 this.counterparty_node_id = obj.counterparty_node_id;
1048 long channel_capacity_sats = obj.channel_capacity_sats;
1049 org.ldk.structs.Option_u64Z channel_capacity_sats_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(channel_capacity_sats);
1050 if (channel_capacity_sats_hu_conv != null) { channel_capacity_sats_hu_conv.ptrs_to.add(this); };
1051 this.channel_capacity_sats = channel_capacity_sats_hu_conv;
1052 long channel_funding_txo = obj.channel_funding_txo;
1053 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); }
1054 if (channel_funding_txo_hu_conv != null) { channel_funding_txo_hu_conv.ptrs_to.add(this); };
1055 this.channel_funding_txo = channel_funding_txo_hu_conv;
1059 * Used to indicate to the user that they can abandon the funding transaction and recycle the
1060 * inputs for another purpose.
1062 * This event is not guaranteed to be generated for channels that are closed due to a restart.
1064 public final static class DiscardFunding extends Event {
1066 * The channel_id of the channel which has been closed.
1068 public final byte[] channel_id;
1070 * The full transaction received from the user
1072 public final byte[] transaction;
1073 private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
1075 this.channel_id = obj.channel_id;
1076 this.transaction = obj.transaction;
1080 * Indicates a request to open a new channel by a peer.
1082 * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request,
1083 * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`]
1084 * event will _not_ be triggered if the channel is rejected.
1086 * The event is only triggered when a new open channel request is received and the
1087 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
1089 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1090 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1091 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1093 public final static class OpenChannelRequest extends Event {
1095 * The temporary channel ID of the channel requested to be opened.
1097 * When responding to the request, the `temporary_channel_id` should be passed
1098 * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
1099 * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
1101 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1102 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1104 public final byte[] temporary_channel_id;
1106 * The node_id of the counterparty requesting to open the channel.
1108 * When responding to the request, the `counterparty_node_id` should be passed
1109 * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
1110 * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
1113 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1114 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1116 public final byte[] counterparty_node_id;
1118 * The channel value of the requested channel.
1120 public final long funding_satoshis;
1122 * Our starting balance in the channel if the request is accepted, in milli-satoshi.
1124 public final long push_msat;
1126 * The features that this channel will operate with. If you reject the channel, a
1127 * well-behaved counterparty may automatically re-attempt the channel with a new set of
1130 * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
1131 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
1134 * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
1135 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
1136 * 0.0.107. Channels setting this type also need to get manually accepted via
1137 * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
1138 * or will be rejected otherwise.
1140 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
1142 public final org.ldk.structs.ChannelTypeFeatures channel_type;
1143 private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
1145 this.temporary_channel_id = obj.temporary_channel_id;
1146 this.counterparty_node_id = obj.counterparty_node_id;
1147 this.funding_satoshis = obj.funding_satoshis;
1148 this.push_msat = obj.push_msat;
1149 long channel_type = obj.channel_type;
1150 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); }
1151 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
1152 this.channel_type = channel_type_hu_conv;
1156 * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
1159 * Some scenarios where this event may be sent include:
1160 * Insufficient capacity in the outbound channel
1161 * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
1162 * When an unknown SCID is requested for forwarding a payment.
1163 * Expected MPP amount has already been reached
1164 * The HTLC has timed out
1166 * This event, however, does not get generated if an HTLC fails to meet the forwarding
1167 * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
1169 public final static class HTLCHandlingFailed extends Event {
1171 * The channel over which the HTLC was received.
1173 public final byte[] prev_channel_id;
1175 * Destination of the HTLC that failed to be processed.
1177 public final org.ldk.structs.HTLCDestination failed_next_destination;
1178 private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
1180 this.prev_channel_id = obj.prev_channel_id;
1181 long failed_next_destination = obj.failed_next_destination;
1182 org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
1183 if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
1184 this.failed_next_destination = failed_next_destination_hu_conv;
1188 * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
1189 * requires confirmed external funds to be readily available to spend.
1191 * LDK does not currently generate this event unless the
1192 * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
1193 * It is limited to the scope of channels with anchor outputs.
1195 * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
1197 public final static class BumpTransaction extends Event {
1198 public final org.ldk.structs.BumpTransactionEvent bump_transaction;
1199 private BumpTransaction(long ptr, bindings.LDKEvent.BumpTransaction obj) {
1201 long bump_transaction = obj.bump_transaction;
1202 org.ldk.structs.BumpTransactionEvent bump_transaction_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(bump_transaction);
1203 if (bump_transaction_hu_conv != null) { bump_transaction_hu_conv.ptrs_to.add(this); };
1204 this.bump_transaction = bump_transaction_hu_conv;
1208 long ret = bindings.Event_clone_ptr(this.ptr);
1209 Reference.reachabilityFence(this);
1214 * Creates a copy of the Event
1216 public Event clone() {
1217 long ret = bindings.Event_clone(this.ptr);
1218 Reference.reachabilityFence(this);
1219 if (ret >= 0 && ret <= 4096) { return null; }
1220 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1221 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1226 * Utility method to constructs a new FundingGenerationReady-variant Event
1228 public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) {
1229 long ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_value_satoshis, output_script, user_channel_id.getLEBytes());
1230 Reference.reachabilityFence(temporary_channel_id);
1231 Reference.reachabilityFence(counterparty_node_id);
1232 Reference.reachabilityFence(channel_value_satoshis);
1233 Reference.reachabilityFence(output_script);
1234 Reference.reachabilityFence(user_channel_id);
1235 if (ret >= 0 && ret <= 4096) { return null; }
1236 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1237 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1242 * Utility method to constructs a new PaymentClaimable-variant Event
1244 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.Option_ThirtyTwoBytesZ via_channel_id, org.ldk.structs.Option_U128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
1245 long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, via_channel_id.ptr, via_user_channel_id.ptr, claim_deadline.ptr);
1246 Reference.reachabilityFence(receiver_node_id);
1247 Reference.reachabilityFence(payment_hash);
1248 Reference.reachabilityFence(onion_fields);
1249 Reference.reachabilityFence(amount_msat);
1250 Reference.reachabilityFence(counterparty_skimmed_fee_msat);
1251 Reference.reachabilityFence(purpose);
1252 Reference.reachabilityFence(via_channel_id);
1253 Reference.reachabilityFence(via_user_channel_id);
1254 Reference.reachabilityFence(claim_deadline);
1255 if (ret >= 0 && ret <= 4096) { return null; }
1256 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1257 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1258 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(onion_fields); };
1259 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1260 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_channel_id); };
1261 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_user_channel_id); };
1262 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(claim_deadline); };
1267 * Utility method to constructs a new PaymentClaimed-variant Event
1269 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) {
1270 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 == null ? 0 : htlcs_conv_13.ptr).toArray() : null, sender_intended_total_msat.ptr);
1271 Reference.reachabilityFence(receiver_node_id);
1272 Reference.reachabilityFence(payment_hash);
1273 Reference.reachabilityFence(amount_msat);
1274 Reference.reachabilityFence(purpose);
1275 Reference.reachabilityFence(htlcs);
1276 Reference.reachabilityFence(sender_intended_total_msat);
1277 if (ret >= 0 && ret <= 4096) { return null; }
1278 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1279 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1280 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1281 for (ClaimedHTLC htlcs_conv_13: htlcs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(htlcs_conv_13); }; };
1282 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(sender_intended_total_msat); };
1287 * Utility method to constructs a new ConnectionNeeded-variant Event
1289 public static Event connection_needed(byte[] node_id, SocketAddress[] addresses) {
1290 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);
1291 Reference.reachabilityFence(node_id);
1292 Reference.reachabilityFence(addresses);
1293 if (ret >= 0 && ret <= 4096) { return null; }
1294 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1295 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1296 for (SocketAddress addresses_conv_15: addresses) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(addresses_conv_15); }; };
1301 * Utility method to constructs a new InvoiceRequestFailed-variant Event
1303 public static Event invoice_request_failed(byte[] payment_id) {
1304 long ret = bindings.Event_invoice_request_failed(InternalUtils.check_arr_len(payment_id, 32));
1305 Reference.reachabilityFence(payment_id);
1306 if (ret >= 0 && ret <= 4096) { return null; }
1307 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1308 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1313 * Utility method to constructs a new PaymentSent-variant Event
1315 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) {
1316 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);
1317 Reference.reachabilityFence(payment_id);
1318 Reference.reachabilityFence(payment_preimage);
1319 Reference.reachabilityFence(payment_hash);
1320 Reference.reachabilityFence(fee_paid_msat);
1321 if (ret >= 0 && ret <= 4096) { return null; }
1322 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1323 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1324 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_id); };
1325 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); };
1330 * Utility method to constructs a new PaymentFailed-variant Event
1332 public static Event payment_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Option_PaymentFailureReasonZ reason) {
1333 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), reason.ptr);
1334 Reference.reachabilityFence(payment_id);
1335 Reference.reachabilityFence(payment_hash);
1336 Reference.reachabilityFence(reason);
1337 if (ret >= 0 && ret <= 4096) { return null; }
1338 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1339 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1340 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1345 * Utility method to constructs a new PaymentPathSuccessful-variant Event
1347 public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, org.ldk.structs.Path path) {
1348 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), payment_hash.ptr, path == null ? 0 : path.ptr);
1349 Reference.reachabilityFence(payment_id);
1350 Reference.reachabilityFence(payment_hash);
1351 Reference.reachabilityFence(path);
1352 if (ret >= 0 && ret <= 4096) { return null; }
1353 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1354 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1355 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
1356 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1361 * Utility method to constructs a new PaymentPathFailed-variant Event
1363 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) {
1364 long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path == null ? 0 : path.ptr, short_channel_id.ptr);
1365 Reference.reachabilityFence(payment_id);
1366 Reference.reachabilityFence(payment_hash);
1367 Reference.reachabilityFence(payment_failed_permanently);
1368 Reference.reachabilityFence(failure);
1369 Reference.reachabilityFence(path);
1370 Reference.reachabilityFence(short_channel_id);
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(payment_id); };
1375 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
1376 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1377 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1382 * Utility method to constructs a new ProbeSuccessful-variant Event
1384 public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
1385 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr);
1386 Reference.reachabilityFence(payment_id);
1387 Reference.reachabilityFence(payment_hash);
1388 Reference.reachabilityFence(path);
1389 if (ret >= 0 && ret <= 4096) { return null; }
1390 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1391 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1392 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1397 * Utility method to constructs a new ProbeFailed-variant Event
1399 public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
1400 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr, short_channel_id.ptr);
1401 Reference.reachabilityFence(payment_id);
1402 Reference.reachabilityFence(payment_hash);
1403 Reference.reachabilityFence(path);
1404 Reference.reachabilityFence(short_channel_id);
1405 if (ret >= 0 && ret <= 4096) { return null; }
1406 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1407 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1408 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1409 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1414 * Utility method to constructs a new PendingHTLCsForwardable-variant Event
1416 public static Event pending_htlcs_forwardable(long time_forwardable) {
1417 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
1418 Reference.reachabilityFence(time_forwardable);
1419 if (ret >= 0 && ret <= 4096) { return null; }
1420 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1421 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1426 * Utility method to constructs a new HTLCIntercepted-variant Event
1428 public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
1429 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);
1430 Reference.reachabilityFence(intercept_id);
1431 Reference.reachabilityFence(requested_next_hop_scid);
1432 Reference.reachabilityFence(payment_hash);
1433 Reference.reachabilityFence(inbound_amount_msat);
1434 Reference.reachabilityFence(expected_outbound_amount_msat);
1435 if (ret >= 0 && ret <= 4096) { return null; }
1436 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1437 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1442 * Utility method to constructs a new SpendableOutputs-variant Event
1444 public static Event spendable_outputs(SpendableOutputDescriptor[] outputs, org.ldk.structs.Option_ThirtyTwoBytesZ channel_id) {
1445 long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null, channel_id.ptr);
1446 Reference.reachabilityFence(outputs);
1447 Reference.reachabilityFence(channel_id);
1448 if (ret >= 0 && ret <= 4096) { return null; }
1449 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1450 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1451 for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; };
1452 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
1457 * Utility method to constructs a new PaymentForwarded-variant Event
1459 public static Event payment_forwarded(org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id, org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) {
1460 long ret = bindings.Event_payment_forwarded(prev_channel_id.ptr, next_channel_id.ptr, fee_earned_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr);
1461 Reference.reachabilityFence(prev_channel_id);
1462 Reference.reachabilityFence(next_channel_id);
1463 Reference.reachabilityFence(fee_earned_msat);
1464 Reference.reachabilityFence(claim_from_onchain_tx);
1465 Reference.reachabilityFence(outbound_amount_forwarded_msat);
1466 if (ret >= 0 && ret <= 4096) { return null; }
1467 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1468 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1469 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(prev_channel_id); };
1470 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(next_channel_id); };
1471 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_earned_msat); };
1472 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_amount_forwarded_msat); };
1477 * Utility method to constructs a new ChannelPending-variant Event
1479 public static Event channel_pending(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo) {
1480 long ret = bindings.Event_channel_pending(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), former_temporary_channel_id.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), funding_txo == null ? 0 : funding_txo.ptr);
1481 Reference.reachabilityFence(channel_id);
1482 Reference.reachabilityFence(user_channel_id);
1483 Reference.reachabilityFence(former_temporary_channel_id);
1484 Reference.reachabilityFence(counterparty_node_id);
1485 Reference.reachabilityFence(funding_txo);
1486 if (ret >= 0 && ret <= 4096) { return null; }
1487 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1488 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1489 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(former_temporary_channel_id); };
1490 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
1495 * Utility method to constructs a new ChannelReady-variant Event
1497 public static Event channel_ready(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) {
1498 long ret = bindings.Event_channel_ready(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_type == null ? 0 : channel_type.ptr);
1499 Reference.reachabilityFence(channel_id);
1500 Reference.reachabilityFence(user_channel_id);
1501 Reference.reachabilityFence(counterparty_node_id);
1502 Reference.reachabilityFence(channel_type);
1503 if (ret >= 0 && ret <= 4096) { return null; }
1504 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1505 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1506 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1511 * Utility method to constructs a new ChannelClosed-variant Event
1513 public static Event channel_closed(byte[] 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) {
1514 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), channel_capacity_sats.ptr, channel_funding_txo == null ? 0 : channel_funding_txo.ptr);
1515 Reference.reachabilityFence(channel_id);
1516 Reference.reachabilityFence(user_channel_id);
1517 Reference.reachabilityFence(reason);
1518 Reference.reachabilityFence(counterparty_node_id);
1519 Reference.reachabilityFence(channel_capacity_sats);
1520 Reference.reachabilityFence(channel_funding_txo);
1521 if (ret >= 0 && ret <= 4096) { return null; }
1522 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1523 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1524 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1525 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_capacity_sats); };
1526 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_funding_txo); };
1531 * Utility method to constructs a new DiscardFunding-variant Event
1533 public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1534 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1535 Reference.reachabilityFence(channel_id);
1536 Reference.reachabilityFence(transaction);
1537 if (ret >= 0 && ret <= 4096) { return null; }
1538 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1539 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1544 * Utility method to constructs a new OpenChannelRequest-variant Event
1546 public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) {
1547 long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr);
1548 Reference.reachabilityFence(temporary_channel_id);
1549 Reference.reachabilityFence(counterparty_node_id);
1550 Reference.reachabilityFence(funding_satoshis);
1551 Reference.reachabilityFence(push_msat);
1552 Reference.reachabilityFence(channel_type);
1553 if (ret >= 0 && ret <= 4096) { return null; }
1554 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1555 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1556 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1561 * Utility method to constructs a new HTLCHandlingFailed-variant Event
1563 public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
1564 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1565 Reference.reachabilityFence(prev_channel_id);
1566 Reference.reachabilityFence(failed_next_destination);
1567 if (ret >= 0 && ret <= 4096) { return null; }
1568 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1569 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1570 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); };
1575 * Utility method to constructs a new BumpTransaction-variant Event
1577 public static Event bump_transaction(org.ldk.structs.BumpTransactionEvent a) {
1578 long ret = bindings.Event_bump_transaction(a.ptr);
1579 Reference.reachabilityFence(a);
1580 if (ret >= 0 && ret <= 4096) { return null; }
1581 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1582 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1583 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
1588 * Checks if two Events contain equal inner contents.
1589 * This ignores pointers and is_owned flags and looks at the values in fields.
1591 public boolean eq(org.ldk.structs.Event b) {
1592 boolean ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr);
1593 Reference.reachabilityFence(this);
1594 Reference.reachabilityFence(b);
1598 @Override public boolean equals(Object o) {
1599 if (!(o instanceof Event)) return false;
1600 return this.eq((Event)o);
1603 * Serialize the Event object into a byte array which can be read by Event_read
1605 public byte[] write() {
1606 byte[] ret = bindings.Event_write(this.ptr);
1607 Reference.reachabilityFence(this);