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.PaymentReceived.class) {
32 return new PaymentReceived(ptr, (bindings.LDKEvent.PaymentReceived)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.PaymentSent.class) {
38 return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val);
40 if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) {
41 return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val);
43 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) {
44 return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val);
46 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
47 return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
49 if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) {
50 return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val);
52 if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) {
53 return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val);
55 if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
56 return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
58 if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
59 return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
61 if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
62 return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
64 if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
65 return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
67 if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) {
68 return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val);
70 if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
71 return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
73 if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
74 return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
76 assert false; return null; // Unreachable without extending the (internal) bindings interface
80 * Used to indicate that the client should generate a funding transaction with the given
81 * parameters and then call [`ChannelManager::funding_transaction_generated`].
82 * Generated in [`ChannelManager`] message handling.
83 * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
84 * counterparty can steal your funds!
86 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
87 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
89 public final static class FundingGenerationReady extends Event {
91 * The random channel_id we picked which you'll need to pass into
92 * [`ChannelManager::funding_transaction_generated`].
94 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
96 public final byte[] temporary_channel_id;
98 * The counterparty's node_id, which you'll need to pass back into
99 * [`ChannelManager::funding_transaction_generated`].
101 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
103 public final byte[] counterparty_node_id;
105 * The value, in satoshis, that the output should have.
107 public final long channel_value_satoshis;
109 * The script which should be used in the transaction output.
111 public final byte[] output_script;
113 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
114 * an inbound channel.
116 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
118 public final long user_channel_id;
119 private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
121 this.temporary_channel_id = obj.temporary_channel_id;
122 this.counterparty_node_id = obj.counterparty_node_id;
123 this.channel_value_satoshis = obj.channel_value_satoshis;
124 this.output_script = obj.output_script;
125 this.user_channel_id = obj.user_channel_id;
129 * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
130 * feed it to [`ChannelManager::claim_funds`] to get it....
132 * Note that if the preimage is not known, you should call
133 * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
134 * network congestion.
135 * If you fail to call either [`ChannelManager::claim_funds`] or
136 * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
137 * automatically failed.
140 * LDK will not stop an inbound payment from being paid multiple times, so multiple
141 * `PaymentReceived` events may be generated for the same payment.
143 * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
144 * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
146 public final static class PaymentReceived extends Event {
148 * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
149 * not stop you from registering duplicate payment hashes for inbound payments.
151 public final byte[] payment_hash;
153 * The value, in thousandths of a satoshi, that this payment is for.
155 public final long amount_msat;
157 * Information for claiming this received payment, based on whether the purpose of the
158 * payment is to pay an invoice or to send a spontaneous payment.
160 public final org.ldk.structs.PaymentPurpose purpose;
161 private PaymentReceived(long ptr, bindings.LDKEvent.PaymentReceived obj) {
163 this.payment_hash = obj.payment_hash;
164 this.amount_msat = obj.amount_msat;
165 long purpose = obj.purpose;
166 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
167 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
168 this.purpose = purpose_hu_conv;
172 * Indicates a payment has been claimed and we've received money!
174 * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
175 * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
176 * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
177 * [`Event::PaymentReceived`] event.
180 * LDK will not stop an inbound payment from being paid multiple times, so multiple
181 * `PaymentReceived` events may be generated for the same payment. If you then call
182 * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
183 * multiple `PaymentClaimed` events.
185 * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
187 public final static class PaymentClaimed extends Event {
189 * The payment hash of the claimed payment. Note that LDK will not stop you from
190 * registering duplicate payment hashes for inbound payments.
192 public final byte[] payment_hash;
194 * The value, in thousandths of a satoshi, that this payment is for.
196 public final long amount_msat;
198 * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
199 * spontaneous payment.
201 public final org.ldk.structs.PaymentPurpose purpose;
202 private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
204 this.payment_hash = obj.payment_hash;
205 this.amount_msat = obj.amount_msat;
206 long purpose = obj.purpose;
207 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
208 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
209 this.purpose = purpose_hu_conv;
213 * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
214 * and we got back the payment preimage for it).
216 * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
217 * event. In this situation, you SHOULD treat this payment as having succeeded.
219 public final static class PaymentSent extends Event {
221 * The id returned by [`ChannelManager::send_payment`] and used with
222 * [`ChannelManager::retry_payment`].
224 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
225 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
227 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
229 @Nullable public final byte[] payment_id;
231 * The preimage to the hash given to ChannelManager::send_payment.
232 * Note that this serves as a payment receipt, if you wish to have such a thing, you must
235 public final byte[] payment_preimage;
237 * The hash that was given to [`ChannelManager::send_payment`].
239 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
241 public final byte[] payment_hash;
243 * The total fee which was spent at intermediate hops in this payment, across all paths.
245 * Note that, like [`Route::get_total_fees`] this does *not* include any potential
246 * overpayment to the recipient node.
248 * If the recipient or an intermediate node misbehaves and gives us free money, this may
249 * overstate the amount paid, though this is unlikely.
251 * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
253 public final org.ldk.structs.Option_u64Z fee_paid_msat;
254 private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
256 this.payment_id = obj.payment_id;
257 this.payment_preimage = obj.payment_preimage;
258 this.payment_hash = obj.payment_hash;
259 long fee_paid_msat = obj.fee_paid_msat;
260 org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
261 if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
262 this.fee_paid_msat = fee_paid_msat_hu_conv;
266 * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
267 * provide failure information for each MPP part in the payment.
269 * This event is provided once there are no further pending HTLCs for the payment and the
270 * payment is no longer retryable, either due to a several-block timeout or because
271 * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
273 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
275 public final static class PaymentFailed extends Event {
277 * The id returned by [`ChannelManager::send_payment`] and used with
278 * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
280 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
281 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
282 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
284 public final byte[] payment_id;
286 * The hash that was given to [`ChannelManager::send_payment`].
288 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
290 public final byte[] payment_hash;
291 private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
293 this.payment_id = obj.payment_id;
294 this.payment_hash = obj.payment_hash;
298 * Indicates that a path for an outbound payment was successful.
300 * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
301 * [`Event::PaymentSent`] for obtaining the payment preimage.
303 public final static class PaymentPathSuccessful extends Event {
305 * The id returned by [`ChannelManager::send_payment`] and used with
306 * [`ChannelManager::retry_payment`].
308 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
309 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
311 public final byte[] payment_id;
313 * The hash that was given to [`ChannelManager::send_payment`].
315 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
317 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
319 @Nullable public final byte[] payment_hash;
321 * The payment path that was successful.
323 * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
325 public final RouteHop[] path;
326 private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
328 this.payment_id = obj.payment_id;
329 this.payment_hash = obj.payment_hash;
330 long[] path = obj.path;
331 int path_conv_10_len = path.length;
332 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
333 for (int k = 0; k < path_conv_10_len; k++) {
334 long path_conv_10 = path[k];
335 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
336 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
337 path_conv_10_arr[k] = path_conv_10_hu_conv;
339 this.path = path_conv_10_arr;
343 * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
344 * something. You may wish to retry with a different route.
346 * Note that this does *not* indicate that all paths for an MPP payment have failed, see
347 * [`Event::PaymentFailed`] and [`all_paths_failed`].
349 * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
351 public final static class PaymentPathFailed extends Event {
353 * The id returned by [`ChannelManager::send_payment`] and used with
354 * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
356 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
357 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
358 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
360 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
362 @Nullable public final byte[] payment_id;
364 * The hash that was given to [`ChannelManager::send_payment`].
366 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
368 public final byte[] payment_hash;
370 * Indicates the payment was rejected for some reason by the recipient. This implies that
371 * the payment has failed, not just the route in question. If this is not set, you may
372 * retry the payment via a different route.
374 public final boolean payment_failed_permanently;
376 * Any failure information conveyed via the Onion return packet by a node along the failed
379 * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
380 * account the update.
382 * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
384 public final org.ldk.structs.Option_NetworkUpdateZ network_update;
386 * For both single-path and multi-path payments, this is set if all paths of the payment have
387 * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
388 * larger MPP payment were still in flight when this event was generated.
390 * Note that if you are retrying individual MPP parts, using this value to determine if a
391 * payment has fully failed is race-y. Because multiple failures can happen prior to events
392 * being processed, you may retry in response to a first failure, with a second failure
393 * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
394 * you will see `all_paths_failed` set even though the retry of the first failure still
395 * has an associated in-flight HTLC. See (1) for an example of such a failure.
397 * If you wish to retry individual MPP parts and learn when a payment has failed, you must
398 * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
400 * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
402 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
404 public final boolean all_paths_failed;
406 * The payment path that failed.
408 public final RouteHop[] path;
410 * The channel responsible for the failed payment path.
412 * Note that for route hints or for the first hop in a path this may be an SCID alias and
413 * may not refer to a channel in the public network graph. These aliases may also collide
414 * with channels in the public network graph.
416 * If this is `Some`, then the corresponding channel should be avoided when the payment is
417 * retried. May be `None` for older [`Event`] serializations.
419 public final org.ldk.structs.Option_u64Z short_channel_id;
421 * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
423 * See [`find_route`] for details.
425 * [`Route`]: crate::routing::router::Route
426 * [`find_route`]: crate::routing::router::find_route
428 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
430 @Nullable public final org.ldk.structs.RouteParameters retry;
431 private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
433 this.payment_id = obj.payment_id;
434 this.payment_hash = obj.payment_hash;
435 this.payment_failed_permanently = obj.payment_failed_permanently;
436 long network_update = obj.network_update;
437 org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update);
438 if (network_update_hu_conv != null) { network_update_hu_conv.ptrs_to.add(this); };
439 this.network_update = network_update_hu_conv;
440 this.all_paths_failed = obj.all_paths_failed;
441 long[] path = obj.path;
442 int path_conv_10_len = path.length;
443 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
444 for (int k = 0; k < path_conv_10_len; k++) {
445 long path_conv_10 = path[k];
446 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
447 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
448 path_conv_10_arr[k] = path_conv_10_hu_conv;
450 this.path = path_conv_10_arr;
451 long short_channel_id = obj.short_channel_id;
452 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
453 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
454 this.short_channel_id = short_channel_id_hu_conv;
455 long retry = obj.retry;
456 org.ldk.structs.RouteParameters retry_hu_conv = null; if (retry < 0 || retry > 4096) { retry_hu_conv = new org.ldk.structs.RouteParameters(null, retry); }
457 if (retry_hu_conv != null) { retry_hu_conv.ptrs_to.add(this); };
458 this.retry = retry_hu_conv;
462 * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
464 public final static class ProbeSuccessful extends Event {
466 * The id returned by [`ChannelManager::send_probe`].
468 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
470 public final byte[] payment_id;
472 * The hash generated by [`ChannelManager::send_probe`].
474 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
476 public final byte[] payment_hash;
478 * The payment path that was successful.
480 public final RouteHop[] path;
481 private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
483 this.payment_id = obj.payment_id;
484 this.payment_hash = obj.payment_hash;
485 long[] path = obj.path;
486 int path_conv_10_len = path.length;
487 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
488 for (int k = 0; k < path_conv_10_len; k++) {
489 long path_conv_10 = path[k];
490 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
491 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
492 path_conv_10_arr[k] = path_conv_10_hu_conv;
494 this.path = path_conv_10_arr;
498 * Indicates that a probe payment we sent failed at an intermediary node on the path.
500 public final static class ProbeFailed extends Event {
502 * The id returned by [`ChannelManager::send_probe`].
504 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
506 public final byte[] payment_id;
508 * The hash generated by [`ChannelManager::send_probe`].
510 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
512 public final byte[] payment_hash;
514 * The payment path that failed.
516 public final RouteHop[] path;
518 * The channel responsible for the failed probe.
520 * Note that for route hints or for the first hop in a path this may be an SCID alias and
521 * may not refer to a channel in the public network graph. These aliases may also collide
522 * with channels in the public network graph.
524 public final org.ldk.structs.Option_u64Z short_channel_id;
525 private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
527 this.payment_id = obj.payment_id;
528 this.payment_hash = obj.payment_hash;
529 long[] path = obj.path;
530 int path_conv_10_len = path.length;
531 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
532 for (int k = 0; k < path_conv_10_len; k++) {
533 long path_conv_10 = path[k];
534 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
535 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
536 path_conv_10_arr[k] = path_conv_10_hu_conv;
538 this.path = path_conv_10_arr;
539 long short_channel_id = obj.short_channel_id;
540 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
541 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
542 this.short_channel_id = short_channel_id_hu_conv;
546 * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
547 * a time in the future.
549 * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
551 public final static class PendingHTLCsForwardable extends Event {
553 * The minimum amount of time that should be waited prior to calling
554 * process_pending_htlc_forwards. To increase the effort required to correlate payments,
555 * you should wait a random amount of time in roughly the range (now + time_forwardable,
556 * now + 5*time_forwardable).
558 public final long time_forwardable;
559 private PendingHTLCsForwardable(long ptr, bindings.LDKEvent.PendingHTLCsForwardable obj) {
561 this.time_forwardable = obj.time_forwardable;
565 * Used to indicate that an output which you should know how to spend was confirmed on chain
566 * and is now spendable.
567 * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
568 * counterparty spending them due to some kind of timeout. Thus, you need to store them
569 * somewhere and spend them when you create on-chain transactions.
571 public final static class SpendableOutputs extends Event {
573 * The outputs which you should store as spendable by you.
575 public final SpendableOutputDescriptor[] outputs;
576 private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) {
578 long[] outputs = obj.outputs;
579 int outputs_conv_27_len = outputs.length;
580 SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
581 for (int b = 0; b < outputs_conv_27_len; b++) {
582 long outputs_conv_27 = outputs[b];
583 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
584 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
585 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
587 this.outputs = outputs_conv_27_arr;
591 * This event is generated when a payment has been successfully forwarded through us and a
592 * forwarding fee earned.
594 public final static class PaymentForwarded extends Event {
596 * The incoming channel between the previous node and us. This is only `None` for events
597 * generated or serialized by versions prior to 0.0.107.
599 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
601 @Nullable public final byte[] prev_channel_id;
603 * The outgoing channel between the next node and us. This is only `None` for events
604 * generated or serialized by versions prior to 0.0.107.
606 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
608 @Nullable public final byte[] next_channel_id;
610 * The fee, in milli-satoshis, which was earned as a result of the payment.
612 * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
613 * was pending, the amount the next hop claimed will have been rounded down to the nearest
614 * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
615 * claimed the full value in millisatoshis from the source. In this case,
616 * `claim_from_onchain_tx` will be set.
618 * If the channel which sent us the payment has been force-closed, we will claim the funds
619 * via an on-chain transaction. In that case we do not yet know the on-chain transaction
620 * fees which we will spend and will instead set this to `None`. It is possible duplicate
621 * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
624 public final org.ldk.structs.Option_u64Z fee_earned_msat;
626 * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
629 public final boolean claim_from_onchain_tx;
630 private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
632 this.prev_channel_id = obj.prev_channel_id;
633 this.next_channel_id = obj.next_channel_id;
634 long fee_earned_msat = obj.fee_earned_msat;
635 org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
636 if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
637 this.fee_earned_msat = fee_earned_msat_hu_conv;
638 this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
642 * Used to indicate that a previously opened channel with the given `channel_id` is in the
643 * process of closure.
645 public final static class ChannelClosed extends Event {
647 * The channel_id of the channel which has been closed. Note that on-chain transactions
648 * resolving the channel are likely still awaiting confirmation.
650 public final byte[] channel_id;
652 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
653 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
654 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
655 * `user_channel_id` will be 0 for an inbound channel.
656 * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
658 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
659 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
660 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
662 public final long user_channel_id;
664 * The reason the channel was closed.
666 public final org.ldk.structs.ClosureReason reason;
667 private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
669 this.channel_id = obj.channel_id;
670 this.user_channel_id = obj.user_channel_id;
671 long reason = obj.reason;
672 org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
673 if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
674 this.reason = reason_hu_conv;
678 * Used to indicate to the user that they can abandon the funding transaction and recycle the
679 * inputs for another purpose.
681 public final static class DiscardFunding extends Event {
683 * The channel_id of the channel which has been closed.
685 public final byte[] channel_id;
687 * The full transaction received from the user
689 public final byte[] transaction;
690 private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
692 this.channel_id = obj.channel_id;
693 this.transaction = obj.transaction;
697 * Indicates a request to open a new channel by a peer.
699 * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
700 * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
702 * The event is only triggered when a new open channel request is received and the
703 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
705 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
706 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
707 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
709 public final static class OpenChannelRequest extends Event {
711 * The temporary channel ID of the channel requested to be opened.
713 * When responding to the request, the `temporary_channel_id` should be passed
714 * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
715 * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
717 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
718 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
720 public final byte[] temporary_channel_id;
722 * The node_id of the counterparty requesting to open the channel.
724 * When responding to the request, the `counterparty_node_id` should be passed
725 * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
726 * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
729 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
730 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
732 public final byte[] counterparty_node_id;
734 * The channel value of the requested channel.
736 public final long funding_satoshis;
738 * Our starting balance in the channel if the request is accepted, in milli-satoshi.
740 public final long push_msat;
742 * The features that this channel will operate with. If you reject the channel, a
743 * well-behaved counterparty may automatically re-attempt the channel with a new set of
746 * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
747 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
750 * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
751 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
752 * 0.0.107. Channels setting this type also need to get manually accepted via
753 * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
754 * or will be rejected otherwise.
756 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
758 public final org.ldk.structs.ChannelTypeFeatures channel_type;
759 private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
761 this.temporary_channel_id = obj.temporary_channel_id;
762 this.counterparty_node_id = obj.counterparty_node_id;
763 this.funding_satoshis = obj.funding_satoshis;
764 this.push_msat = obj.push_msat;
765 long channel_type = obj.channel_type;
766 org.ldk.structs.ChannelTypeFeatures channel_type_hu_conv = null; if (channel_type < 0 || channel_type > 4096) { channel_type_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, channel_type); }
767 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
768 this.channel_type = channel_type_hu_conv;
772 * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
775 * Some scenarios where this event may be sent include:
776 * Insufficient capacity in the outbound channel
777 * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
778 * When an unknown SCID is requested for forwarding a payment.
779 * Claiming an amount for an MPP payment that exceeds the HTLC total
780 * The HTLC has timed out
782 * This event, however, does not get generated if an HTLC fails to meet the forwarding
783 * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
785 public final static class HTLCHandlingFailed extends Event {
787 * The channel over which the HTLC was received.
789 public final byte[] prev_channel_id;
791 * Destination of the HTLC that failed to be processed.
793 public final org.ldk.structs.HTLCDestination failed_next_destination;
794 private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
796 this.prev_channel_id = obj.prev_channel_id;
797 long failed_next_destination = obj.failed_next_destination;
798 org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
799 if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
800 this.failed_next_destination = failed_next_destination_hu_conv;
804 long ret = bindings.Event_clone_ptr(this.ptr);
805 Reference.reachabilityFence(this);
810 * Creates a copy of the Event
812 public Event clone() {
813 long ret = bindings.Event_clone(this.ptr);
814 Reference.reachabilityFence(this);
815 if (ret >= 0 && ret <= 4096) { return null; }
816 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
817 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
822 * Utility method to constructs a new FundingGenerationReady-variant Event
824 public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, long user_channel_id) {
825 long ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_value_satoshis, output_script, user_channel_id);
826 Reference.reachabilityFence(temporary_channel_id);
827 Reference.reachabilityFence(counterparty_node_id);
828 Reference.reachabilityFence(channel_value_satoshis);
829 Reference.reachabilityFence(output_script);
830 Reference.reachabilityFence(user_channel_id);
831 if (ret >= 0 && ret <= 4096) { return null; }
832 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
833 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
838 * Utility method to constructs a new PaymentReceived-variant Event
840 public static Event payment_received(byte[] payment_hash, long amount_msat, PaymentPurpose purpose) {
841 long ret = bindings.Event_payment_received(InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
842 Reference.reachabilityFence(payment_hash);
843 Reference.reachabilityFence(amount_msat);
844 Reference.reachabilityFence(purpose);
845 if (ret >= 0 && ret <= 4096) { return null; }
846 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
847 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
852 * Utility method to constructs a new PaymentClaimed-variant Event
854 public static Event payment_claimed(byte[] payment_hash, long amount_msat, PaymentPurpose purpose) {
855 long ret = bindings.Event_payment_claimed(InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
856 Reference.reachabilityFence(payment_hash);
857 Reference.reachabilityFence(amount_msat);
858 Reference.reachabilityFence(purpose);
859 if (ret >= 0 && ret <= 4096) { return null; }
860 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
861 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
866 * Utility method to constructs a new PaymentSent-variant Event
868 public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, Option_u64Z fee_paid_msat) {
869 long ret = bindings.Event_payment_sent(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
870 Reference.reachabilityFence(payment_id);
871 Reference.reachabilityFence(payment_preimage);
872 Reference.reachabilityFence(payment_hash);
873 Reference.reachabilityFence(fee_paid_msat);
874 if (ret >= 0 && ret <= 4096) { return null; }
875 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
876 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
881 * Utility method to constructs a new PaymentFailed-variant Event
883 public static Event payment_failed(byte[] payment_id, byte[] payment_hash) {
884 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32));
885 Reference.reachabilityFence(payment_id);
886 Reference.reachabilityFence(payment_hash);
887 if (ret >= 0 && ret <= 4096) { return null; }
888 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
889 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
894 * Utility method to constructs a new PaymentPathSuccessful-variant Event
896 public static Event payment_path_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
897 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null);
898 Reference.reachabilityFence(payment_id);
899 Reference.reachabilityFence(payment_hash);
900 Reference.reachabilityFence(path);
901 if (ret >= 0 && ret <= 4096) { return null; }
902 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
903 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
904 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
909 * Utility method to constructs a new PaymentPathFailed-variant Event
911 public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id, RouteParameters retry) {
912 long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr);
913 Reference.reachabilityFence(payment_id);
914 Reference.reachabilityFence(payment_hash);
915 Reference.reachabilityFence(payment_failed_permanently);
916 Reference.reachabilityFence(network_update);
917 Reference.reachabilityFence(all_paths_failed);
918 Reference.reachabilityFence(path);
919 Reference.reachabilityFence(short_channel_id);
920 Reference.reachabilityFence(retry);
921 if (ret >= 0 && ret <= 4096) { return null; }
922 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
923 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
924 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
925 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry); };
930 * Utility method to constructs a new ProbeSuccessful-variant Event
932 public static Event probe_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
933 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null);
934 Reference.reachabilityFence(payment_id);
935 Reference.reachabilityFence(payment_hash);
936 Reference.reachabilityFence(path);
937 if (ret >= 0 && ret <= 4096) { return null; }
938 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
939 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
940 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
945 * Utility method to constructs a new ProbeFailed-variant Event
947 public static Event probe_failed(byte[] payment_id, byte[] payment_hash, RouteHop[] path, Option_u64Z short_channel_id) {
948 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id.ptr);
949 Reference.reachabilityFence(payment_id);
950 Reference.reachabilityFence(payment_hash);
951 Reference.reachabilityFence(path);
952 Reference.reachabilityFence(short_channel_id);
953 if (ret >= 0 && ret <= 4096) { return null; }
954 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
955 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
956 for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
961 * Utility method to constructs a new PendingHTLCsForwardable-variant Event
963 public static Event pending_htlcs_forwardable(long time_forwardable) {
964 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
965 Reference.reachabilityFence(time_forwardable);
966 if (ret >= 0 && ret <= 4096) { return null; }
967 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
968 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
973 * Utility method to constructs a new SpendableOutputs-variant Event
975 public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) {
976 long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null);
977 Reference.reachabilityFence(outputs);
978 if (ret >= 0 && ret <= 4096) { return null; }
979 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
980 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
985 * Utility method to constructs a new PaymentForwarded-variant Event
987 public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) {
988 long ret = bindings.Event_payment_forwarded(InternalUtils.check_arr_len(prev_channel_id, 32), InternalUtils.check_arr_len(next_channel_id, 32), fee_earned_msat.ptr, claim_from_onchain_tx);
989 Reference.reachabilityFence(prev_channel_id);
990 Reference.reachabilityFence(next_channel_id);
991 Reference.reachabilityFence(fee_earned_msat);
992 Reference.reachabilityFence(claim_from_onchain_tx);
993 if (ret >= 0 && ret <= 4096) { return null; }
994 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
995 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1000 * Utility method to constructs a new ChannelClosed-variant Event
1002 public static Event channel_closed(byte[] channel_id, long user_channel_id, ClosureReason reason) {
1003 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id, reason.ptr);
1004 Reference.reachabilityFence(channel_id);
1005 Reference.reachabilityFence(user_channel_id);
1006 Reference.reachabilityFence(reason);
1007 if (ret >= 0 && ret <= 4096) { return null; }
1008 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1009 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1014 * Utility method to constructs a new DiscardFunding-variant Event
1016 public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1017 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1018 Reference.reachabilityFence(channel_id);
1019 Reference.reachabilityFence(transaction);
1020 if (ret >= 0 && ret <= 4096) { return null; }
1021 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1022 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1027 * Utility method to constructs a new OpenChannelRequest-variant Event
1029 public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, ChannelTypeFeatures channel_type) {
1030 long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr);
1031 Reference.reachabilityFence(temporary_channel_id);
1032 Reference.reachabilityFence(counterparty_node_id);
1033 Reference.reachabilityFence(funding_satoshis);
1034 Reference.reachabilityFence(push_msat);
1035 Reference.reachabilityFence(channel_type);
1036 if (ret >= 0 && ret <= 4096) { return null; }
1037 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1038 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1039 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1044 * Utility method to constructs a new HTLCHandlingFailed-variant Event
1046 public static Event htlchandling_failed(byte[] prev_channel_id, HTLCDestination failed_next_destination) {
1047 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1048 Reference.reachabilityFence(prev_channel_id);
1049 Reference.reachabilityFence(failed_next_destination);
1050 if (ret >= 0 && ret <= 4096) { return null; }
1051 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1052 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1057 * Serialize the Event object into a byte array which can be read by Event_read
1059 public byte[] write() {
1060 byte[] ret = bindings.Event_write(this.ptr);
1061 Reference.reachabilityFence(this);