if (raw_val.getClass() == bindings.LDKEvent.FundingGenerationReady.class) {
return new FundingGenerationReady(ptr, (bindings.LDKEvent.FundingGenerationReady)raw_val);
}
- if (raw_val.getClass() == bindings.LDKEvent.PaymentReceived.class) {
- return new PaymentReceived(ptr, (bindings.LDKEvent.PaymentReceived)raw_val);
+ if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimable.class) {
+ return new PaymentClaimable(ptr, (bindings.LDKEvent.PaymentClaimable)raw_val);
}
if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimed.class) {
return new PaymentClaimed(ptr, (bindings.LDKEvent.PaymentClaimed)raw_val);
if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
}
+ if (raw_val.getClass() == bindings.LDKEvent.HTLCIntercepted.class) {
+ return new HTLCIntercepted(ptr, (bindings.LDKEvent.HTLCIntercepted)raw_val);
+ }
if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
}
if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
}
+ if (raw_val.getClass() == bindings.LDKEvent.ChannelReady.class) {
+ return new ChannelReady(ptr, (bindings.LDKEvent.ChannelReady)raw_val);
+ }
if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
}
*/
public final byte[] output_script;
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
- * an inbound channel.
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
+ * random value for an inbound channel. This may be zero for objects serialized with LDK
+ * versions prior to 0.0.113.
*
* [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
*/
- public final long user_channel_id;
+ public final org.ldk.util.UInt128 user_channel_id;
private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
super(null, ptr);
this.temporary_channel_id = obj.temporary_channel_id;
this.counterparty_node_id = obj.counterparty_node_id;
this.channel_value_satoshis = obj.channel_value_satoshis;
this.output_script = obj.output_script;
- this.user_channel_id = obj.user_channel_id;
+ byte[] user_channel_id = obj.user_channel_id;
+ org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
+ this.user_channel_id = user_channel_id_conv;
}
}
/**
- * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
- * feed it to [`ChannelManager::claim_funds`] to get it....
+ * Indicates that we've been offered a payment and it needs to be claimed via calling
+ * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
*
* Note that if the preimage is not known, you should call
- * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
- * network congestion.
- * If you fail to call either [`ChannelManager::claim_funds`] or
- * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
+ * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
+ * to free up resources for this HTLC and avoid network congestion.
+ * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
+ * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
* automatically failed.
*
* # Note
* LDK will not stop an inbound payment from being paid multiple times, so multiple
- * `PaymentReceived` events may be generated for the same payment.
+ * `PaymentClaimable` events may be generated for the same payment.
+ *
+ * # Note
+ * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
*
* [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
* [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
+ * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
*/
- public final static class PaymentReceived extends Event {
+ public final static class PaymentClaimable extends Event {
+ /**
+ * The node that will receive the payment after it has been claimed.
+ * This is useful to identify payments received via [phantom nodes].
+ * This field will always be filled in when the event was generated by LDK versions
+ * 0.0.113 and above.
+ *
+ * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ @Nullable public final byte[] receiver_node_id;
/**
* The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
* not stop you from registering duplicate payment hashes for inbound payments.
* payment is to pay an invoice or to send a spontaneous payment.
*/
public final org.ldk.structs.PaymentPurpose purpose;
- private PaymentReceived(long ptr, bindings.LDKEvent.PaymentReceived obj) {
+ /**
+ * The `channel_id` indicating over which channel we received the payment.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ @Nullable public final byte[] via_channel_id;
+ /**
+ * The `user_channel_id` indicating over which channel we received the payment.
+ */
+ public final org.ldk.structs.Option_u128Z via_user_channel_id;
+ private PaymentClaimable(long ptr, bindings.LDKEvent.PaymentClaimable obj) {
super(null, ptr);
+ this.receiver_node_id = obj.receiver_node_id;
this.payment_hash = obj.payment_hash;
this.amount_msat = obj.amount_msat;
long purpose = obj.purpose;
org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
- purpose_hu_conv.ptrs_to.add(this);
+ if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
this.purpose = purpose_hu_conv;
+ this.via_channel_id = obj.via_channel_id;
+ long via_user_channel_id = obj.via_user_channel_id;
+ org.ldk.structs.Option_u128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_u128Z.constr_from_ptr(via_user_channel_id);
+ if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.add(this); };
+ this.via_user_channel_id = via_user_channel_id_hu_conv;
}
}
/**
* Indicates a payment has been claimed and we've received money!
*
* This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
- * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
+ * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
* [`ChannelManager::claim_funds`] call you may see this event without a corresponding
- * [`Event::PaymentReceived`] event.
+ * [`Event::PaymentClaimable`] event.
*
* # Note
* LDK will not stop an inbound payment from being paid multiple times, so multiple
- * `PaymentReceived` events may be generated for the same payment. If you then call
- * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
+ * `PaymentClaimable` events may be generated for the same payment. If you then call
+ * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
* multiple `PaymentClaimed` events.
*
* [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
*/
public final static class PaymentClaimed extends Event {
+ /**
+ * The node that received the payment.
+ * This is useful to identify payments which were received via [phantom nodes].
+ * This field will always be filled in when the event was generated by LDK versions
+ * 0.0.113 and above.
+ *
+ * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ @Nullable public final byte[] receiver_node_id;
/**
* The payment hash of the claimed payment. Note that LDK will not stop you from
* registering duplicate payment hashes for inbound payments.
*/
public final long amount_msat;
/**
- * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
+ * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
* spontaneous payment.
*/
public final org.ldk.structs.PaymentPurpose purpose;
private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
super(null, ptr);
+ this.receiver_node_id = obj.receiver_node_id;
this.payment_hash = obj.payment_hash;
this.amount_msat = obj.amount_msat;
long purpose = obj.purpose;
org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
- purpose_hu_conv.ptrs_to.add(this);
+ if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
this.purpose = purpose_hu_conv;
}
}
*/
public final static class PaymentSent extends Event {
/**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`].
+ * The id returned by [`ChannelManager::send_payment`].
*
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
this.payment_hash = obj.payment_hash;
long fee_paid_msat = obj.fee_paid_msat;
org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
- fee_paid_msat_hu_conv.ptrs_to.add(this);
+ if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
this.fee_paid_msat = fee_paid_msat_hu_conv;
}
}
/**
* Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
- * provide failure information for each MPP part in the payment.
+ * provide failure information for each path attempt in the payment, including retries.
*
* This event is provided once there are no further pending HTLCs for the payment and the
- * payment is no longer retryable, either due to a several-block timeout or because
- * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
+ * payment is no longer retryable, due either to the [`Retry`] provided or
+ * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
*
+ * [`Retry`]: crate::ln::channelmanager::Retry
* [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
public final static class PaymentFailed extends Event {
/**
* The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
+ * [`ChannelManager::abandon_payment`].
*
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
* [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
public final byte[] payment_id;
*/
public final static class PaymentPathSuccessful extends Event {
/**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`].
+ * The id returned by [`ChannelManager::send_payment`].
*
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
*/
public final byte[] payment_id;
/**
for (int k = 0; k < path_conv_10_len; k++) {
long path_conv_10 = path[k];
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); }
- path_conv_10_hu_conv.ptrs_to.add(this);
+ if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
path_conv_10_arr[k] = path_conv_10_hu_conv;
}
this.path = path_conv_10_arr;
}
}
/**
- * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
- * something. You may wish to retry with a different route.
+ * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
+ * handle the HTLC.
*
* Note that this does *not* indicate that all paths for an MPP payment have failed, see
- * [`Event::PaymentFailed`] and [`all_paths_failed`].
+ * [`Event::PaymentFailed`].
+ *
+ * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
+ * been exhausted.
*
- * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
public final static class PaymentPathFailed extends Event {
/**
* The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
+ * [`ChannelManager::abandon_payment`].
*
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
* [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
public final byte[] payment_hash;
/**
* Indicates the payment was rejected for some reason by the recipient. This implies that
- * the payment has failed, not just the route in question. If this is not set, you may
- * retry the payment via a different route.
+ * the payment has failed, not just the route in question. If this is not set, the payment may
+ * be retried via a different route.
*/
- public final boolean rejected_by_dest;
+ public final boolean payment_failed_permanently;
/**
- * Any failure information conveyed via the Onion return packet by a node along the failed
- * payment route.
- *
- * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
- * account the update.
+ * Extra error details based on the failure type. May contain an update that needs to be
+ * applied to the [`NetworkGraph`].
*
* [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
*/
- public final org.ldk.structs.Option_NetworkUpdateZ network_update;
- /**
- * For both single-path and multi-path payments, this is set if all paths of the payment have
- * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
- * larger MPP payment were still in flight when this event was generated.
- *
- * Note that if you are retrying individual MPP parts, using this value to determine if a
- * payment has fully failed is race-y. Because multiple failures can happen prior to events
- * being processed, you may retry in response to a first failure, with a second failure
- * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
- * you will see `all_paths_failed` set even though the retry of the first failure still
- * has an associated in-flight HTLC. See (1) for an example of such a failure.
- *
- * If you wish to retry individual MPP parts and learn when a payment has failed, you must
- * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
- *
- * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
- *
- * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
- */
- public final boolean all_paths_failed;
+ public final org.ldk.structs.PathFailure failure;
/**
* The payment path that failed.
*/
*/
public final org.ldk.structs.Option_u64Z short_channel_id;
/**
- * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
- *
- * See [`find_route`] for details.
+ * Parameters used by LDK to compute a new [`Route`] when retrying the failed payment path.
*
* [`Route`]: crate::routing::router::Route
- * [`find_route`]: crate::routing::router::find_route
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
super(null, ptr);
this.payment_id = obj.payment_id;
this.payment_hash = obj.payment_hash;
- this.rejected_by_dest = obj.rejected_by_dest;
- long network_update = obj.network_update;
- org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update);
- network_update_hu_conv.ptrs_to.add(this);
- this.network_update = network_update_hu_conv;
- this.all_paths_failed = obj.all_paths_failed;
+ this.payment_failed_permanently = obj.payment_failed_permanently;
+ long failure = obj.failure;
+ org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure);
+ if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.add(this); };
+ this.failure = failure_hu_conv;
long[] path = obj.path;
int path_conv_10_len = path.length;
RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
for (int k = 0; k < path_conv_10_len; k++) {
long path_conv_10 = path[k];
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); }
- path_conv_10_hu_conv.ptrs_to.add(this);
+ if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
path_conv_10_arr[k] = path_conv_10_hu_conv;
}
this.path = path_conv_10_arr;
long short_channel_id = obj.short_channel_id;
org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
- short_channel_id_hu_conv.ptrs_to.add(this);
+ if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
this.short_channel_id = short_channel_id_hu_conv;
long retry = obj.retry;
org.ldk.structs.RouteParameters retry_hu_conv = null; if (retry < 0 || retry > 4096) { retry_hu_conv = new org.ldk.structs.RouteParameters(null, retry); }
- retry_hu_conv.ptrs_to.add(this);
+ if (retry_hu_conv != null) { retry_hu_conv.ptrs_to.add(this); };
this.retry = retry_hu_conv;
}
}
for (int k = 0; k < path_conv_10_len; k++) {
long path_conv_10 = path[k];
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); }
- path_conv_10_hu_conv.ptrs_to.add(this);
+ if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
path_conv_10_arr[k] = path_conv_10_hu_conv;
}
this.path = path_conv_10_arr;
for (int k = 0; k < path_conv_10_len; k++) {
long path_conv_10 = path[k];
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); }
- path_conv_10_hu_conv.ptrs_to.add(this);
+ if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); };
path_conv_10_arr[k] = path_conv_10_hu_conv;
}
this.path = path_conv_10_arr;
long short_channel_id = obj.short_channel_id;
org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
- short_channel_id_hu_conv.ptrs_to.add(this);
+ if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
this.short_channel_id = short_channel_id_hu_conv;
}
}
this.time_forwardable = obj.time_forwardable;
}
}
+ /**
+ * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
+ * you've encoded an intercept scid in the receiver's invoice route hints using
+ * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
+ *
+ * [`ChannelManager::forward_intercepted_htlc`] or
+ * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
+ * their docs for more information.
+ *
+ * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
+ * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
+ * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
+ * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
+ */
+ public final static class HTLCIntercepted extends Event {
+ /**
+ * An id to help LDK identify which HTLC is being forwarded or failed.
+ */
+ public final byte[] intercept_id;
+ /**
+ * The fake scid that was programmed as the next hop's scid, generated using
+ * [`ChannelManager::get_intercept_scid`].
+ *
+ * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
+ */
+ public final long requested_next_hop_scid;
+ /**
+ * The payment hash used for this HTLC.
+ */
+ public final byte[] payment_hash;
+ /**
+ * How many msats were received on the inbound edge of this HTLC.
+ */
+ public final long inbound_amount_msat;
+ /**
+ * How many msats the payer intended to route to the next node. Depending on the reason you are
+ * intercepting this payment, you might take a fee by forwarding less than this amount.
+ *
+ * Note that LDK will NOT check that expected fees were factored into this value. You MUST
+ * check that whatever fee you want has been included here or subtract it as required. Further,
+ * LDK will not stop you from forwarding more than you received.
+ */
+ public final long expected_outbound_amount_msat;
+ private HTLCIntercepted(long ptr, bindings.LDKEvent.HTLCIntercepted obj) {
+ super(null, ptr);
+ this.intercept_id = obj.intercept_id;
+ this.requested_next_hop_scid = obj.requested_next_hop_scid;
+ this.payment_hash = obj.payment_hash;
+ this.inbound_amount_msat = obj.inbound_amount_msat;
+ this.expected_outbound_amount_msat = obj.expected_outbound_amount_msat;
+ }
+ }
/**
* Used to indicate that an output which you should know how to spend was confirmed on chain
* and is now spendable.
for (int b = 0; b < outputs_conv_27_len; b++) {
long outputs_conv_27 = outputs[b];
org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
- outputs_conv_27_hu_conv.ptrs_to.add(this);
+ if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
}
this.outputs = outputs_conv_27_arr;
this.next_channel_id = obj.next_channel_id;
long fee_earned_msat = obj.fee_earned_msat;
org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
- fee_earned_msat_hu_conv.ptrs_to.add(this);
+ if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
this.fee_earned_msat = fee_earned_msat_hu_conv;
this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
}
}
+ /**
+ * Used to indicate that a channel with the given `channel_id` is ready to
+ * be used. This event is emitted either when the funding transaction has been confirmed
+ * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
+ * establishment.
+ */
+ public final static class ChannelReady extends Event {
+ /**
+ * The channel_id of the channel that is ready.
+ */
+ public final byte[] channel_id;
+ /**
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for an inbound channel.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ public final org.ldk.util.UInt128 user_channel_id;
+ /**
+ * The node_id of the channel counterparty.
+ */
+ public final byte[] counterparty_node_id;
+ /**
+ * The features that this channel will operate with.
+ */
+ public final org.ldk.structs.ChannelTypeFeatures channel_type;
+ private ChannelReady(long ptr, bindings.LDKEvent.ChannelReady obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ byte[] user_channel_id = obj.user_channel_id;
+ org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
+ this.user_channel_id = user_channel_id_conv;
+ this.counterparty_node_id = obj.counterparty_node_id;
+ long channel_type = obj.channel_type;
+ 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); }
+ if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
+ this.channel_type = channel_type_hu_conv;
+ }
+ }
/**
* Used to indicate that a previously opened channel with the given `channel_id` is in the
* process of closure.
* The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
* channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
* [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
- * `user_channel_id` will be 0 for an inbound channel.
- * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
+ * `user_channel_id` will be randomized for inbound channels.
+ * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
+ * zero for objects serialized with LDK versions prior to 0.0.102.
*
* [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
* [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
* [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
*/
- public final long user_channel_id;
+ public final org.ldk.util.UInt128 user_channel_id;
/**
* The reason the channel was closed.
*/
private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
super(null, ptr);
this.channel_id = obj.channel_id;
- this.user_channel_id = obj.user_channel_id;
+ byte[] user_channel_id = obj.user_channel_id;
+ org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
+ this.user_channel_id = user_channel_id_conv;
long reason = obj.reason;
org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
- reason_hu_conv.ptrs_to.add(this);
+ if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
this.reason = reason_hu_conv;
}
}
this.push_msat = obj.push_msat;
long channel_type = obj.channel_type;
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); }
- channel_type_hu_conv.ptrs_to.add(this);
+ if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
this.channel_type = channel_type_hu_conv;
}
}
this.prev_channel_id = obj.prev_channel_id;
long failed_next_destination = obj.failed_next_destination;
org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
- failed_next_destination_hu_conv.ptrs_to.add(this);
+ if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
this.failed_next_destination = failed_next_destination_hu_conv;
}
}
Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(this);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
return ret_hu_conv;
}
/**
* Utility method to constructs a new FundingGenerationReady-variant Event
*/
- 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) {
- 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);
+ 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) {
+ 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());
Reference.reachabilityFence(temporary_channel_id);
Reference.reachabilityFence(counterparty_node_id);
Reference.reachabilityFence(channel_value_satoshis);
Reference.reachabilityFence(user_channel_id);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
return ret_hu_conv;
}
/**
- * Utility method to constructs a new PaymentReceived-variant Event
+ * Utility method to constructs a new PaymentClaimable-variant Event
*/
- public static Event payment_received(byte[] payment_hash, long amount_msat, PaymentPurpose purpose) {
- long ret = bindings.Event_payment_received(InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
+ public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id) {
+ long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr);
+ Reference.reachabilityFence(receiver_node_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(amount_msat);
Reference.reachabilityFence(purpose);
+ Reference.reachabilityFence(via_channel_id);
+ Reference.reachabilityFence(via_user_channel_id);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_user_channel_id); };
return ret_hu_conv;
}
/**
* Utility method to constructs a new PaymentClaimed-variant Event
*/
- public static Event payment_claimed(byte[] payment_hash, long amount_msat, PaymentPurpose purpose) {
- long ret = bindings.Event_payment_claimed(InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
+ public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose) {
+ 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);
+ Reference.reachabilityFence(receiver_node_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(amount_msat);
Reference.reachabilityFence(purpose);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
return ret_hu_conv;
}
/**
* Utility method to constructs a new PaymentSent-variant Event
*/
- public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, Option_u64Z fee_paid_msat) {
+ public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
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);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_preimage);
Reference.reachabilityFence(fee_paid_msat);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); };
return ret_hu_conv;
}
Reference.reachabilityFence(payment_hash);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
return ret_hu_conv;
}
* Utility method to constructs a new PaymentPathSuccessful-variant Event
*/
public static Event payment_path_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
- 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 & ~1).toArray() : null);
+ 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);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(path);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
return ret_hu_conv;
}
/**
* Utility method to constructs a new PaymentPathFailed-variant Event
*/
- public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id, RouteParameters retry) {
- long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr & ~1);
+ public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.PathFailure failure, RouteHop[] path, org.ldk.structs.Option_u64Z short_channel_id, org.ldk.structs.RouteParameters retry) {
+ long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path != null ? 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);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_hash);
- Reference.reachabilityFence(rejected_by_dest);
- Reference.reachabilityFence(network_update);
- Reference.reachabilityFence(all_paths_failed);
+ Reference.reachabilityFence(payment_failed_permanently);
+ Reference.reachabilityFence(failure);
Reference.reachabilityFence(path);
Reference.reachabilityFence(short_channel_id);
Reference.reachabilityFence(retry);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
+ for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry); };
return ret_hu_conv;
}
* Utility method to constructs a new ProbeSuccessful-variant Event
*/
public static Event probe_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
- 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 & ~1).toArray() : null);
+ 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);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(path);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
return ret_hu_conv;
}
/**
* Utility method to constructs a new ProbeFailed-variant Event
*/
- public static Event probe_failed(byte[] payment_id, byte[] payment_hash, RouteHop[] path, Option_u64Z short_channel_id) {
- 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 & ~1).toArray() : null, short_channel_id.ptr);
+ public static Event probe_failed(byte[] payment_id, byte[] payment_hash, RouteHop[] path, org.ldk.structs.Option_u64Z short_channel_id) {
+ 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);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(path);
Reference.reachabilityFence(short_channel_id);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
return ret_hu_conv;
}
Reference.reachabilityFence(time_forwardable);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new HTLCIntercepted-variant Event
+ */
+ public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
+ 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);
+ Reference.reachabilityFence(intercept_id);
+ Reference.reachabilityFence(requested_next_hop_scid);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(inbound_amount_msat);
+ Reference.reachabilityFence(expected_outbound_amount_msat);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
return ret_hu_conv;
}
Reference.reachabilityFence(outputs);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; };
return ret_hu_conv;
}
/**
* Utility method to constructs a new PaymentForwarded-variant Event
*/
- public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) {
+ public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) {
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);
Reference.reachabilityFence(prev_channel_id);
Reference.reachabilityFence(next_channel_id);
Reference.reachabilityFence(claim_from_onchain_tx);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_earned_msat); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelReady-variant Event
+ */
+ 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) {
+ 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);
+ Reference.reachabilityFence(channel_id);
+ Reference.reachabilityFence(user_channel_id);
+ Reference.reachabilityFence(counterparty_node_id);
+ Reference.reachabilityFence(channel_type);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
return ret_hu_conv;
}
/**
* Utility method to constructs a new ChannelClosed-variant Event
*/
- public static Event channel_closed(byte[] channel_id, long user_channel_id, ClosureReason reason) {
- long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id, reason.ptr);
+ public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason) {
+ long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr);
Reference.reachabilityFence(channel_id);
Reference.reachabilityFence(user_channel_id);
Reference.reachabilityFence(reason);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
return ret_hu_conv;
}
Reference.reachabilityFence(transaction);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
return ret_hu_conv;
}
/**
* Utility method to constructs a new OpenChannelRequest-variant Event
*/
- public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, ChannelTypeFeatures channel_type) {
- 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 & ~1);
+ 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) {
+ 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);
Reference.reachabilityFence(temporary_channel_id);
Reference.reachabilityFence(counterparty_node_id);
Reference.reachabilityFence(funding_satoshis);
Reference.reachabilityFence(channel_type);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
return ret_hu_conv;
}
/**
* Utility method to constructs a new HTLCHandlingFailed-variant Event
*/
- public static Event htlchandling_failed(byte[] prev_channel_id, HTLCDestination failed_next_destination) {
+ public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
Reference.reachabilityFence(prev_channel_id);
Reference.reachabilityFence(failed_next_destination);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); };
return ret_hu_conv;
}
+ /**
+ * Checks if two Events contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+ public boolean eq(org.ldk.structs.Event b) {
+ boolean ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(b);
+ return ret;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (!(o instanceof Event)) return false;
+ return this.eq((Event)o);
+ }
/**
* Serialize the Event object into a byte array which can be read by Event_read
*/