if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
}
+ if (raw_val.getClass() == bindings.LDKEvent.BumpTransaction.class) {
+ return new BumpTransaction(ptr, (bindings.LDKEvent.BumpTransaction)raw_val);
+ }
assert false; return null; // Unreachable without extending the (internal) bindings interface
}
* 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
+ * [phantom nodes]: crate::sign::PhantomKeysManager
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
*/
@Nullable public final org.ldk.structs.RecipientOnionFields onion_fields;
/**
- * The value, in thousandths of a satoshi, that this payment is for.
+ * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
+ * than the invoice amount.
+ *
+ * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
+ * and the previous hop took an extra fee.
+ *
+ * # Note
+ * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
+ * field, you may lose money!
+ *
+ * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
*/
public final long amount_msat;
+ /**
+ * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
+ * taken by our channel counterparty.
+ *
+ * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
+ *
+ * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
+ */
+ public final long counterparty_skimmed_fee_msat;
/**
* Information for claiming this received payment, based on whether the purpose of the
* payment is to pay an invoice or to send a spontaneous payment.
if (onion_fields_hu_conv != null) { onion_fields_hu_conv.ptrs_to.add(this); };
this.onion_fields = onion_fields_hu_conv;
this.amount_msat = obj.amount_msat;
+ this.counterparty_skimmed_fee_msat = obj.counterparty_skimmed_fee_msat;
long purpose = obj.purpose;
org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
* 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
+ * [phantom nodes]: crate::sign::PhantomKeysManager
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
*/
public final byte[] payment_hash;
/**
- * The value, in thousandths of a satoshi, that this payment is for.
+ * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
+ * invoice amount.
*/
public final long amount_msat;
/**
* The `payment_id` passed 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_id;
+ public final org.ldk.structs.Option_PaymentIdZ payment_id;
/**
* The preimage to the hash given to ChannelManager::send_payment.
* Note that this serves as a payment receipt, if you wish to have such a thing, you must
public final org.ldk.structs.Option_u64Z fee_paid_msat;
private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
super(null, ptr);
- this.payment_id = obj.payment_id;
+ long payment_id = obj.payment_id;
+ org.ldk.structs.Option_PaymentIdZ payment_id_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(payment_id);
+ if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
+ this.payment_id = payment_id_hu_conv;
this.payment_preimage = obj.payment_preimage;
this.payment_hash = obj.payment_hash;
long fee_paid_msat = obj.fee_paid_msat;
/**
* The hash that was given to [`ChannelManager::send_payment`].
*
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
*
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- @Nullable public final byte[] payment_hash;
+ public final org.ldk.structs.Option_PaymentHashZ payment_hash;
/**
* The payment path that was successful.
*
private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
super(null, ptr);
this.payment_id = obj.payment_id;
- this.payment_hash = obj.payment_hash;
+ long payment_hash = obj.payment_hash;
+ org.ldk.structs.Option_PaymentHashZ payment_hash_hu_conv = org.ldk.structs.Option_PaymentHashZ.constr_from_ptr(payment_hash);
+ if (payment_hash_hu_conv != null) { payment_hash_hu_conv.ptrs_to.add(this); };
+ this.payment_hash = payment_hash_hu_conv;
long path = obj.path;
org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
/**
* The `payment_id` passed to [`ChannelManager::send_payment`].
*
+ * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
+ *
* [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_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
*/
- @Nullable public final byte[] payment_id;
+ public final org.ldk.structs.Option_PaymentIdZ payment_id;
/**
* The hash that was given to [`ChannelManager::send_payment`].
*
public final org.ldk.structs.Option_u64Z short_channel_id;
private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
super(null, ptr);
- this.payment_id = obj.payment_id;
+ long payment_id = obj.payment_id;
+ org.ldk.structs.Option_PaymentIdZ payment_id_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(payment_id);
+ if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
+ this.payment_id = payment_id_hu_conv;
this.payment_hash = obj.payment_hash;
this.payment_failed_permanently = obj.payment_failed_permanently;
long failure = obj.failure;
/**
* 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.
+ * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
*
* 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,
this.failed_next_destination = failed_next_destination_hu_conv;
}
}
+ /**
+ * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
+ * requires confirmed external funds to be readily available to spend.
+ *
+ * LDK does not currently generate this event unless the
+ * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
+ * It is limited to the scope of channels with anchor outputs.
+ *
+ * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
+ */
+ public final static class BumpTransaction extends Event {
+ public final org.ldk.structs.BumpTransactionEvent bump_transaction;
+ private BumpTransaction(long ptr, bindings.LDKEvent.BumpTransaction obj) {
+ super(null, ptr);
+ long bump_transaction = obj.bump_transaction;
+ org.ldk.structs.BumpTransactionEvent bump_transaction_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(bump_transaction);
+ if (bump_transaction_hu_conv != null) { bump_transaction_hu_conv.ptrs_to.add(this); };
+ this.bump_transaction = bump_transaction_hu_conv;
+ }
+ }
long clone_ptr() {
long ret = bindings.Event_clone_ptr(this.ptr);
Reference.reachabilityFence(this);
/**
* Utility method to constructs a new PaymentClaimable-variant Event
*/
- public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
- long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr, claim_deadline.ptr);
+ public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
+ long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr, claim_deadline.ptr);
Reference.reachabilityFence(receiver_node_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(onion_fields);
Reference.reachabilityFence(amount_msat);
+ Reference.reachabilityFence(counterparty_skimmed_fee_msat);
Reference.reachabilityFence(purpose);
Reference.reachabilityFence(via_channel_id);
Reference.reachabilityFence(via_user_channel_id);
/**
* Utility method to constructs a new PaymentSent-variant Event
*/
- 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);
+ public static Event payment_sent(org.ldk.structs.Option_PaymentIdZ payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
+ long ret = bindings.Event_payment_sent(payment_id.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_preimage);
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);
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(payment_id); };
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); };
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, org.ldk.structs.Path path) {
- long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr);
+ public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_PaymentHashZ payment_hash, org.ldk.structs.Path path) {
+ long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), payment_hash.ptr, path == null ? 0 : path.ptr);
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);
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(payment_hash); };
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
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 payment_failed_permanently, org.ldk.structs.PathFailure failure, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
- 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 ? 0 : path.ptr, short_channel_id.ptr);
+ public static Event payment_path_failed(org.ldk.structs.Option_PaymentIdZ payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.PathFailure failure, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
+ long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path == null ? 0 : path.ptr, short_channel_id.ptr);
Reference.reachabilityFence(payment_id);
Reference.reachabilityFence(payment_hash);
Reference.reachabilityFence(payment_failed_permanently);
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(payment_id); };
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
return ret_hu_conv;
}
+ /**
+ * Utility method to constructs a new BumpTransaction-variant Event
+ */
+ public static Event bump_transaction(org.ldk.structs.BumpTransactionEvent a) {
+ long ret = bindings.Event_bump_transaction(a.ptr);
+ Reference.reachabilityFence(a);
+ 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(a); };
+ 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.