From: Matt Corallo Date: Wed, 27 Jul 2022 17:16:16 +0000 (+0000) Subject: [Java] Update auto-generated Java bindings to LDK 0.0.110 X-Git-Tag: v0.0.110.0^2~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=8f5edad2f310a130b658e1b530fe2516724c4d99;p=ldk-java [Java] Update auto-generated Java bindings to LDK 0.0.110 --- diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 0dbe5b71..db55dbe3 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -310,6 +310,42 @@ public class bindings { public static native long CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_COption_ClosureReasonZDecodeErrorZ_get_err(long owner); + public static class LDKHTLCDestination { + private LDKHTLCDestination() {} + public final static class NextHopChannel extends LDKHTLCDestination { + public byte[] node_id; + public byte[] channel_id; + NextHopChannel(byte[] node_id, byte[] channel_id) { this.node_id = node_id; this.channel_id = channel_id; } + } + public final static class UnknownNextHop extends LDKHTLCDestination { + public long requested_forward_scid; + UnknownNextHop(long requested_forward_scid) { this.requested_forward_scid = requested_forward_scid; } + } + public final static class FailedPayment extends LDKHTLCDestination { + public byte[] payment_hash; + FailedPayment(byte[] payment_hash) { this.payment_hash = payment_hash; } + } + static native void init(); + } + static { LDKHTLCDestination.init(); } + public static native LDKHTLCDestination LDKHTLCDestination_ref_from_ptr(long ptr); + public static class LDKCOption_HTLCDestinationZ { + private LDKCOption_HTLCDestinationZ() {} + public final static class Some extends LDKCOption_HTLCDestinationZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_HTLCDestinationZ { + None() { } + } + static native void init(); + } + static { LDKCOption_HTLCDestinationZ.init(); } + public static native LDKCOption_HTLCDestinationZ LDKCOption_HTLCDestinationZ_ref_from_ptr(long ptr); + // struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(long owner); public static class LDKNetworkUpdate { private LDKNetworkUpdate() {} public final static class ChannelUpdateMessage extends LDKNetworkUpdate { @@ -413,6 +449,19 @@ public class bindings { public long retry; PaymentPathFailed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path, long short_channel_id, long retry) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; this.short_channel_id = short_channel_id; this.retry = retry; } } + public final static class ProbeSuccessful extends LDKEvent { + public byte[] payment_id; + public byte[] payment_hash; + public long[] path; + ProbeSuccessful(byte[] payment_id, byte[] payment_hash, long[] path) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.path = path; } + } + public final static class ProbeFailed extends LDKEvent { + public byte[] payment_id; + public byte[] payment_hash; + public long[] path; + public long short_channel_id; + ProbeFailed(byte[] payment_id, byte[] payment_hash, long[] path, long short_channel_id) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.path = path; this.short_channel_id = short_channel_id; } + } public final static class PendingHTLCsForwardable extends LDKEvent { public long time_forwardable; PendingHTLCsForwardable(long time_forwardable) { this.time_forwardable = time_forwardable; } @@ -447,6 +496,11 @@ public class bindings { public long channel_type; OpenChannelRequest(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, long channel_type) { this.temporary_channel_id = temporary_channel_id; this.counterparty_node_id = counterparty_node_id; this.funding_satoshis = funding_satoshis; this.push_msat = push_msat; this.channel_type = channel_type; } } + public final static class HTLCHandlingFailed extends LDKEvent { + public byte[] prev_channel_id; + public long failed_next_destination; + HTLCHandlingFailed(byte[] prev_channel_id, long failed_next_destination) { this.prev_channel_id = prev_channel_id; this.failed_next_destination = failed_next_destination; } + } static native void init(); } static { LDKEvent.init(); } @@ -636,10 +690,12 @@ public class bindings { } static { LDKMonitorEvent.init(); } public static native LDKMonitorEvent LDKMonitorEvent_ref_from_ptr(long ptr); - // struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner); - public static native long C2Tuple_OutPointCVec_MonitorEventZZ_get_a(long owner); - // struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner); - public static native long[] C2Tuple_OutPointCVec_MonitorEventZZ_get_b(long owner); + // struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner); + public static native long C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(long owner); + // struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner); + public static native long[] C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(long owner); + // struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner); + public static native byte[] C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(long owner); public static class LDKCOption_C2Tuple_usizeTransactionZZ { private LDKCOption_C2Tuple_usizeTransactionZZ() {} public final static class Some extends LDKCOption_C2Tuple_usizeTransactionZZ { @@ -778,6 +834,11 @@ public class bindings { public short port; OnionV3(byte[] ed25519_pubkey, short checksum, byte version, short port) { this.ed25519_pubkey = ed25519_pubkey; this.checksum = checksum; this.version = version; this.port = port; } } + public final static class Hostname extends LDKNetAddress { + public long hostname; + public short port; + Hostname(long hostname, short port) { this.hostname = hostname; this.port = port; } + } static native void init(); } static { LDKNetAddress.init(); } @@ -1067,7 +1128,7 @@ public class bindings { public static native long Watch_watch_channel(long this_arg, long funding_txo, long monitor); // LDKCResult_NoneChannelMonitorUpdateErrZ Watch_update_channel LDKWatch *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update public static native long Watch_update_channel(long this_arg, long funding_txo, long update); - // LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Watch_release_pending_monitor_events LDKWatch *NONNULL_PTR this_arg + // LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Watch_release_pending_monitor_events LDKWatch *NONNULL_PTR this_arg public static native long[] Watch_release_pending_monitor_events(long this_arg); public interface LDKBroadcasterInterface { void broadcast_transaction(byte[] tx); @@ -1622,6 +1683,8 @@ public class bindings { long channel_penalty_msat(long short_channel_id, long source, long target, long usage); void payment_path_failed(long[] path, long short_channel_id); void payment_path_successful(long[] path); + void probe_failed(long[] path, long short_channel_id); + void probe_successful(long[] path); byte[] write(); } public static native long LDKScore_new(LDKScore impl); @@ -1631,6 +1694,10 @@ public class bindings { public static native void Score_payment_path_failed(long this_arg, long[] path, long short_channel_id); // void Score_payment_path_successful LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path public static native void Score_payment_path_successful(long this_arg, long[] path); + // void Score_probe_failed LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id + public static native void Score_probe_failed(long this_arg, long[] path, long short_channel_id); + // void Score_probe_successful LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path + public static native void Score_probe_successful(long this_arg, long[] path); // LDKCVec_u8Z Score_write LDKScore *NONNULL_PTR this_arg public static native byte[] Score_write(long this_arg); public interface LDKPersister { @@ -2228,6 +2295,8 @@ public class bindings { public static native long COption_u64Z_clone_ptr(long arg); // struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); public static native long COption_u64Z_clone(long orig); + // void CVec_u64Z_free(struct LDKCVec_u64Z _res); + public static native void CVec_u64Z_free(long[] _res); // struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); public static native long CResult_PaymentParametersDecodeErrorZ_ok(long o); // struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); @@ -2316,6 +2385,28 @@ public class bindings { public static native long CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_COption_ClosureReasonZDecodeErrorZ_clone(long orig); + // struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); + public static native long COption_HTLCDestinationZ_some(long o); + // struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); + public static native long COption_HTLCDestinationZ_none(); + // void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); + public static native void COption_HTLCDestinationZ_free(long _res); + // uintptr_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg); + public static native long COption_HTLCDestinationZ_clone_ptr(long arg); + // struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); + public static native long COption_HTLCDestinationZ_clone(long orig); + // struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); + public static native long CResult_COption_HTLCDestinationZDecodeErrorZ_ok(long o); + // struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_COption_HTLCDestinationZDecodeErrorZ_err(long e); + // bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(long o); + // void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); + public static native void CResult_COption_HTLCDestinationZDecodeErrorZ_free(long _res); + // uintptr_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_COption_HTLCDestinationZDecodeErrorZ_clone(long orig); // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); public static native long COption_NetworkUpdateZ_some(long o); // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); @@ -2390,16 +2481,16 @@ public class bindings { public static native long CResult_NoneChannelMonitorUpdateErrZ_clone(long orig); // void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); public static native void CVec_MonitorEventZ_free(long[] _res); - // uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg); - public static native long C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(long arg); - // struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR orig); - public static native long C2Tuple_OutPointCVec_MonitorEventZZ_clone(long orig); - // struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b); - public static native long C2Tuple_OutPointCVec_MonitorEventZZ_new(long a, long[] b); - // void C2Tuple_OutPointCVec_MonitorEventZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorEventZZ _res); - public static native void C2Tuple_OutPointCVec_MonitorEventZZ_free(long _res); - // void CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res); - public static native void CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(long[] _res); + // uintptr_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg); + public static native long C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(long arg); + // struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); + public static native long C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(long orig); + // struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c); + public static native long C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(long a, long[] b, byte[] c); + // void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res); + public static native void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(long _res); + // void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res); + public static native void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(long[] _res); // struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o); public static native long COption_C2Tuple_usizeTransactionZZ_some(long o); // struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void); @@ -2638,8 +2729,6 @@ public class bindings { public static native long CResult_NodeAliasDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_NodeAliasDecodeErrorZ_clone(long orig); - // void CVec_u64Z_free(struct LDKCVec_u64Z _res); - public static native void CVec_u64Z_free(long[] _res); // struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); public static native long CResult_NodeInfoDecodeErrorZ_ok(long o); // struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); @@ -3926,6 +4015,22 @@ public class bindings { public static native byte[] ClosureReason_write(long obj); // struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); public static native long ClosureReason_read(byte[] ser); + // void HTLCDestination_free(struct LDKHTLCDestination this_ptr); + public static native void HTLCDestination_free(long this_ptr); + // uintptr_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg); + public static native long HTLCDestination_clone_ptr(long arg); + // struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); + public static native long HTLCDestination_clone(long orig); + // struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id); + public static native long HTLCDestination_next_hop_channel(byte[] node_id, byte[] channel_id); + // struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); + public static native long HTLCDestination_unknown_next_hop(long requested_forward_scid); + // struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); + public static native long HTLCDestination_failed_payment(byte[] payment_hash); + // struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj); + public static native byte[] HTLCDestination_write(long obj); + // struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser); + public static native long HTLCDestination_read(byte[] ser); // void Event_free(struct LDKEvent this_ptr); public static native void Event_free(long this_ptr); // uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg); @@ -3946,6 +4051,10 @@ public class bindings { public static native long Event_payment_path_successful(byte[] payment_id, byte[] payment_hash, long[] path); // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); public static native long Event_payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path, long short_channel_id, long retry); + // struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); + public static native long Event_probe_successful(byte[] payment_id, byte[] payment_hash, long[] path); + // struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id); + public static native long Event_probe_failed(byte[] payment_id, byte[] payment_hash, long[] path, long short_channel_id); // struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); public static native long Event_pending_htlcs_forwardable(long time_forwardable); // struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); @@ -3958,6 +4067,8 @@ public class bindings { public static native long Event_discard_funding(byte[] channel_id, byte[] transaction); // struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type); public static native long Event_open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, long channel_type); + // struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination); + public static native long Event_htlchandling_failed(byte[] prev_channel_id, long failed_next_destination); // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); public static native byte[] Event_write(long obj); // struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); @@ -4040,6 +4151,14 @@ public class bindings { public static native void BigSize_set_a(long this_ptr, long val); // MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); public static native long BigSize_new(long a_arg); + // void Hostname_free(struct LDKHostname this_obj); + public static native void Hostname_free(long this_obj); + // uintptr_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg); + public static native long Hostname_clone_ptr(long arg); + // struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); + public static native long Hostname_clone(long orig); + // MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); + public static native byte Hostname_len(long this_arg); // struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); public static native long sign(byte[] msg, byte[] sk); // struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); @@ -4426,7 +4545,7 @@ public class bindings { public static native long ChannelMonitor_clone(long orig); // struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); public static native byte[] ChannelMonitor_write(long obj); - // MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); + // MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); public static native long ChannelMonitor_update_monitor(long this_arg, long updates, long broadcaster, long fee_estimator, long logger); // MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); public static native long ChannelMonitor_get_latest_update_id(long this_arg); @@ -4440,6 +4559,8 @@ public class bindings { public static native long[] ChannelMonitor_get_and_clear_pending_monitor_events(long this_arg); // MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); public static native long[] ChannelMonitor_get_and_clear_pending_events(long this_arg); + // MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + public static native byte[] ChannelMonitor_get_counterparty_node_id(long this_arg); // MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); public static native byte[][] ChannelMonitor_get_latest_holder_commitment_txn(long this_arg, long logger); // MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); @@ -4898,6 +5019,8 @@ public class bindings { public static native void ChannelManager_abandon_payment(long this_arg, byte[] payment_id); // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); public static native long ChannelManager_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage); + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops); + public static native long ChannelManager_send_probe(long this_arg, long[] hops); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); public static native long ChannelManager_funding_transaction_generated(long this_arg, byte[] temporary_channel_id, byte[] counterparty_node_id, byte[] funding_transaction); // void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); @@ -5554,6 +5677,8 @@ public class bindings { public static native long NetAddress_onion_v2(byte[] a); // struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); public static native long NetAddress_onion_v3(byte[] ed25519_pubkey, short checksum, byte version, short port); + // struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port); + public static native long NetAddress_hostname(long hostname, short port); // struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); public static native byte[] NetAddress_write(long obj); // struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); @@ -5690,6 +5815,10 @@ public class bindings { public static native long UnsignedChannelUpdate_get_htlc_minimum_msat(long this_ptr); // void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); public static native void UnsignedChannelUpdate_set_htlc_minimum_msat(long this_ptr, long val); + // uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); + public static native long UnsignedChannelUpdate_get_htlc_maximum_msat(long this_ptr); + // void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); + public static native void UnsignedChannelUpdate_set_htlc_maximum_msat(long this_ptr, long val); // uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); public static native int UnsignedChannelUpdate_get_fee_base_msat(long this_ptr); // void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); @@ -5700,6 +5829,8 @@ public class bindings { public static native void UnsignedChannelUpdate_set_fee_proportional_millionths(long this_ptr, int val); // void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); public static native void UnsignedChannelUpdate_set_excess_data(long this_ptr, byte[] val); + // MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg); + public static native long UnsignedChannelUpdate_new(byte[] chain_hash_arg, long short_channel_id_arg, int timestamp_arg, byte flags_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, int fee_base_msat_arg, int fee_proportional_millionths_arg, byte[] excess_data_arg); // uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg); public static native long UnsignedChannelUpdate_clone_ptr(long arg); // struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); @@ -6876,9 +7007,9 @@ public class bindings { public static native long ChannelUpdateInfo_get_htlc_minimum_msat(long this_ptr); // void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); public static native void ChannelUpdateInfo_set_htlc_minimum_msat(long this_ptr, long val); - // struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + // uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); public static native long ChannelUpdateInfo_get_htlc_maximum_msat(long this_ptr); - // void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + // void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); public static native void ChannelUpdateInfo_set_htlc_maximum_msat(long this_ptr, long val); // struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); public static native long ChannelUpdateInfo_get_fees(long this_ptr); @@ -6888,7 +7019,7 @@ public class bindings { public static native long ChannelUpdateInfo_get_last_update_message(long this_ptr); // void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); public static native void ChannelUpdateInfo_set_last_update_message(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); + // MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); public static native long ChannelUpdateInfo_new(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, long fees_arg, long last_update_message_arg); // uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg); public static native long ChannelUpdateInfo_clone_ptr(long arg); @@ -7100,6 +7231,10 @@ public class bindings { public static native long NetworkGraph_update_channel(long this_arg, long msg); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); public static native long NetworkGraph_update_channel_unsigned(long this_arg, long msg); + // MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); + public static native long ReadOnlyNetworkGraph_channel(long this_arg, long short_channel_id); + // MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + public static native long ReadOnlyNetworkGraph_node(long this_arg, long node_id); // MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); public static native long ReadOnlyNetworkGraph_get_addresses(long this_arg, byte[] pubkey); // void RouteHop_free(struct LDKRouteHop this_obj); @@ -7216,12 +7351,18 @@ public class bindings { public static native int PaymentParameters_get_max_total_cltv_expiry_delta(long this_ptr); // void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); public static native void PaymentParameters_set_max_total_cltv_expiry_delta(long this_ptr, int val); - // uint8_t PaymentParameters_get_max_mpp_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); - public static native byte PaymentParameters_get_max_mpp_path_count(long this_ptr); - // void PaymentParameters_set_max_mpp_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); - public static native void PaymentParameters_set_max_mpp_path_count(long this_ptr, byte val); - // MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_mpp_path_count_arg); - public static native long PaymentParameters_new(byte[] payee_pubkey_arg, long features_arg, long[] route_hints_arg, long expiry_time_arg, int max_total_cltv_expiry_delta_arg, byte max_mpp_path_count_arg); + // uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native byte PaymentParameters_get_max_path_count(long this_ptr); + // void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); + public static native void PaymentParameters_set_max_path_count(long this_ptr, byte val); + // uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native byte PaymentParameters_get_max_channel_saturation_power_of_half(long this_ptr); + // void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); + public static native void PaymentParameters_set_max_channel_saturation_power_of_half(long this_ptr, byte val); + // void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); + public static native void PaymentParameters_set_previously_failed_channels(long this_ptr, long[] val); + // MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg); + public static native long PaymentParameters_new(byte[] payee_pubkey_arg, long features_arg, long[] route_hints_arg, long expiry_time_arg, int max_total_cltv_expiry_delta_arg, byte max_path_count_arg, byte max_channel_saturation_power_of_half_arg, long[] previously_failed_channels_arg); // uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg); public static native long PaymentParameters_clone_ptr(long arg); // struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); @@ -7354,6 +7495,10 @@ public class bindings { public static native long ProbabilisticScoringParameters_get_base_penalty_msat(long this_ptr); // void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void ProbabilisticScoringParameters_set_base_penalty_msat(long this_ptr, long val); + // uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(long this_ptr); + // void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(long this_ptr, long val); // uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); public static native long ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(long this_ptr); // void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); @@ -7362,14 +7507,18 @@ public class bindings { public static native long ProbabilisticScoringParameters_get_liquidity_offset_half_life(long this_ptr); // void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void ProbabilisticScoringParameters_set_liquidity_offset_half_life(long this_ptr, long val); - // uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); - public static native long ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(long this_ptr); - // void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); - public static native void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(long this_ptr, long val); + // uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(long this_ptr); + // void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(long this_ptr, long val); // uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); public static native long ProbabilisticScoringParameters_get_anti_probing_penalty_msat(long this_ptr); // void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(long this_ptr, long val); + // uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(long this_ptr); + // void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(long this_ptr, long val); // uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg); public static native long ProbabilisticScoringParameters_clone_ptr(long arg); // struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig); @@ -7384,8 +7533,12 @@ public class bindings { public static native void ProbabilisticScorer_add_banned(long this_arg, long node_id); // void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); public static native void ProbabilisticScorer_remove_banned(long this_arg, long node_id); - // void ProbabilisticScorer_clear_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg); - public static native void ProbabilisticScorer_clear_banned(long this_arg); + // void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); + public static native void ProbabilisticScorer_set_manual_penalty(long this_arg, long node_id, long penalty); + // void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + public static native void ProbabilisticScorer_remove_manual_penalty(long this_arg, long node_id); + // void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + public static native void ProbabilisticScorer_clear_manual_penalties(long this_arg); // void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); public static native void ProbabilisticScoringParameters_add_banned_from_list(long this_arg, long[] node_ids); // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void); diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index a44a43a3..33ea282e 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -426,6 +426,20 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Send a payment that is probing the given route for liquidity. We calculate the + * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows + * us to easily discern them from real payments. + */ + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_probe(RouteHop[] hops) { + long ret = bindings.ChannelManager_send_probe(this.ptr, hops != null ? Arrays.stream(hops).mapToLong(hops_conv_10 -> hops_conv_10 == null ? 0 : hops_conv_10.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(hops); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Call this upon creation of a funding transaction for the given channel. * @@ -485,7 +499,7 @@ public class ChannelManager extends CommonBase { * tying these addresses together and to this node. If you wish to preserve user privacy, * addresses should likely contain only Tor Onion addresses. * - * Panics if `addresses` is absurdly large (more than 500). + * Panics if `addresses` is absurdly large (more than 100). * * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java index ceb03172..532cf9ed 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitor.java +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -176,6 +176,21 @@ public class ChannelMonitor extends CommonBase { return ret_conv_7_arr; } + /** + * Gets the `node_id` of the counterparty for this channel. + * + * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some` + * otherwise. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public byte[] get_counterparty_node_id() { + byte[] ret = bindings.ChannelMonitor_get_counterparty_node_id(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of diff --git a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java index 04890882..d9994795 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java +++ b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java @@ -97,20 +97,17 @@ public class ChannelUpdateInfo extends CommonBase { /** * The maximum value which may be relayed to the next hop via the channel. */ - public Option_u64Z get_htlc_maximum_msat() { + public long get_htlc_maximum_msat() { long ret = bindings.ChannelUpdateInfo_get_htlc_maximum_msat(this.ptr); Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; + return ret; } /** * The maximum value which may be relayed to the next hop via the channel. */ - public void set_htlc_maximum_msat(Option_u64Z val) { - bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val.ptr); + public void set_htlc_maximum_msat(long val) { + bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val); Reference.reachabilityFence(this); Reference.reachabilityFence(val); } @@ -171,8 +168,8 @@ public class ChannelUpdateInfo extends CommonBase { /** * Constructs a new ChannelUpdateInfo given each field */ - public static ChannelUpdateInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) { - long ret = bindings.ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg.ptr, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1); + public static ChannelUpdateInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) { + long ret = bindings.ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1); Reference.reachabilityFence(last_update_arg); Reference.reachabilityFence(enabled_arg); Reference.reachabilityFence(cltv_expiry_delta_arg); diff --git a/src/main/java/org/ldk/structs/Event.java b/src/main/java/org/ldk/structs/Event.java index edcaea73..7327c2a3 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -46,6 +46,12 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) { return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) { + return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val); + } + if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) { + return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val); + } if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) { return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val); } @@ -64,6 +70,9 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) { return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) { + return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -449,6 +458,90 @@ public class Event extends CommonBase { this.retry = retry_hu_conv; } } + /** + * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. + */ + public final static class ProbeSuccessful extends Event { + /** + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + public final byte[] payment_id; + /** + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + public final byte[] payment_hash; + /** + * The payment path that was successful. + */ + public final RouteHop[] path; + private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful 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]; + 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); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + this.path = path_conv_10_arr; + } + } + /** + * Indicates that a probe payment we sent failed at an intermediary node on the path. + */ + public final static class ProbeFailed extends Event { + /** + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + public final byte[] payment_id; + /** + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + public final byte[] payment_hash; + /** + * The payment path that failed. + */ + public final RouteHop[] path; + /** + * The channel responsible for the failed probe. + * + * Note that for route hints or for the first hop in a path this may be an SCID alias and + * may not refer to a channel in the public network graph. These aliases may also collide + * with channels in the public network graph. + */ + public final org.ldk.structs.Option_u64Z short_channel_id; + private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed 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]; + 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); + 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); + this.short_channel_id = short_channel_id_hu_conv; + } + } /** * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at * a time in the future. @@ -675,6 +768,38 @@ public class Event extends CommonBase { this.channel_type = channel_type_hu_conv; } } + /** + * Indicates that the HTLC was accepted, but could not be processed when or after attempting to + * forward it. + * + * Some scenarios where this event may be sent include: + * Insufficient capacity in the outbound channel + * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes + * When an unknown SCID is requested for forwarding a payment. + * Claiming an amount for an MPP payment that exceeds the HTLC total + * The HTLC has timed out + * + * This event, however, does not get generated if an HTLC fails to meet the forwarding + * requirements (i.e. insufficient fees paid, or a CLTV that is too soon). + */ + public final static class HTLCHandlingFailed extends Event { + /** + * The channel over which the HTLC was received. + */ + public final byte[] prev_channel_id; + /** + * Destination of the HTLC that failed to be processed. + */ + public final org.ldk.structs.HTLCDestination failed_next_destination; + private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) { + super(null, ptr); + 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); + this.failed_next_destination = failed_next_destination_hu_conv; + } + } long clone_ptr() { long ret = bindings.Event_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -798,6 +923,35 @@ public class Event extends CommonBase { 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); + 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); + 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); + 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); + return ret_hu_conv; + } + /** * Utility method to constructs a new PendingHTLCsForwardable-variant Event */ @@ -880,6 +1034,19 @@ public class Event extends CommonBase { 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) { + 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); + return ret_hu_conv; + } + /** * Serialize the Event object into a byte array which can be read by Event_read */ diff --git a/src/main/java/org/ldk/structs/FeeEstimator.java b/src/main/java/org/ldk/structs/FeeEstimator.java index e8e14de5..1dea94b1 100644 --- a/src/main/java/org/ldk/structs/FeeEstimator.java +++ b/src/main/java/org/ldk/structs/FeeEstimator.java @@ -32,12 +32,12 @@ public class FeeEstimator extends CommonBase { /** * Gets estimated satoshis of fee required per 1000 Weight-Units. * - * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later - * round-downs don't put us below 1 satoshi-per-byte). + * LDK will wrap this method and ensure that the value returned is no smaller than 253 + * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte). * - * This method can be implemented with the following unit conversions: - * max(satoshis-per-byte * 250, 253) - * max(satoshis-per-kbyte / 4, 253) + * The following unit conversions can be used to convert to sats/KW: + * satoshis-per-byte * 250 + * satoshis-per-kbyte / 4 */ int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target); } @@ -56,12 +56,12 @@ public class FeeEstimator extends CommonBase { /** * Gets estimated satoshis of fee required per 1000 Weight-Units. * - * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later - * round-downs don't put us below 1 satoshi-per-byte). + * LDK will wrap this method and ensure that the value returned is no smaller than 253 + * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte). * - * This method can be implemented with the following unit conversions: - * max(satoshis-per-byte * 250, 253) - * max(satoshis-per-kbyte / 4, 253) + * The following unit conversions can be used to convert to sats/KW: + * satoshis-per-byte * 250 + * satoshis-per-kbyte / 4 */ public int get_est_sat_per_1000_weight(org.ldk.enums.ConfirmationTarget confirmation_target) { int ret = bindings.FeeEstimator_get_est_sat_per_1000_weight(this.ptr, confirmation_target); diff --git a/src/main/java/org/ldk/structs/HTLCDestination.java b/src/main/java/org/ldk/structs/HTLCDestination.java new file mode 100644 index 00000000..a5c58c1d --- /dev/null +++ b/src/main/java/org/ldk/structs/HTLCDestination.java @@ -0,0 +1,155 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class HTLCDestination extends CommonBase { + private HTLCDestination(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.HTLCDestination_free(ptr); } + } + static HTLCDestination constr_from_ptr(long ptr) { + bindings.LDKHTLCDestination raw_val = bindings.LDKHTLCDestination_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKHTLCDestination.NextHopChannel.class) { + return new NextHopChannel(ptr, (bindings.LDKHTLCDestination.NextHopChannel)raw_val); + } + if (raw_val.getClass() == bindings.LDKHTLCDestination.UnknownNextHop.class) { + return new UnknownNextHop(ptr, (bindings.LDKHTLCDestination.UnknownNextHop)raw_val); + } + if (raw_val.getClass() == bindings.LDKHTLCDestination.FailedPayment.class) { + return new FailedPayment(ptr, (bindings.LDKHTLCDestination.FailedPayment)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * We tried forwarding to a channel but failed to do so. An example of such an instance is when + * there is insufficient capacity in our outbound channel. + */ + public final static class NextHopChannel extends HTLCDestination { + /** + * The `node_id` of the next node. For backwards compatibility, this field is + * marked as optional, versions prior to 0.0.110 may not always be able to provide + * counterparty node information. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public final byte[] node_id; + /** + * The outgoing `channel_id` between us and the next node. + */ + public final byte[] channel_id; + private NextHopChannel(long ptr, bindings.LDKHTLCDestination.NextHopChannel obj) { + super(null, ptr); + this.node_id = obj.node_id; + this.channel_id = obj.channel_id; + } + } + /** + * Scenario where we are unsure of the next node to forward the HTLC to. + */ + public final static class UnknownNextHop extends HTLCDestination { + /** + * Short channel id we are requesting to forward an HTLC to. + */ + public final long requested_forward_scid; + private UnknownNextHop(long ptr, bindings.LDKHTLCDestination.UnknownNextHop obj) { + super(null, ptr); + this.requested_forward_scid = obj.requested_forward_scid; + } + } + /** + * Failure scenario where an HTLC may have been forwarded to be intended for us, + * but is invalid for some reason, so we reject it. + * + * Some of the reasons may include: + * HTLC Timeouts + * Expected MPP amount to claim does not equal HTLC total + * Claimable amount does not match expected amount + */ + public final static class FailedPayment extends HTLCDestination { + /** + * The payment hash of the payment we attempted to process. + */ + public final byte[] payment_hash; + private FailedPayment(long ptr, bindings.LDKHTLCDestination.FailedPayment obj) { + super(null, ptr); + this.payment_hash = obj.payment_hash; + } + } + long clone_ptr() { + long ret = bindings.HTLCDestination_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the HTLCDestination + */ + public HTLCDestination clone() { + long ret = bindings.HTLCDestination_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.HTLCDestination ret_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new NextHopChannel-variant HTLCDestination + */ + public static HTLCDestination next_hop_channel(byte[] node_id, byte[] channel_id) { + long ret = bindings.HTLCDestination_next_hop_channel(InternalUtils.check_arr_len(node_id, 33), InternalUtils.check_arr_len(channel_id, 32)); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(channel_id); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.HTLCDestination ret_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new UnknownNextHop-variant HTLCDestination + */ + public static HTLCDestination unknown_next_hop(long requested_forward_scid) { + long ret = bindings.HTLCDestination_unknown_next_hop(requested_forward_scid); + Reference.reachabilityFence(requested_forward_scid); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.HTLCDestination ret_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new FailedPayment-variant HTLCDestination + */ + public static HTLCDestination failed_payment(byte[] payment_hash) { + long ret = bindings.HTLCDestination_failed_payment(InternalUtils.check_arr_len(payment_hash, 32)); + Reference.reachabilityFence(payment_hash); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.HTLCDestination ret_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read + */ + public byte[] write() { + byte[] ret = bindings.HTLCDestination_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/Hostname.java b/src/main/java/org/ldk/structs/Hostname.java new file mode 100644 index 00000000..27c661c4 --- /dev/null +++ b/src/main/java/org/ldk/structs/Hostname.java @@ -0,0 +1,54 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * Represents a hostname for serialization purposes. + * Only the character set and length will be validated. + * The character set consists of ASCII alphanumeric characters, hyphens, and periods. + * Its length is guaranteed to be representable by a single byte. + * This serialization is used by BOLT 7 hostnames. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Hostname extends CommonBase { + Hostname(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.Hostname_free(ptr); } + } + + long clone_ptr() { + long ret = bindings.Hostname_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the Hostname + */ + public Hostname clone() { + long ret = bindings.Hostname_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Hostname ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Hostname(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Returns the length of the hostname. + */ + public byte len() { + byte ret = bindings.Hostname_len(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/NetAddress.java b/src/main/java/org/ldk/structs/NetAddress.java index 73f5bc32..2813321d 100644 --- a/src/main/java/org/ldk/structs/NetAddress.java +++ b/src/main/java/org/ldk/structs/NetAddress.java @@ -33,6 +33,9 @@ public class NetAddress extends CommonBase { if (raw_val.getClass() == bindings.LDKNetAddress.OnionV3.class) { return new OnionV3(ptr, (bindings.LDKNetAddress.OnionV3)raw_val); } + if (raw_val.getClass() == bindings.LDKNetAddress.Hostname.class) { + return new Hostname(ptr, (bindings.LDKNetAddress.Hostname)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -115,6 +118,27 @@ public class NetAddress extends CommonBase { this.port = obj.port; } } + /** + * A hostname/port on which the peer is listening. + */ + public final static class Hostname extends NetAddress { + /** + * The hostname on which the node is listening. + */ + public final org.ldk.structs.Hostname hostname; + /** + * The port on which the node is listening. + */ + public final short port; + private Hostname(long ptr, bindings.LDKNetAddress.Hostname obj) { + super(null, ptr); + long hostname = obj.hostname; + org.ldk.structs.Hostname hostname_hu_conv = null; if (hostname < 0 || hostname > 4096) { hostname_hu_conv = new org.ldk.structs.Hostname(null, hostname); } + hostname_hu_conv.ptrs_to.add(this); + this.hostname = hostname_hu_conv; + this.port = obj.port; + } + } long clone_ptr() { long ret = bindings.NetAddress_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -186,6 +210,19 @@ public class NetAddress extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new Hostname-variant NetAddress + */ + public static NetAddress hostname(Hostname hostname, short port) { + long ret = bindings.NetAddress_hostname(hostname == null ? 0 : hostname.ptr & ~1, port); + Reference.reachabilityFence(hostname); + Reference.reachabilityFence(port); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NetAddress ret_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + /** * Serialize the NetAddress object into a byte array which can be read by NetAddress_read */ diff --git a/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java b/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java new file mode 100644 index 00000000..68aaca31 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java @@ -0,0 +1,96 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_HTLCDestinationZ extends CommonBase { + private Option_HTLCDestinationZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_HTLCDestinationZ_free(ptr); } + } + static Option_HTLCDestinationZ constr_from_ptr(long ptr) { + bindings.LDKCOption_HTLCDestinationZ raw_val = bindings.LDKCOption_HTLCDestinationZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_HTLCDestinationZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_HTLCDestinationZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_HTLCDestinationZ.None.class) { + return new None(ptr, (bindings.LDKCOption_HTLCDestinationZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination + */ + public final static class Some extends Option_HTLCDestinationZ { + public final org.ldk.structs.HTLCDestination some; + private Some(long ptr, bindings.LDKCOption_HTLCDestinationZ.Some obj) { + super(null, ptr); + long some = obj.some; + org.ldk.structs.HTLCDestination some_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(some); + some_hu_conv.ptrs_to.add(this); + this.some = some_hu_conv; + } + } + /** + * When we're in this state, this COption_HTLCDestinationZ contains nothing + */ + public final static class None extends Option_HTLCDestinationZ { + private None(long ptr, bindings.LDKCOption_HTLCDestinationZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination + */ + public static Option_HTLCDestinationZ some(HTLCDestination o) { + long ret = bindings.COption_HTLCDestinationZ_some(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Constructs a new COption_HTLCDestinationZ containing nothing + */ + public static Option_HTLCDestinationZ none() { + long ret = bindings.COption_HTLCDestinationZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_HTLCDestinationZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_HTLCDestinationZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_HTLCDestinationZ clone() { + long ret = bindings.COption_HTLCDestinationZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/PaymentParameters.java b/src/main/java/org/ldk/structs/PaymentParameters.java index 6060d53a..8e3efc9d 100644 --- a/src/main/java/org/ldk/structs/PaymentParameters.java +++ b/src/main/java/org/ldk/structs/PaymentParameters.java @@ -142,21 +142,74 @@ public class PaymentParameters extends CommonBase { } /** - * The maximum number of paths that may be used by MPP payments. - * Defaults to [`DEFAULT_MAX_MPP_PATH_COUNT`]. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ - public byte get_max_mpp_path_count() { - byte ret = bindings.PaymentParameters_get_max_mpp_path_count(this.ptr); + public byte get_max_path_count() { + byte ret = bindings.PaymentParameters_get_max_path_count(this.ptr); Reference.reachabilityFence(this); return ret; } /** - * The maximum number of paths that may be used by MPP payments. - * Defaults to [`DEFAULT_MAX_MPP_PATH_COUNT`]. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ - public void set_max_mpp_path_count(byte val) { - bindings.PaymentParameters_set_max_mpp_path_count(this.ptr, val); + public void set_max_path_count(byte val) { + bindings.PaymentParameters_set_max_path_count(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 + */ + public byte get_max_channel_saturation_power_of_half() { + byte ret = bindings.PaymentParameters_get_max_channel_saturation_power_of_half(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 + */ + public void set_max_channel_saturation_power_of_half(byte val) { + bindings.PaymentParameters_set_max_channel_saturation_power_of_half(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. + */ + public void set_previously_failed_channels(long[] val) { + bindings.PaymentParameters_set_previously_failed_channels(this.ptr, val); Reference.reachabilityFence(this); Reference.reachabilityFence(val); } @@ -164,14 +217,16 @@ public class PaymentParameters extends CommonBase { /** * Constructs a new PaymentParameters given each field */ - public static PaymentParameters of(byte[] payee_pubkey_arg, InvoiceFeatures features_arg, RouteHint[] route_hints_arg, Option_u64Z expiry_time_arg, int max_total_cltv_expiry_delta_arg, byte max_mpp_path_count_arg) { - long ret = bindings.PaymentParameters_new(InternalUtils.check_arr_len(payee_pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, route_hints_arg != null ? Arrays.stream(route_hints_arg).mapToLong(route_hints_arg_conv_11 -> route_hints_arg_conv_11 == null ? 0 : route_hints_arg_conv_11.ptr & ~1).toArray() : null, expiry_time_arg.ptr, max_total_cltv_expiry_delta_arg, max_mpp_path_count_arg); + public static PaymentParameters of(byte[] payee_pubkey_arg, InvoiceFeatures features_arg, RouteHint[] route_hints_arg, Option_u64Z expiry_time_arg, int max_total_cltv_expiry_delta_arg, byte max_path_count_arg, byte max_channel_saturation_power_of_half_arg, long[] previously_failed_channels_arg) { + long ret = bindings.PaymentParameters_new(InternalUtils.check_arr_len(payee_pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, route_hints_arg != null ? Arrays.stream(route_hints_arg).mapToLong(route_hints_arg_conv_11 -> route_hints_arg_conv_11 == null ? 0 : route_hints_arg_conv_11.ptr & ~1).toArray() : null, expiry_time_arg.ptr, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg); Reference.reachabilityFence(payee_pubkey_arg); Reference.reachabilityFence(features_arg); Reference.reachabilityFence(route_hints_arg); Reference.reachabilityFence(expiry_time_arg); Reference.reachabilityFence(max_total_cltv_expiry_delta_arg); - Reference.reachabilityFence(max_mpp_path_count_arg); + Reference.reachabilityFence(max_path_count_arg); + Reference.reachabilityFence(max_channel_saturation_power_of_half_arg); + Reference.reachabilityFence(previously_failed_channels_arg); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/PeerManager.java b/src/main/java/org/ldk/structs/PeerManager.java index 4fad6787..4bd90f7e 100644 --- a/src/main/java/org/ldk/structs/PeerManager.java +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -82,8 +82,7 @@ public class PeerManager extends CommonBase { * peer using the init message. * The user should pass the remote network address of the host they are connected to. * - * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new - * descriptor but must disconnect the connection immediately. + * If an `Err` is returned here you must disconnect the connection immediately. * * Returns a small number of bytes to send to the remote node (currently always 50). * @@ -113,9 +112,8 @@ public class PeerManager extends CommonBase { * The user should pass the remote network address of the host they are connected to. * * May refuse the connection by returning an Err, but will never write bytes to the remote end - * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT - * call socket_disconnected for the new descriptor but must disconnect the connection - * immediately. + * (outbound connector always speaks first). If an `Err` is returned here you must disconnect + * the connection immediately. * * Panics if descriptor is duplicative with some other descriptor which has not yet been * [`socket_disconnected()`]. diff --git a/src/main/java/org/ldk/structs/ProbabilisticScorer.java b/src/main/java/org/ldk/structs/ProbabilisticScorer.java index 36bc4f59..1bedb70d 100644 --- a/src/main/java/org/ldk/structs/ProbabilisticScorer.java +++ b/src/main/java/org/ldk/structs/ProbabilisticScorer.java @@ -107,10 +107,31 @@ public class ProbabilisticScorer extends CommonBase { } /** - * Clears the list of nodes that are avoided during path finding. + * Sets a manual penalty for the given node. */ - public void clear_banned() { - bindings.ProbabilisticScorer_clear_banned(this.ptr); + public void set_manual_penalty(NodeId node_id, long penalty) { + bindings.ProbabilisticScorer_set_manual_penalty(this.ptr, node_id == null ? 0 : node_id.ptr & ~1, penalty); + Reference.reachabilityFence(this); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(penalty); + this.ptrs_to.add(node_id); + } + + /** + * Removes the node with the given `node_id` from the list of manual penalties. + */ + public void remove_manual_penalty(NodeId node_id) { + bindings.ProbabilisticScorer_remove_manual_penalty(this.ptr, node_id == null ? 0 : node_id.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(node_id); + this.ptrs_to.add(node_id); + } + + /** + * Clears the list of manual penalties that are applied during path finding. + */ + public void clear_manual_penalties() { + bindings.ProbabilisticScorer_clear_manual_penalties(this.ptr); Reference.reachabilityFence(this); } diff --git a/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java b/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java index 2cd68139..6f3889d2 100644 --- a/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java +++ b/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java @@ -13,6 +13,9 @@ import javax.annotation.Nullable; * * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel). + * + * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the + * parameters here. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ProbabilisticScoringParameters extends CommonBase { @@ -45,6 +48,46 @@ public class ProbabilisticScoringParameters extends CommonBase { Reference.reachabilityFence(val); } + /** + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the payment amount. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat + */ + public long get_base_penalty_amount_multiplier_msat() { + long ret = bindings.ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the payment amount. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat + */ + public void set_base_penalty_amount_multiplier_msat(long val) { + bindings.ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * A multiplier used in conjunction with the negative `log10` of the channel's success * probability for a payment to determine the liquidity penalty. @@ -138,7 +181,7 @@ public class ProbabilisticScoringParameters extends CommonBase { * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the * success probability. * - * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of * the amount will result in a penalty of the multiplier. And, as the success probability @@ -148,8 +191,8 @@ public class ProbabilisticScoringParameters extends CommonBase { * * Default value: 256 msat */ - public long get_amount_penalty_multiplier_msat() { - long ret = bindings.ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(this.ptr); + public long get_liquidity_penalty_amount_multiplier_msat() { + long ret = bindings.ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(this.ptr); Reference.reachabilityFence(this); return ret; } @@ -163,7 +206,7 @@ public class ProbabilisticScoringParameters extends CommonBase { * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the * success probability. * - * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of * the amount will result in a penalty of the multiplier. And, as the success probability @@ -173,8 +216,8 @@ public class ProbabilisticScoringParameters extends CommonBase { * * Default value: 256 msat */ - public void set_amount_penalty_multiplier_msat(long val) { - bindings.ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(this.ptr, val); + public void set_liquidity_penalty_amount_multiplier_msat(long val) { + bindings.ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(this.ptr, val); Reference.reachabilityFence(this); Reference.reachabilityFence(val); } @@ -207,6 +250,56 @@ public class ProbabilisticScoringParameters extends CommonBase { Reference.reachabilityFence(val); } + /** + * This penalty is applied when the amount we're attempting to send over a channel exceeds our + * current estimate of the channel's available liquidity. + * + * Note that in this case all other penalties, including the + * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + */ + public long get_considered_impossible_penalty_msat() { + long ret = bindings.ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * This penalty is applied when the amount we're attempting to send over a channel exceeds our + * current estimate of the channel's available liquidity. + * + * Note that in this case all other penalties, including the + * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + */ + public void set_considered_impossible_penalty_msat(long val) { + bindings.ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + long clone_ptr() { long ret = bindings.ProbabilisticScoringParameters_clone_ptr(this.ptr); Reference.reachabilityFence(this); diff --git a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java index 1d82f25b..058daad0 100644 --- a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java +++ b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java @@ -18,6 +18,39 @@ public class ReadOnlyNetworkGraph extends CommonBase implements AutoCloseable { if (ptr != 0) { bindings.ReadOnlyNetworkGraph_free(ptr); } } + /** + * Returns information on a channel with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelInfo channel(long short_channel_id) { + long ret = bindings.ReadOnlyNetworkGraph_channel(this.ptr, short_channel_id); + Reference.reachabilityFence(this); + Reference.reachabilityFence(short_channel_id); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Returns information on a node with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public NodeInfo node(NodeId node_id) { + long ret = bindings.ReadOnlyNetworkGraph_node(this.ptr, node_id == null ? 0 : node_id.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(node_id); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); } + ret_hu_conv.ptrs_to.add(this); + this.ptrs_to.add(node_id); + return ret_hu_conv; + } + /** * Get network addresses by node id. * Returns None if the requested node is completely unknown, diff --git a/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java new file mode 100644 index 00000000..edd47868 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_COption_HTLCDestinationZDecodeErrorZ extends CommonBase { + private Result_COption_HTLCDestinationZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_COption_HTLCDestinationZDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(ptr)) { + return new Result_COption_HTLCDestinationZDecodeErrorZ_OK(null, ptr); + } else { + return new Result_COption_HTLCDestinationZDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_COption_HTLCDestinationZDecodeErrorZ_OK extends Result_COption_HTLCDestinationZDecodeErrorZ { + public final Option_HTLCDestinationZ res; + private Result_COption_HTLCDestinationZDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(ptr); + org.ldk.structs.Option_HTLCDestinationZ res_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_COption_HTLCDestinationZDecodeErrorZ_Err extends Result_COption_HTLCDestinationZDecodeErrorZ { + public final DecodeError err; + private Result_COption_HTLCDestinationZDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new org.ldk.structs.DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. + */ + public static Result_COption_HTLCDestinationZDecodeErrorZ ok(Option_HTLCDestinationZ o) { + long ret = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. + */ + public static Result_COption_HTLCDestinationZDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_COption_HTLCDestinationZDecodeErrorZ clone() { + long ret = bindings.CResult_COption_HTLCDestinationZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Score.java b/src/main/java/org/ldk/structs/Score.java index 9758decc..347edf6a 100644 --- a/src/main/java/org/ldk/structs/Score.java +++ b/src/main/java/org/ldk/structs/Score.java @@ -46,6 +46,14 @@ public class Score extends CommonBase { * Handles updating channel penalties after successfully routing along a path. */ void payment_path_successful(RouteHop[] path); + /** + * Handles updating channel penalties after a probe over the given path failed. + */ + void probe_failed(RouteHop[] path, long short_channel_id); + /** + * Handles updating channel penalties after a probe over the given path succeeded. + */ + void probe_successful(RouteHop[] path); /** * Serialize the object into a byte array */ @@ -88,6 +96,30 @@ public class Score extends CommonBase { arg.payment_path_successful(path_conv_10_arr); Reference.reachabilityFence(arg); } + @Override public void probe_failed(long[] path, long short_channel_id) { + 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); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + arg.probe_failed(path_conv_10_arr, short_channel_id); + Reference.reachabilityFence(arg); + } + @Override public void probe_successful(long[] 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); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + arg.probe_successful(path_conv_10_arr); + Reference.reachabilityFence(arg); + } @Override public byte[] write() { byte[] ret = arg.write(); Reference.reachabilityFence(arg); @@ -137,6 +169,25 @@ public class Score extends CommonBase { Reference.reachabilityFence(path); } + /** + * Handles updating channel penalties after a probe over the given path failed. + */ + public void probe_failed(RouteHop[] path, long short_channel_id) { + bindings.Score_probe_failed(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, short_channel_id); + Reference.reachabilityFence(this); + Reference.reachabilityFence(path); + Reference.reachabilityFence(short_channel_id); + } + + /** + * Handles updating channel penalties after a probe over the given path succeeded. + */ + public void probe_successful(RouteHop[] path) { + bindings.Score_probe_successful(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(path); + } + /** * Serialize the object into a byte array */ diff --git a/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java b/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java new file mode 100644 index 00000000..97635118 --- /dev/null +++ b/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * A Tuple + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ extends CommonBase { + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(ptr); } + } + + /** + * + */ + public OutPoint get_a() { + long ret = bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * + */ + public MonitorEvent[] get_b() { + long[] ret = bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_14_len = ret.length; + MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret_conv_14_len]; + for (int o = 0; o < ret_conv_14_len; o++) { + long ret_conv_14 = ret[o]; + org.ldk.structs.MonitorEvent ret_conv_14_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret_conv_14); + ret_conv_14_hu_conv.ptrs_to.add(this); + ret_conv_14_arr[o] = ret_conv_14_hu_conv; + } + return ret_conv_14_arr; + } + + /** + * + */ + public byte[] get_c() { + byte[] ret = bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ clone() { + long ret = bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ ret_hu_conv = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements. + */ + public static ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ of(OutPoint a, MonitorEvent[] b, byte[] c) { + long ret = bindings.C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a == null ? 0 : a.ptr & ~1, b != null ? Arrays.stream(b).mapToLong(b_conv_14 -> b_conv_14.ptr).toArray() : null, InternalUtils.check_arr_len(c, 33)); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + Reference.reachabilityFence(c); + if (ret >= 0 && ret <= 4096) { return null; } + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ ret_hu_conv = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/TwoTuple_OutPointCVec_MonitorEventZZ.java b/src/main/java/org/ldk/structs/TwoTuple_OutPointCVec_MonitorEventZZ.java deleted file mode 100644 index 1e3b9b29..00000000 --- a/src/main/java/org/ldk/structs/TwoTuple_OutPointCVec_MonitorEventZZ.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import java.lang.ref.Reference; -import javax.annotation.Nullable; - - -/** - * A Tuple - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class TwoTuple_OutPointCVec_MonitorEventZZ extends CommonBase { - TwoTuple_OutPointCVec_MonitorEventZZ(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.C2Tuple_OutPointCVec_MonitorEventZZ_free(ptr); } - } - - /** - * - */ - public OutPoint get_a() { - long ret = bindings.C2Tuple_OutPointCVec_MonitorEventZZ_get_a(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * - */ - public MonitorEvent[] get_b() { - long[] ret = bindings.C2Tuple_OutPointCVec_MonitorEventZZ_get_b(this.ptr); - Reference.reachabilityFence(this); - int ret_conv_14_len = ret.length; - MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret_conv_14_len]; - for (int o = 0; o < ret_conv_14_len; o++) { - long ret_conv_14 = ret[o]; - org.ldk.structs.MonitorEvent ret_conv_14_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret_conv_14); - ret_conv_14_hu_conv.ptrs_to.add(this); - ret_conv_14_arr[o] = ret_conv_14_hu_conv; - } - return ret_conv_14_arr; - } - - long clone_ptr() { - long ret = bindings.C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public TwoTuple_OutPointCVec_MonitorEventZZ clone() { - long ret = bindings.C2Tuple_OutPointCVec_MonitorEventZZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_OutPointCVec_MonitorEventZZ ret_hu_conv = new TwoTuple_OutPointCVec_MonitorEventZZ(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements. - */ - public static TwoTuple_OutPointCVec_MonitorEventZZ of(OutPoint a, MonitorEvent[] b) { - long ret = bindings.C2Tuple_OutPointCVec_MonitorEventZZ_new(a == null ? 0 : a.ptr & ~1, b != null ? Arrays.stream(b).mapToLong(b_conv_14 -> b_conv_14.ptr).toArray() : null); - Reference.reachabilityFence(a); - Reference.reachabilityFence(b); - if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_OutPointCVec_MonitorEventZZ ret_hu_conv = new TwoTuple_OutPointCVec_MonitorEventZZ(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java index 1d3f2d72..b2207391 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java @@ -142,6 +142,24 @@ public class UnsignedChannelUpdate extends CommonBase { Reference.reachabilityFence(val); } + /** + * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + */ + public long get_htlc_maximum_msat() { + long ret = bindings.UnsignedChannelUpdate_get_htlc_maximum_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + */ + public void set_htlc_maximum_msat(long val) { + bindings.UnsignedChannelUpdate_set_htlc_maximum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * The base HTLC fee charged by sender, in milli-satoshi */ @@ -189,6 +207,27 @@ public class UnsignedChannelUpdate extends CommonBase { Reference.reachabilityFence(val); } + /** + * Constructs a new UnsignedChannelUpdate given each field + */ + public static UnsignedChannelUpdate of(byte[] chain_hash_arg, long short_channel_id_arg, int timestamp_arg, byte flags_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, int fee_base_msat_arg, int fee_proportional_millionths_arg, byte[] excess_data_arg) { + long ret = bindings.UnsignedChannelUpdate_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg); + Reference.reachabilityFence(chain_hash_arg); + Reference.reachabilityFence(short_channel_id_arg); + Reference.reachabilityFence(timestamp_arg); + Reference.reachabilityFence(flags_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); + Reference.reachabilityFence(htlc_minimum_msat_arg); + Reference.reachabilityFence(htlc_maximum_msat_arg); + Reference.reachabilityFence(fee_base_msat_arg); + Reference.reachabilityFence(fee_proportional_millionths_arg); + Reference.reachabilityFence(excess_data_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + long clone_ptr() { long ret = bindings.UnsignedChannelUpdate_clone_ptr(this.ptr); Reference.reachabilityFence(this); diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index bbb6689d..575a448a 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -34,6 +34,17 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Read a HTLCDestination from a byte array, created by HTLCDestination_write + */ + public static Result_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(byte[] ser) { + long ret = bindings.HTLCDestination_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Read a Event from a byte array, created by Event_write */ diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index 1a671bc1..b5d8bf0e 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -78,7 +78,7 @@ public class Watch extends CommonBase { * For details on asynchronous [`ChannelMonitor`] updating and returning * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. */ - TwoTuple_OutPointCVec_MonitorEventZZ[] release_pending_monitor_events(); + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] release_pending_monitor_events(); } private static class LDKWatchHolder { Watch held; } public static Watch new_impl(WatchInterface arg) { @@ -105,9 +105,9 @@ public class Watch extends CommonBase { return result; } @Override public long[] release_pending_monitor_events() { - TwoTuple_OutPointCVec_MonitorEventZZ[] ret = arg.release_pending_monitor_events(); + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] ret = arg.release_pending_monitor_events(); Reference.reachabilityFence(arg); - long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_38 -> ret_conv_38 == null ? 0 : ret_conv_38.clone_ptr()).toArray() : null; + long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_49 -> ret_conv_49 == null ? 0 : ret_conv_49.clone_ptr()).toArray() : null; return result; } }); @@ -166,18 +166,18 @@ public class Watch extends CommonBase { * For details on asynchronous [`ChannelMonitor`] updating and returning * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. */ - public TwoTuple_OutPointCVec_MonitorEventZZ[] release_pending_monitor_events() { + public ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] release_pending_monitor_events() { long[] ret = bindings.Watch_release_pending_monitor_events(this.ptr); Reference.reachabilityFence(this); - int ret_conv_38_len = ret.length; - TwoTuple_OutPointCVec_MonitorEventZZ[] ret_conv_38_arr = new TwoTuple_OutPointCVec_MonitorEventZZ[ret_conv_38_len]; - for (int m = 0; m < ret_conv_38_len; m++) { - long ret_conv_38 = ret[m]; - TwoTuple_OutPointCVec_MonitorEventZZ ret_conv_38_hu_conv = new TwoTuple_OutPointCVec_MonitorEventZZ(null, ret_conv_38); - ret_conv_38_hu_conv.ptrs_to.add(this); - ret_conv_38_arr[m] = ret_conv_38_hu_conv; + int ret_conv_49_len = ret.length; + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[] ret_conv_49_arr = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ[ret_conv_49_len]; + for (int x = 0; x < ret_conv_49_len; x++) { + long ret_conv_49 = ret[x]; + ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_hu_conv = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ(null, ret_conv_49); + ret_conv_49_hu_conv.ptrs_to.add(this); + ret_conv_49_arr[x] = ret_conv_49_hu_conv; } - return ret_conv_38_arr; + return ret_conv_49_arr; } } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 116ca3f2..56c417df 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -1751,6 +1751,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from default: abort(); } } +static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) { + LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen }; + memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen); + return ret; +} static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return PaymentParameters_clone(&*owner->contents.result); @@ -2124,6 +2129,110 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureRe return ret_ref; } +static jclass LDKHTLCDestination_NextHopChannel_class = NULL; +static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL; +static jclass LDKHTLCDestination_UnknownNextHop_class = NULL; +static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL; +static jclass LDKHTLCDestination_FailedPayment_class = NULL; +static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) { + LDKHTLCDestination_NextHopChannel_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel")); + CHECK(LDKHTLCDestination_NextHopChannel_class != NULL); + LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "", "([B[B)V"); + CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL); + LDKHTLCDestination_UnknownNextHop_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop")); + CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL); + LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "", "(J)V"); + CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL); + LDKHTLCDestination_FailedPayment_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment")); + CHECK(LDKHTLCDestination_FailedPayment_class != NULL); + LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "", "([B)V"); + CHECK(LDKHTLCDestination_FailedPayment_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1); + switch(obj->tag) { + case LDKHTLCDestination_NextHopChannel: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form); + int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data); + return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr); + } + case LDKHTLCDestination_UnknownNextHop: { + int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid; + return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv); + } + case LDKHTLCDestination_FailedPayment: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data); + return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr); + } + default: abort(); + } +} +static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL; +static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL; +static jclass LDKCOption_HTLCDestinationZ_None_class = NULL; +static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) { + LDKCOption_HTLCDestinationZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some")); + CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL); + LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL); + LDKCOption_HTLCDestinationZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None")); + CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL); + LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "", "()V"); + CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_HTLCDestinationZ_Some: { + int64_t some_ref = ((uintptr_t)&obj->some) | 1; + return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref); + } + case LDKCOption_HTLCDestinationZ_None: { + return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth); + } + default: abort(); + } +} +static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_HTLCDestinationZ_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1); + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL; static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL; static jclass LDKNetworkUpdate_ChannelFailure_class = NULL; @@ -2280,6 +2389,10 @@ static jclass LDKEvent_PaymentPathSuccessful_class = NULL; static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL; static jclass LDKEvent_PaymentPathFailed_class = NULL; static jmethodID LDKEvent_PaymentPathFailed_meth = NULL; +static jclass LDKEvent_ProbeSuccessful_class = NULL; +static jmethodID LDKEvent_ProbeSuccessful_meth = NULL; +static jclass LDKEvent_ProbeFailed_class = NULL; +static jmethodID LDKEvent_ProbeFailed_meth = NULL; static jclass LDKEvent_PendingHTLCsForwardable_class = NULL; static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL; static jclass LDKEvent_SpendableOutputs_class = NULL; @@ -2292,6 +2405,8 @@ static jclass LDKEvent_DiscardFunding_class = NULL; static jmethodID LDKEvent_DiscardFunding_meth = NULL; static jclass LDKEvent_OpenChannelRequest_class = NULL; static jmethodID LDKEvent_OpenChannelRequest_meth = NULL; +static jclass LDKEvent_HTLCHandlingFailed_class = NULL; +static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady")); @@ -2328,6 +2443,16 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_PaymentPathFailed_class != NULL); LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); + LDKEvent_ProbeSuccessful_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful")); + CHECK(LDKEvent_ProbeSuccessful_class != NULL); + LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "", "([B[B[J)V"); + CHECK(LDKEvent_ProbeSuccessful_meth != NULL); + LDKEvent_ProbeFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed")); + CHECK(LDKEvent_ProbeFailed_class != NULL); + LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "", "([B[B[JJ)V"); + CHECK(LDKEvent_ProbeFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable")); CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL); @@ -2358,6 +2483,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_OpenChannelRequest_class != NULL); LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJJ)V"); CHECK(LDKEvent_OpenChannelRequest_meth != NULL); + LDKEvent_HTLCHandlingFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed")); + CHECK(LDKEvent_HTLCHandlingFailed_class != NULL); + LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "", "([BJ)V"); + CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -2459,6 +2589,49 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN } return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, rejected_by_dest_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref); } + case LDKEvent_ProbeSuccessful: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data); + LDKCVec_RouteHopZ path_var = obj->probe_successful.path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr); + } + case LDKEvent_ProbeFailed: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data); + LDKCVec_RouteHopZ path_var = obj->probe_failed.path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + int64_t short_channel_id_ref = ((uintptr_t)&obj->probe_failed.short_channel_id) | 1; + return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref); + } case LDKEvent_PendingHTLCsForwardable: { int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable; return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv); @@ -2514,6 +2687,12 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN channel_type_ref = (uintptr_t)channel_type_var.inner & ~1; return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref); } + case LDKEvent_HTLCHandlingFailed: { + int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data); + int64_t failed_next_destination_ref = ((uintptr_t)&obj->htlc_handling_failed.failed_next_destination) | 1; + return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref); + } default: abort(); } } @@ -3190,12 +3369,12 @@ static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_Monit } return ret; } -static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){ +static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){ return OutPoint_clone(&owner->a); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1); - LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_a(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1); + LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -3207,12 +3386,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1Moni return ret_ref; } -static inline struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){ +static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){ return CVec_MonitorEventZ_clone(&owner->b); } -JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1); - LDKCVec_MonitorEventZ ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_b(owner_conv); +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1); + LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv); int64_tArray ret_arr = NULL; ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); @@ -3227,10 +3406,20 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_ return ret_arr; } -static inline LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ *orig) { - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ clone bytes"), .datalen = orig->datalen }; +static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){ + return owner->c; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form); + return ret_arr; +} + +static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) { + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = C2Tuple_OutPointCVec_MonitorEventZZ_clone(&orig->data[i]); + ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]); } return ret; } @@ -4076,6 +4265,8 @@ static jclass LDKNetAddress_OnionV2_class = NULL; static jmethodID LDKNetAddress_OnionV2_meth = NULL; static jclass LDKNetAddress_OnionV3_class = NULL; static jmethodID LDKNetAddress_OnionV3_meth = NULL; +static jclass LDKNetAddress_Hostname_class = NULL; +static jmethodID LDKNetAddress_Hostname_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) { LDKNetAddress_IPv4_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4")); @@ -4097,6 +4288,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEn CHECK(LDKNetAddress_OnionV3_class != NULL); LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "([BSBS)V"); CHECK(LDKNetAddress_OnionV3_meth != NULL); + LDKNetAddress_Hostname_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname")); + CHECK(LDKNetAddress_Hostname_class != NULL); + LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "", "(JS)V"); + CHECK(LDKNetAddress_Hostname_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1); @@ -4126,6 +4322,16 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1p int16_t port_conv = obj->onion_v3.port; return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv); } + case LDKNetAddress_Hostname: { + LDKHostname hostname_var = obj->hostname.hostname; + int64_t hostname_ref = 0; + CHECK((((uintptr_t)hostname_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&hostname_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var); + hostname_ref = (uintptr_t)hostname_var.inner & ~1; + int16_t port_conv = obj->hostname.port; + return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv); + } default: abort(); } } @@ -4208,11 +4414,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErr return ret_ref; } -static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) { - LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen }; - memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen); - return ret; -} static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return NodeInfo_clone(&*owner->contents.result); @@ -6389,7 +6590,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void } return ret_conv; } -LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) { +LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -6405,20 +6606,20 @@ LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKW (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception."); } - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_constr; + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr; ret_constr.datalen = (*env)->GetArrayLength(env, ret); if (ret_constr.datalen > 0) - ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements"); + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements"); else ret_constr.data = NULL; int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); - for (size_t m = 0; m < ret_constr.datalen; m++) { - int64_t ret_conv_38 = ret_vals[m]; - void* ret_conv_38_ptr = (void*)(((uintptr_t)ret_conv_38) & ~1); - CHECK_ACCESS(ret_conv_38_ptr); - LDKC2Tuple_OutPointCVec_MonitorEventZZ ret_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(ret_conv_38_ptr); - FREE((void*)ret_conv_38); - ret_constr.data[m] = ret_conv_38_conv; + for (size_t x = 0; x < ret_constr.datalen; x++) { + int64_t ret_conv_49 = ret_vals[x]; + void* ret_conv_49_ptr = (void*)(((uintptr_t)ret_conv_49) & ~1); + CHECK_ACCESS(ret_conv_49_ptr); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr); + FREE((void*)ret_conv_49); + ret_constr.data[x] = ret_conv_49_conv; } (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); if (get_jenv_res == JNI_EDETACHED) { @@ -6500,14 +6701,14 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pendin void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr; - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg); + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg); int64_tArray ret_arr = NULL; ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); - for (size_t m = 0; m < ret_var.datalen; m++) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv_38_conv = ret_var.data[m]; - ret_arr_ptr[m] = ((int64_t)ret_conv_38_conv); + for (size_t x = 0; x < ret_var.datalen; x++) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv_49_conv = ret_var.data[x]; + ret_arr_ptr[x] = ((int64_t)ret_conv_49_conv); } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -10408,6 +10609,8 @@ typedef struct LDKScore_JCalls { jmethodID channel_penalty_msat_meth; jmethodID payment_path_failed_meth; jmethodID payment_path_successful_meth; + jmethodID probe_failed_meth; + jmethodID probe_successful_meth; jmethodID write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { @@ -10555,6 +10758,83 @@ void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ pa DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } +void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + int64_t short_channel_id_conv = short_channel_id; + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} +void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; @@ -10597,6 +10877,10 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { CHECK(calls->payment_path_failed_meth != NULL); calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V"); CHECK(calls->payment_path_successful_meth != NULL); + calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V"); + CHECK(calls->probe_failed_meth != NULL); + calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V"); + CHECK(calls->probe_successful_meth != NULL); calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B"); CHECK(calls->write_meth != NULL); @@ -10605,6 +10889,8 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, .payment_path_failed = payment_path_failed_LDKScore_jcall, .payment_path_successful = payment_path_successful_LDKScore_jcall, + .probe_failed = probe_failed_LDKScore_jcall, + .probe_successful = probe_successful_LDKScore_jcall, .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; @@ -10684,6 +10970,54 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successf (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { + void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { + void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr); +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -15889,6 +16223,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_u64Z _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t g = 0; g < _res_constr.datalen; g++) { + int64_t _res_conv_6 = _res_vals[g]; + _res_constr.data[g] = _res_conv_6; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_u64Z_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKPaymentParameters o_conv; o_conv.inner = (void*)(o & (~1)); @@ -16321,6 +16671,107 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureRe return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr); + o_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)o) & ~1)); + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_some(o_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_none(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr); + FREE((void*)_res); + COption_HTLCDestinationZ_free(_res_conv); +} + +static inline uintptr_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) { + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)arg; + int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)orig; + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr); + o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)(((uintptr_t)o) & ~1)); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(o & ~1); + jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg); + return (int64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(arg & ~1); + int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(orig & ~1); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = (void*)(((uintptr_t)o) & ~1); CHECK_ACCESS(o_ptr); @@ -16700,25 +17151,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIE CVec_MonitorEventZ_free(_res_constr); } -static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg); +static inline uintptr_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg); return ((int64_t)ret_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1); - int64_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(arg & ~1); + int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1); - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(orig & ~1); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv); return ((int64_t)ret_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) { LDKOutPoint a_conv; a_conv.inner = (void*)(a & (~1)); a_conv.is_owned = (a & 1) || (a == 0); @@ -16740,38 +17191,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1Moni b_constr.data[o] = b_conv_14_conv; } (*env)->ReleaseLongArrayElements(env, b, b_vals, 0); - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr); + LDKPublicKey c_ref; + CHECK((*env)->GetArrayLength(env, c) == 33); + (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref); return ((int64_t)ret_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr); FREE((void*)_res); - C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv); + C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorEventZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements"); + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements"); else _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t m = 0; m < _res_constr.datalen; m++) { - int64_t _res_conv_38 = _res_vals[m]; - void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1); - CHECK_ACCESS(_res_conv_38_ptr); - LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr); - FREE((void*)_res_conv_38); - _res_constr.data[m] = _res_conv_38_conv; + for (size_t x = 0; x < _res_constr.datalen; x++) { + int64_t _res_conv_49 = _res_vals[x]; + void* _res_conv_49_ptr = (void*)(((uintptr_t)_res_conv_49) & ~1); + CHECK_ACCESS(_res_conv_49_ptr); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr); + FREE((void*)_res_conv_49); + _res_constr.data[x] = _res_conv_49_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr); + CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) { @@ -17910,22 +18364,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErr return (int64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_u64Z _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t g = 0; g < _res_constr.datalen; g++) { - int64_t _res_conv_6 = _res_vals[g]; - _res_constr.data[g] = _res_conv_6; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_u64Z_free(_res_constr); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKNodeInfo o_conv; o_conv.inner = (void*)(o & (~1)); @@ -24020,6 +24458,84 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv return (int64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr); + FREE((void*)this_ptr); + HTLCDestination_free(this_ptr_conv); +} + +static inline uintptr_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) { + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)arg; + int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)orig; + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) { + LDKPublicKey node_id_ref; + CHECK((*env)->GetArrayLength(env, node_id) == 33); + (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); + LDKThirtyTwoBytes channel_id_ref; + CHECK((*env)->GetArrayLength(env, channel_id) == 32); + (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data); + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) { + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_failed_payment(payment_hash_ref); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)obj; + LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = HTLCDestination_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (int64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -24200,6 +24716,70 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path, int64_t short_channel_id) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1); + CHECK_ACCESS(short_channel_id_ptr); + LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr); + short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1)); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) { LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); *ret_copy = Event_pending_htlcs_forwardable(time_forwardable); @@ -24294,6 +24874,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1reque return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) { + LDKThirtyTwoBytes prev_channel_id_ref; + CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32); + (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data); + void* failed_next_destination_ptr = (void*)(((uintptr_t)failed_next_destination) & ~1); + CHECK_ACCESS(failed_next_destination_ptr); + LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr); + failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)failed_next_destination) & ~1)); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -24782,6 +25376,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, j return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKHostname this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + Hostname_free(this_obj_conv); +} + +static inline uintptr_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) { + LDKHostname ret_var = Hostname_clone(arg); +int64_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKHostname arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + int64_t ret_conv = Hostname_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKHostname orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKHostname ret_var = Hostname_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHostname this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int8_t ret_conv = Hostname_len(&this_arg_conv); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) { LDKu8slice msg_ref; msg_ref.datalen = (*env)->GetArrayLength(env, msg); @@ -26937,8 +27586,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1mon if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); } LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr; void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1); - if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); } - LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr; + CHECK_ACCESS(fee_estimator_ptr); + LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr); + if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv); + } void* logger_ptr = (void*)(((uintptr_t)logger) & ~1); if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; @@ -27036,6 +27689,16 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1a return ret_arr; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form); + return ret_arr; +} + JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) { LDKChannelMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -30335,6 +30998,33 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spont return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKCVec_RouteHopZ hops_constr; + hops_constr.datalen = (*env)->GetArrayLength(env, hops); + if (hops_constr.datalen > 0) + hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + hops_constr.data = NULL; + int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL); + for (size_t k = 0; k < hops_constr.datalen; k++) { + int64_t hops_conv_10 = hops_vals[k]; + LDKRouteHop hops_conv_10_conv; + hops_conv_10_conv.inner = (void*)(hops_conv_10 & (~1)); + hops_conv_10_conv.is_owned = (hops_conv_10 & 1) || (hops_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv); + hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv); + hops_constr.data[k] = hops_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -34394,6 +35084,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEn return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) { + LDKHostname hostname_conv; + hostname_conv.inner = (void*)(hostname & (~1)); + hostname_conv.is_owned = (hostname & 1) || (hostname == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv); + hostname_conv = Hostname_clone(&hostname_conv); + LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); + *ret_copy = NetAddress_hostname(hostname_conv, port); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKNetAddress* obj_conv = (LDKNetAddress*)obj; LDKCVec_u8Z ret_var = NetAddress_write(obj_conv); @@ -35213,6 +35915,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1ht UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKUnsignedChannelUpdate this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKUnsignedChannelUpdate this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val); +} + JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelUpdate this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -35259,6 +35978,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1ex UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32); + (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); + LDKCVec_u8Z excess_data_arg_ref; + excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg); + excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data); + LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) { LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg); int64_t ret_ref = 0; @@ -42338,10 +43077,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htl this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv); - int64_t ret_ref = (uintptr_t)ret_copy; - return ret_ref; + int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv); + return ret_conv; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { @@ -42349,11 +43086,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - void* val_ptr = (void*)(((uintptr_t)val) & ~1); - CHECK_ACCESS(val_ptr); - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); - ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -42419,10 +43152,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1 } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { - void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1); - CHECK_ACCESS(htlc_maximum_msat_arg_ptr); - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1)); LDKRoutingFees fees_arg_conv; fees_arg_conv.inner = (void*)(fees_arg & (~1)); fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); @@ -42433,7 +43162,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIE last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv); last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -43924,6 +44653,48 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id); + int64_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKNodeId node_id_conv; + node_id_conv.inner = (void*)(node_id & (~1)); + node_id_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv); + LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv); + int64_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) { LDKReadOnlyNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -44743,24 +45514,61 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1t PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val); } -JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1mpp_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int8_t ret_conv = PaymentParameters_get_max_mpp_path_count(&this_ptr_conv); + int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv); return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1mpp_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) { LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - PaymentParameters_set_max_mpp_path_count(&this_ptr_conv, val); + PaymentParameters_set_max_path_count(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_mpp_path_count_arg) { +JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCVec_u64Z val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); + for (size_t g = 0; g < val_constr.datalen; g++) { + int64_t val_conv_6 = val_vals[g]; + val_constr.data[g] = val_conv_6; + } + (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); + PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) { LDKPublicKey payee_pubkey_arg_ref; CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33); (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form); @@ -44790,7 +45598,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIE CHECK_ACCESS(expiry_time_arg_ptr); LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr); expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1)); - LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_mpp_path_count_arg); + LDKCVec_u64Z previously_failed_channels_arg_constr; + previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg); + if (previously_failed_channels_arg_constr.datalen > 0) + previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + previously_failed_channels_arg_constr.data = NULL; + int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL); + for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) { + int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g]; + previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6; + } + (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0); + LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -45732,6 +46552,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -45766,21 +46603,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv); + int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv); return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val); + ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -45800,6 +46637,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val); +} + static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) { LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg); int64_t ret_ref = 0; @@ -45914,12 +46768,36 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1b ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1banned(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKNodeId node_id_conv; + node_id_conv.inner = (void*)(node_id & (~1)); + node_id_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv); + ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKNodeId node_id_conv; + node_id_conv.inner = (void*)(node_id & (~1)); + node_id_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv); + ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) { LDKProbabilisticScorer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - ProbabilisticScorer_clear_banned(&this_arg_conv); + ProbabilisticScorer_clear_manual_penalties(&this_arg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) { diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 7f193453..d07c167a 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -1749,6 +1749,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from default: abort(); } } +static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) { + LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen }; + memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen); + return ret; +} static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return PaymentParameters_clone(&*owner->contents.result); @@ -2122,6 +2127,110 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureRe return ret_ref; } +static jclass LDKHTLCDestination_NextHopChannel_class = NULL; +static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL; +static jclass LDKHTLCDestination_UnknownNextHop_class = NULL; +static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL; +static jclass LDKHTLCDestination_FailedPayment_class = NULL; +static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) { + LDKHTLCDestination_NextHopChannel_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel")); + CHECK(LDKHTLCDestination_NextHopChannel_class != NULL); + LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "", "([B[B)V"); + CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL); + LDKHTLCDestination_UnknownNextHop_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop")); + CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL); + LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "", "(J)V"); + CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL); + LDKHTLCDestination_FailedPayment_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment")); + CHECK(LDKHTLCDestination_FailedPayment_class != NULL); + LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "", "([B)V"); + CHECK(LDKHTLCDestination_FailedPayment_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1); + switch(obj->tag) { + case LDKHTLCDestination_NextHopChannel: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form); + int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data); + return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr); + } + case LDKHTLCDestination_UnknownNextHop: { + int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid; + return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv); + } + case LDKHTLCDestination_FailedPayment: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data); + return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr); + } + default: abort(); + } +} +static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL; +static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL; +static jclass LDKCOption_HTLCDestinationZ_None_class = NULL; +static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) { + LDKCOption_HTLCDestinationZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some")); + CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL); + LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL); + LDKCOption_HTLCDestinationZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None")); + CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL); + LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "", "()V"); + CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_HTLCDestinationZ_Some: { + int64_t some_ref = ((uintptr_t)&obj->some) | 1; + return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref); + } + case LDKCOption_HTLCDestinationZ_None: { + return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth); + } + default: abort(); + } +} +static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_HTLCDestinationZ_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1); + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL; static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL; static jclass LDKNetworkUpdate_ChannelFailure_class = NULL; @@ -2278,6 +2387,10 @@ static jclass LDKEvent_PaymentPathSuccessful_class = NULL; static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL; static jclass LDKEvent_PaymentPathFailed_class = NULL; static jmethodID LDKEvent_PaymentPathFailed_meth = NULL; +static jclass LDKEvent_ProbeSuccessful_class = NULL; +static jmethodID LDKEvent_ProbeSuccessful_meth = NULL; +static jclass LDKEvent_ProbeFailed_class = NULL; +static jmethodID LDKEvent_ProbeFailed_meth = NULL; static jclass LDKEvent_PendingHTLCsForwardable_class = NULL; static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL; static jclass LDKEvent_SpendableOutputs_class = NULL; @@ -2290,6 +2403,8 @@ static jclass LDKEvent_DiscardFunding_class = NULL; static jmethodID LDKEvent_DiscardFunding_meth = NULL; static jclass LDKEvent_OpenChannelRequest_class = NULL; static jmethodID LDKEvent_OpenChannelRequest_meth = NULL; +static jclass LDKEvent_HTLCHandlingFailed_class = NULL; +static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady")); @@ -2326,6 +2441,16 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_PaymentPathFailed_class != NULL); LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); + LDKEvent_ProbeSuccessful_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful")); + CHECK(LDKEvent_ProbeSuccessful_class != NULL); + LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "", "([B[B[J)V"); + CHECK(LDKEvent_ProbeSuccessful_meth != NULL); + LDKEvent_ProbeFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed")); + CHECK(LDKEvent_ProbeFailed_class != NULL); + LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "", "([B[B[JJ)V"); + CHECK(LDKEvent_ProbeFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable")); CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL); @@ -2356,6 +2481,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_OpenChannelRequest_class != NULL); LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJJ)V"); CHECK(LDKEvent_OpenChannelRequest_meth != NULL); + LDKEvent_HTLCHandlingFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed")); + CHECK(LDKEvent_HTLCHandlingFailed_class != NULL); + LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "", "([BJ)V"); + CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -2457,6 +2587,49 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN } return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, rejected_by_dest_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref); } + case LDKEvent_ProbeSuccessful: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data); + LDKCVec_RouteHopZ path_var = obj->probe_successful.path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr); + } + case LDKEvent_ProbeFailed: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data); + LDKCVec_RouteHopZ path_var = obj->probe_failed.path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + int64_t short_channel_id_ref = ((uintptr_t)&obj->probe_failed.short_channel_id) | 1; + return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref); + } case LDKEvent_PendingHTLCsForwardable: { int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable; return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv); @@ -2512,6 +2685,12 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN channel_type_ref = (uintptr_t)channel_type_var.inner & ~1; return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref); } + case LDKEvent_HTLCHandlingFailed: { + int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data); + int64_t failed_next_destination_ref = ((uintptr_t)&obj->htlc_handling_failed.failed_next_destination) | 1; + return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref); + } default: abort(); } } @@ -3188,12 +3367,12 @@ static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_Monit } return ret; } -static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorEventZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){ +static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){ return OutPoint_clone(&owner->a); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1); - LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_a(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1); + LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -3205,12 +3384,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1Moni return ret_ref; } -static inline struct LDKCVec_MonitorEventZ C2Tuple_OutPointCVec_MonitorEventZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR owner){ +static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){ return CVec_MonitorEventZ_clone(&owner->b); } -JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(owner & ~1); - LDKCVec_MonitorEventZ ret_var = C2Tuple_OutPointCVec_MonitorEventZZ_get_b(owner_conv); +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1); + LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv); int64_tArray ret_arr = NULL; ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); @@ -3225,10 +3404,20 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_ return ret_arr; } -static inline LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ *orig) { - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ clone bytes"), .datalen = orig->datalen }; +static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){ + return owner->c; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(owner & ~1); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form); + return ret_arr; +} + +static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) { + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = C2Tuple_OutPointCVec_MonitorEventZZ_clone(&orig->data[i]); + ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]); } return ret; } @@ -4074,6 +4263,8 @@ static jclass LDKNetAddress_OnionV2_class = NULL; static jmethodID LDKNetAddress_OnionV2_meth = NULL; static jclass LDKNetAddress_OnionV3_class = NULL; static jmethodID LDKNetAddress_OnionV3_meth = NULL; +static jclass LDKNetAddress_Hostname_class = NULL; +static jmethodID LDKNetAddress_Hostname_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) { LDKNetAddress_IPv4_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4")); @@ -4095,6 +4286,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEn CHECK(LDKNetAddress_OnionV3_class != NULL); LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "([BSBS)V"); CHECK(LDKNetAddress_OnionV3_meth != NULL); + LDKNetAddress_Hostname_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname")); + CHECK(LDKNetAddress_Hostname_class != NULL); + LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "", "(JS)V"); + CHECK(LDKNetAddress_Hostname_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1); @@ -4124,6 +4320,16 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1p int16_t port_conv = obj->onion_v3.port; return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv); } + case LDKNetAddress_Hostname: { + LDKHostname hostname_var = obj->hostname.hostname; + int64_t hostname_ref = 0; + CHECK((((uintptr_t)hostname_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&hostname_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var); + hostname_ref = (uintptr_t)hostname_var.inner & ~1; + int16_t port_conv = obj->hostname.port; + return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv); + } default: abort(); } } @@ -4206,11 +4412,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErr return ret_ref; } -static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) { - LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen }; - memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen); - return ret; -} static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return NodeInfo_clone(&*owner->contents.result); @@ -6387,7 +6588,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void } return ret_conv; } -LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) { +LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -6403,20 +6604,20 @@ LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ release_pending_monitor_events_LDKW (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception."); } - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_constr; + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr; ret_constr.datalen = (*env)->GetArrayLength(env, ret); if (ret_constr.datalen > 0) - ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements"); + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements"); else ret_constr.data = NULL; int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); - for (size_t m = 0; m < ret_constr.datalen; m++) { - int64_t ret_conv_38 = ret_vals[m]; - void* ret_conv_38_ptr = (void*)(((uintptr_t)ret_conv_38) & ~1); - CHECK_ACCESS(ret_conv_38_ptr); - LDKC2Tuple_OutPointCVec_MonitorEventZZ ret_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(ret_conv_38_ptr); - FREE((void*)ret_conv_38); - ret_constr.data[m] = ret_conv_38_conv; + for (size_t x = 0; x < ret_constr.datalen; x++) { + int64_t ret_conv_49 = ret_vals[x]; + void* ret_conv_49_ptr = (void*)(((uintptr_t)ret_conv_49) & ~1); + CHECK_ACCESS(ret_conv_49_ptr); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr); + FREE((void*)ret_conv_49); + ret_constr.data[x] = ret_conv_49_conv; } (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); if (get_jenv_res == JNI_EDETACHED) { @@ -6498,14 +6699,14 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pendin void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr; - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg); + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg); int64_tArray ret_arr = NULL; ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); - for (size_t m = 0; m < ret_var.datalen; m++) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv_38_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv_38_conv = ret_var.data[m]; - ret_arr_ptr[m] = ((int64_t)ret_conv_38_conv); + for (size_t x = 0; x < ret_var.datalen; x++) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv_49_conv = ret_var.data[x]; + ret_arr_ptr[x] = ((int64_t)ret_conv_49_conv); } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -10406,6 +10607,8 @@ typedef struct LDKScore_JCalls { jmethodID channel_penalty_msat_meth; jmethodID payment_path_failed_meth; jmethodID payment_path_successful_meth; + jmethodID probe_failed_meth; + jmethodID probe_successful_meth; jmethodID write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { @@ -10553,6 +10756,83 @@ void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ pa DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } +void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + int64_t short_channel_id_conv = short_channel_id; + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} +void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + int64_t path_conv_10_ref = 0; + CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uintptr_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; @@ -10595,6 +10875,10 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { CHECK(calls->payment_path_failed_meth != NULL); calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V"); CHECK(calls->payment_path_successful_meth != NULL); + calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V"); + CHECK(calls->probe_failed_meth != NULL); + calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V"); + CHECK(calls->probe_successful_meth != NULL); calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B"); CHECK(calls->write_meth != NULL); @@ -10603,6 +10887,8 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, .payment_path_failed = payment_path_failed_LDKScore_jcall, .payment_path_successful = payment_path_successful_LDKScore_jcall, + .probe_failed = probe_failed_LDKScore_jcall, + .probe_successful = probe_successful_LDKScore_jcall, .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; @@ -10682,6 +10968,54 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successf (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { + void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { + void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr); +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -15887,6 +16221,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_u64Z _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t g = 0; g < _res_constr.datalen; g++) { + int64_t _res_conv_6 = _res_vals[g]; + _res_constr.data[g] = _res_conv_6; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_u64Z_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKPaymentParameters o_conv; o_conv.inner = (void*)(o & (~1)); @@ -16319,6 +16669,107 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureRe return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr); + o_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)o) & ~1)); + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_some(o_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_none(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr); + FREE((void*)_res); + COption_HTLCDestinationZ_free(_res_conv); +} + +static inline uintptr_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) { + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)arg; + int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)orig; + LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ"); + *ret_copy = COption_HTLCDestinationZ_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr); + o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)(((uintptr_t)o) & ~1)); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(o & ~1); + jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg); + return (int64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(arg & ~1); + int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(orig & ~1); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = (void*)(((uintptr_t)o) & ~1); CHECK_ACCESS(o_ptr); @@ -16698,25 +17149,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIE CVec_MonitorEventZ_free(_res_constr); } -static inline uintptr_t C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR arg) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(arg); +static inline uintptr_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg); return ((int64_t)ret_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(arg & ~1); - int64_t ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(arg & ~1); + int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_OutPointCVec_MonitorEventZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(orig & ~1); - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(orig & ~1); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv); return ((int64_t)ret_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) { LDKOutPoint a_conv; a_conv.inner = (void*)(a & (~1)); a_conv.is_owned = (a & 1) || (a == 0); @@ -16738,38 +17189,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1Moni b_constr.data[o] = b_conv_14_conv; } (*env)->ReleaseLongArrayElements(env, b, b_vals, 0); - LDKC2Tuple_OutPointCVec_MonitorEventZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKC2Tuple_OutPointCVec_MonitorEventZZ"); - *ret_conv = C2Tuple_OutPointCVec_MonitorEventZZ_new(a_conv, b_constr); + LDKPublicKey c_ref; + CHECK((*env)->GetArrayLength(env, c) == 33); + (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ"); + *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref); return ((int64_t)ret_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_ptr); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr); FREE((void*)_res); - C2Tuple_OutPointCVec_MonitorEventZZ_free(_res_conv); + C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorEventZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res_constr; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorEventZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ Elements"); + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements"); else _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t m = 0; m < _res_constr.datalen; m++) { - int64_t _res_conv_38 = _res_vals[m]; - void* _res_conv_38_ptr = (void*)(((uintptr_t)_res_conv_38) & ~1); - CHECK_ACCESS(_res_conv_38_ptr); - LDKC2Tuple_OutPointCVec_MonitorEventZZ _res_conv_38_conv = *(LDKC2Tuple_OutPointCVec_MonitorEventZZ*)(_res_conv_38_ptr); - FREE((void*)_res_conv_38); - _res_constr.data[m] = _res_conv_38_conv; + for (size_t x = 0; x < _res_constr.datalen; x++) { + int64_t _res_conv_49 = _res_vals[x]; + void* _res_conv_49_ptr = (void*)(((uintptr_t)_res_conv_49) & ~1); + CHECK_ACCESS(_res_conv_49_ptr); + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr); + FREE((void*)_res_conv_49); + _res_constr.data[x] = _res_conv_49_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res_constr); + CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) { @@ -17908,22 +18362,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErr return (int64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_u64Z _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t g = 0; g < _res_constr.datalen; g++) { - int64_t _res_conv_6 = _res_vals[g]; - _res_constr.data[g] = _res_conv_6; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_u64Z_free(_res_constr); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKNodeInfo o_conv; o_conv.inner = (void*)(o & (~1)); @@ -24018,6 +24456,84 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv return (int64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr); + FREE((void*)this_ptr); + HTLCDestination_free(this_ptr_conv); +} + +static inline uintptr_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) { + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)arg; + int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)orig; + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) { + LDKPublicKey node_id_ref; + CHECK((*env)->GetArrayLength(env, node_id) == 33); + (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); + LDKThirtyTwoBytes channel_id_ref; + CHECK((*env)->GetArrayLength(env, channel_id) == 32); + (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data); + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) { + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_failed_payment(payment_hash_ref); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)obj; + LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ"); + *ret_conv = HTLCDestination_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (int64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -24198,6 +24714,70 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path, int64_t short_channel_id) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1); + CHECK_ACCESS(short_channel_id_ptr); + LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr); + short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1)); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) { LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); *ret_copy = Event_pending_htlcs_forwardable(time_forwardable); @@ -24292,6 +24872,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1reque return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) { + LDKThirtyTwoBytes prev_channel_id_ref; + CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32); + (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data); + void* failed_next_destination_ptr = (void*)(((uintptr_t)failed_next_destination) & ~1); + CHECK_ACCESS(failed_next_destination_ptr); + LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr); + failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)(((uintptr_t)failed_next_destination) & ~1)); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -24780,6 +25374,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, j return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKHostname this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + Hostname_free(this_obj_conv); +} + +static inline uintptr_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) { + LDKHostname ret_var = Hostname_clone(arg); +int64_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKHostname arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + int64_t ret_conv = Hostname_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKHostname orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKHostname ret_var = Hostname_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHostname this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int8_t ret_conv = Hostname_len(&this_arg_conv); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) { LDKu8slice msg_ref; msg_ref.datalen = (*env)->GetArrayLength(env, msg); @@ -26935,8 +27584,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1mon if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); } LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr; void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1); - if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); } - LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr; + CHECK_ACCESS(fee_estimator_ptr); + LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr); + if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv); + } void* logger_ptr = (void*)(((uintptr_t)logger) & ~1); if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; @@ -27034,6 +27687,16 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1a return ret_arr; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form); + return ret_arr; +} + JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) { LDKChannelMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -30333,6 +30996,33 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spont return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKCVec_RouteHopZ hops_constr; + hops_constr.datalen = (*env)->GetArrayLength(env, hops); + if (hops_constr.datalen > 0) + hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + hops_constr.data = NULL; + int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL); + for (size_t k = 0; k < hops_constr.datalen; k++) { + int64_t hops_conv_10 = hops_vals[k]; + LDKRouteHop hops_conv_10_conv; + hops_conv_10_conv.inner = (void*)(hops_conv_10 & (~1)); + hops_conv_10_conv.is_owned = (hops_conv_10 & 1) || (hops_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv); + hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv); + hops_constr.data[k] = hops_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -34392,6 +35082,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEn return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) { + LDKHostname hostname_conv; + hostname_conv.inner = (void*)(hostname & (~1)); + hostname_conv.is_owned = (hostname & 1) || (hostname == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv); + hostname_conv = Hostname_clone(&hostname_conv); + LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); + *ret_copy = NetAddress_hostname(hostname_conv, port); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKNetAddress* obj_conv = (LDKNetAddress*)obj; LDKCVec_u8Z ret_var = NetAddress_write(obj_conv); @@ -35211,6 +35913,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1ht UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKUnsignedChannelUpdate this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKUnsignedChannelUpdate this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val); +} + JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelUpdate this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -35257,6 +35976,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1ex UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) { + LDKThirtyTwoBytes chain_hash_arg_ref; + CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32); + (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data); + LDKCVec_u8Z excess_data_arg_ref; + excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg); + excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data); + LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref); + int64_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) { LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg); int64_t ret_ref = 0; @@ -42336,10 +43075,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htl this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv); - int64_t ret_ref = (uintptr_t)ret_copy; - return ret_ref; + int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv); + return ret_conv; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { @@ -42347,11 +43084,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - void* val_ptr = (void*)(((uintptr_t)val) & ~1); - CHECK_ACCESS(val_ptr); - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); - ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -42417,10 +43150,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1 } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { - void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1); - CHECK_ACCESS(htlc_maximum_msat_arg_ptr); - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1)); LDKRoutingFees fees_arg_conv; fees_arg_conv.inner = (void*)(fees_arg & (~1)); fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); @@ -42431,7 +43160,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIE last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv); last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -43922,6 +44651,48 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id); + int64_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKNodeId node_id_conv; + node_id_conv.inner = (void*)(node_id & (~1)); + node_id_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv); + LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv); + int64_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) { LDKReadOnlyNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -44741,24 +45512,61 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1t PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val); } -JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1mpp_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int8_t ret_conv = PaymentParameters_get_max_mpp_path_count(&this_ptr_conv); + int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv); return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1mpp_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) { LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - PaymentParameters_set_max_mpp_path_count(&this_ptr_conv, val); + PaymentParameters_set_max_path_count(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_mpp_path_count_arg) { +JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCVec_u64Z val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); + for (size_t g = 0; g < val_constr.datalen; g++) { + int64_t val_conv_6 = val_vals[g]; + val_constr.data[g] = val_conv_6; + } + (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); + PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) { LDKPublicKey payee_pubkey_arg_ref; CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33); (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form); @@ -44788,7 +45596,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIE CHECK_ACCESS(expiry_time_arg_ptr); LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr); expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1)); - LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_mpp_path_count_arg); + LDKCVec_u64Z previously_failed_channels_arg_constr; + previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg); + if (previously_failed_channels_arg_constr.datalen > 0) + previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + previously_failed_channels_arg_constr.data = NULL; + int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL); + for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) { + int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g]; + previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6; + } + (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0); + LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -45730,6 +46550,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -45764,21 +46601,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv); + int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv); return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val); + ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -45798,6 +46635,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val); +} + static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) { LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg); int64_t ret_ref = 0; @@ -45912,12 +46766,36 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1b ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1banned(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKNodeId node_id_conv; + node_id_conv.inner = (void*)(node_id & (~1)); + node_id_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv); + ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKNodeId node_id_conv; + node_id_conv.inner = (void*)(node_id & (~1)); + node_id_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv); + ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) { LDKProbabilisticScorer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - ProbabilisticScorer_clear_banned(&this_arg_conv); + ProbabilisticScorer_clear_manual_penalties(&this_arg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) { diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index 6909f9c3..31d69e31 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -647,6 +647,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReas JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKHTLCDestination_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKHTLCDestination; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_HTLCDestinationZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_HTLCDestinationZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKNetworkUpdate_ref_from_ptr @@ -777,18 +809,26 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_ /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_OutPointCVec_MonitorEventZZ_get_a + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1a +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_OutPointCVec_MonitorEventZZ_get_b + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b * Signature: (J)[J */ -JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1get_1b +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c (JNIEnv *, jclass, jlong); /* @@ -3295,6 +3335,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful (JNIEnv *, jclass, jlong, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: Score_probe_failed + * Signature: (J[JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed + (JNIEnv *, jclass, jlong, jlongArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Score_probe_successful + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful + (JNIEnv *, jclass, jlong, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: Score_write @@ -5151,6 +5207,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CVec_u64Z_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: CResult_PaymentParametersDecodeErrorZ_ok @@ -5503,6 +5567,94 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReas JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: COption_HTLCDestinationZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_HTLCDestinationZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_HTLCDestinationZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_HTLCDestinationZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_HTLCDestinationZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_HTLCDestinationZDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: COption_NetworkUpdateZ_some @@ -5801,42 +5953,42 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_OutPointCVec_MonitorEventZZ_clone_ptr + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_OutPointCVec_MonitorEventZZ_clone + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_OutPointCVec_MonitorEventZZ_new - * Signature: (J[J)J + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new + * Signature: (J[J[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1new - (JNIEnv *, jclass, jlong, jlongArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new + (JNIEnv *, jclass, jlong, jlongArray, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_OutPointCVec_MonitorEventZZ_free + * Method: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorEventZZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free + * Method: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free * Signature: ([J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorEventZZZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free (JNIEnv *, jclass, jlongArray); /* @@ -6791,14 +6943,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeError JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CVec_u64Z_free - * Signature: ([J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free - (JNIEnv *, jclass, jlongArray); - /* * Class: org_ldk_impl_bindings * Method: CResult_NodeInfoDecodeErrorZ_ok @@ -11943,6 +12087,70 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_next_hop_channel + * Signature: ([B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel + (JNIEnv *, jclass, jbyteArray, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_unknown_next_hop + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_failed_payment + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDestination_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: Event_free @@ -12023,6 +12231,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1success JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed (JNIEnv *, jclass, jbyteArray, jbyteArray, jboolean, jlong, jboolean, jlongArray, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Event_probe_successful + * Signature: ([B[B[J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: Event_probe_failed + * Signature: ([B[B[JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlongArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: Event_pending_htlcs_forwardable @@ -12071,6 +12295,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Event_htlchandling_failed + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed + (JNIEnv *, jclass, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: Event_write @@ -12399,6 +12631,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BigSize_1new (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Hostname_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Hostname_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Hostname_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Hostname_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Hostname_len + * Signature: (J)B + */ +JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_Hostname_1len + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: sign @@ -13999,6 +14263,14 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelMonitor_get_counterparty_node_id + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelMonitor_get_latest_holder_commitment_txn @@ -15831,6 +16103,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payme JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment (JNIEnv *, jclass, jlong, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_send_probe + * Signature: (J[J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe + (JNIEnv *, jclass, jlong, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_funding_transaction_generated @@ -18455,6 +18735,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3 (JNIEnv *, jclass, jbyteArray, jshort, jbyte, jshort); +/* + * Class: org_ldk_impl_bindings + * Method: NetAddress_hostname + * Signature: (JS)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname + (JNIEnv *, jclass, jlong, jshort); + /* * Class: org_ldk_impl_bindings * Method: NetAddress_write @@ -18999,6 +19287,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1h JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedChannelUpdate_get_htlc_maximum_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedChannelUpdate_set_htlc_maximum_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelUpdate_get_fee_base_msat @@ -19039,6 +19343,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fe JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data (JNIEnv *, jclass, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedChannelUpdate_new + * Signature: ([BJIBSJJII[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new + (JNIEnv *, jclass, jbyteArray, jlong, jint, jbyte, jshort, jlong, jlong, jint, jint, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelUpdate_clone_ptr @@ -24639,6 +24951,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ReadOnlyNetworkGraph_channel + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ReadOnlyNetworkGraph_node + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ReadOnlyNetworkGraph_get_addresses @@ -25105,27 +25433,51 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1t /* * Class: org_ldk_impl_bindings - * Method: PaymentParameters_get_max_mpp_path_count + * Method: PaymentParameters_get_max_path_count * Signature: (J)B */ -JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1mpp_1path_1count +JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: PaymentParameters_set_max_mpp_path_count + * Method: PaymentParameters_set_max_path_count * Signature: (JB)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1mpp_1path_1count +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count (JNIEnv *, jclass, jlong, jbyte); +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_get_max_channel_saturation_power_of_half + * Signature: (J)B + */ +JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_set_max_channel_saturation_power_of_half + * Signature: (JB)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half + (JNIEnv *, jclass, jlong, jbyte); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_set_previously_failed_channels + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels + (JNIEnv *, jclass, jlong, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: PaymentParameters_new - * Signature: ([BJ[JJIB)J + * Signature: ([BJ[JJIBB[J)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlongArray, jlong, jint, jbyte); + (JNIEnv *, jclass, jbyteArray, jlong, jlongArray, jlong, jint, jbyte, jbyte, jlongArray); /* * Class: org_ldk_impl_bindings @@ -25655,6 +26007,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameter JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1amount_1multiplier_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat @@ -25689,18 +26057,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters /* * Class: org_ldk_impl_bindings - * Method: ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat + * Method: ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat + * Method: ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat (JNIEnv *, jclass, jlong, jlong); /* @@ -25719,6 +26087,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameter JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1anti_1probing_1penalty_1msat (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_get_considered_impossible_penalty_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_set_considered_impossible_penalty_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1considered_1impossible_1penalty_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScoringParameters_clone_ptr @@ -25777,10 +26161,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1b /* * Class: org_ldk_impl_bindings - * Method: ProbabilisticScorer_clear_banned + * Method: ProbabilisticScorer_set_manual_penalty + * Signature: (JJJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1set_1manual_1penalty + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_remove_manual_penalty + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_clear_manual_penalties * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1banned +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties (JNIEnv *, jclass, jlong); /*