+ /**
+ * This event is generated when a payment has been successfully forwarded through us and a
+ * forwarding fee earned.
+ */
+ public final static class PaymentForwarded extends Event {
+ /**
+ * The fee, in milli-satoshis, which was earned as a result of the payment.
+ *
+ * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
+ * was pending, the amount the next hop claimed will have been rounded down to the nearest
+ * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
+ * claimed the full value in millisatoshis from the source. In this case,
+ * `claim_from_onchain_tx` will be set.
+ *
+ * If the channel which sent us the payment has been force-closed, we will claim the funds
+ * via an on-chain transaction. In that case we do not yet know the on-chain transaction
+ * fees which we will spend and will instead set this to `None`. It is possible duplicate
+ * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
+ * `None`.
+ */
+ public final Option_u64Z fee_earned_msat;
+ /**
+ * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
+ * transaction.
+ */
+ public final boolean claim_from_onchain_tx;
+ private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
+ super(null, ptr);
+ long fee_earned_msat = obj.fee_earned_msat;
+ Option_u64Z fee_earned_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_earned_msat);
+ 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 in the process of closure.
+ */
+ public final static class ChannelClosed extends Event {
+ /**
+ * The channel_id of the channel which has been closed. Note that on-chain transactions
+ * resolving the channel are likely still awaiting confirmation.
+ */
+ public final byte[] channel_id;
+ /**
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
+ * an inbound channel. This will always be zero for objects serialized with LDK versions
+ * prior to 0.0.102.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ */
+ public final long user_channel_id;
+ /**
+ * The reason the channel was closed.
+ */
+ public final ClosureReason reason;
+ 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;
+ long reason = obj.reason;
+ ClosureReason reason_hu_conv = ClosureReason.constr_from_ptr(reason);
+ reason_hu_conv.ptrs_to.add(this);
+ this.reason = reason_hu_conv;
+ }
+ }
+ /**
+ * Used to indicate to the user that they can abandon the funding transaction and recycle the
+ * inputs for another purpose.
+ */
+ public final static class DiscardFunding extends Event {
+ /**
+ * The channel_id of the channel which has been closed.
+ */
+ public final byte[] channel_id;
+ /**
+ * The full transaction received from the user
+ */
+ public final byte[] transaction;
+ private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ this.transaction = obj.transaction;
+ }
+ }
+ /**
+ * Indicates that a path for an outbound payment was successful.
+ *
+ * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
+ * [`Event::PaymentSent`] for obtaining the payment preimage.
+ */
+ public final static class PaymentPathSuccessful extends Event {
+ /**
+ * The id returned by [`ChannelManager::send_payment`] and used with
+ * [`ChannelManager::retry_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
+ */
+ public final byte[] payment_id;
+ /**
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ @Nullable public final byte[] payment_hash;
+ /**
+ * The payment path that was successful.
+ *
+ * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
+ */
+ public final RouteHop[] path;
+ private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
+ super(null, ptr);
+ this.payment_id = obj.payment_id;
+ this.payment_hash = obj.payment_hash;
+ 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];
+ RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new RouteHop(null, path_conv_10); }
+ 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 clone_ptr() {
+ long ret = bindings.Event_clone_ptr(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+