From: Matt Corallo Date: Wed, 8 Mar 2023 02:43:07 +0000 (+0000) Subject: [Java] Update auto-generated Java bindings X-Git-Tag: v0.0.114.0~7 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=eab9331afd014558a982441138e222999a9955d1;p=ldk-java [Java] Update auto-generated Java bindings --- diff --git a/src/main/java/org/ldk/enums/AccessError.java b/src/main/java/org/ldk/enums/AccessError.java deleted file mode 100644 index 805a9a5c..00000000 --- a/src/main/java/org/ldk/enums/AccessError.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.ldk.enums; - -/** - * An error when accessing the chain via [`Access`]. - */ -public enum AccessError { - /** - * The requested chain is unknown. - */ - LDKAccessError_UnknownChain, - /** - * The requested transaction doesn't exist or hasn't confirmed. - */ - LDKAccessError_UnknownTx, - ; static native void init(); - static { init(); } -} \ No newline at end of file diff --git a/src/main/java/org/ldk/enums/CreationError.java b/src/main/java/org/ldk/enums/CreationError.java index 958959cc..c01ba2ff 100644 --- a/src/main/java/org/ldk/enums/CreationError.java +++ b/src/main/java/org/ldk/enums/CreationError.java @@ -27,6 +27,12 @@ public enum CreationError { * [phantom invoices]: crate::utils::create_phantom_invoice */ LDKCreationError_MissingRouteHints, + /** + * The provided `min_final_cltv_expiry_delta` was less than [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + */ + LDKCreationError_MinFinalCltvExpiryDeltaTooShort, ; static native void init(); static { init(); } } \ No newline at end of file diff --git a/src/main/java/org/ldk/enums/FailureCode.java b/src/main/java/org/ldk/enums/FailureCode.java new file mode 100644 index 00000000..d21f289e --- /dev/null +++ b/src/main/java/org/ldk/enums/FailureCode.java @@ -0,0 +1,29 @@ +package org.ldk.enums; + +/** + * This enum is used to specify which error data to send to peers when failing back an HTLC + * using [`ChannelManager::fail_htlc_backwards_with_reason`]. + * + * For more info on failure codes, see . + */ +public enum FailureCode { + /** + * We had a temporary error processing the payment. Useful if no other error codes fit + * and you want to indicate that the payer may want to retry. + */ + LDKFailureCode_TemporaryNodeFailure, + /** + * We have a required feature which was not in this onion. For example, you may require + * some additional metadata that was not provided with this payment. + */ + LDKFailureCode_RequiredNodeFeatureMissing, + /** + * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of + * the HTLC is too close to the current block height for safe handling. + * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is + * equivalent to calling [`ChannelManager::fail_htlc_backwards`]. + */ + LDKFailureCode_IncorrectOrUnknownPaymentDetails, + ; static native void init(); + static { init(); } +} \ No newline at end of file diff --git a/src/main/java/org/ldk/enums/Recipient.java b/src/main/java/org/ldk/enums/Recipient.java index 488ecab3..6fad691b 100644 --- a/src/main/java/org/ldk/enums/Recipient.java +++ b/src/main/java/org/ldk/enums/Recipient.java @@ -3,7 +3,7 @@ package org.ldk.enums; /** * Specifies the recipient of an invoice. * - * This indicates to [`KeysInterface::sign_invoice`] what node secret key should be used to sign + * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign * the invoice. */ public enum Recipient { diff --git a/src/main/java/org/ldk/enums/RetryableSendFailure.java b/src/main/java/org/ldk/enums/RetryableSendFailure.java new file mode 100644 index 00000000..9f76bf22 --- /dev/null +++ b/src/main/java/org/ldk/enums/RetryableSendFailure.java @@ -0,0 +1,34 @@ +package org.ldk.enums; + +/** + * Indicates an immediate error on [`ChannelManager::send_payment_with_retry`]. Further errors + * may be surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`]. + * + * [`ChannelManager::send_payment_with_retry`]: crate::ln::channelmanager::ChannelManager::send_payment_with_retry + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed + */ +public enum RetryableSendFailure { + /** + * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note + * that this error is *not* caused by [`Retry::Timeout`]. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + */ + LDKRetryableSendFailure_PaymentExpired, + /** + * We were unable to find a route to the destination. + */ + LDKRetryableSendFailure_RouteNotFound, + /** + * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]). + * + * [`PaymentId`]: crate::ln::channelmanager::PaymentId + * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed + */ + LDKRetryableSendFailure_DuplicatePayment, + ; static native void init(); + static { init(); } +} \ No newline at end of file diff --git a/src/main/java/org/ldk/enums/UtxoLookupError.java b/src/main/java/org/ldk/enums/UtxoLookupError.java new file mode 100644 index 00000000..1b2a750b --- /dev/null +++ b/src/main/java/org/ldk/enums/UtxoLookupError.java @@ -0,0 +1,17 @@ +package org.ldk.enums; + +/** + * An error when accessing the chain via [`UtxoLookup`]. + */ +public enum UtxoLookupError { + /** + * The requested chain is unknown. + */ + LDKUtxoLookupError_UnknownChain, + /** + * The requested transaction doesn't exist or hasn't confirmed. + */ + LDKUtxoLookupError_UnknownTx, + ; static native void init(); + static { init(); } +} \ No newline at end of file diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index f357e10d..5c3cc92a 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -45,20 +45,22 @@ public class bindings { public static native String get_ldk_c_bindings_version(); public static native String get_ldk_version(); - static { AccessError.values(); /* Force enum statics to run */ } static { COption_NoneZ.values(); /* Force enum statics to run */ } static { ChannelMonitorUpdateStatus.values(); /* Force enum statics to run */ } static { ConfirmationTarget.values(); /* Force enum statics to run */ } static { CreationError.values(); /* Force enum statics to run */ } static { Currency.values(); /* Force enum statics to run */ } + static { FailureCode.values(); /* Force enum statics to run */ } static { HTLCClaim.values(); /* Force enum statics to run */ } static { IOError.values(); /* Force enum statics to run */ } static { Level.values(); /* Force enum statics to run */ } static { Network.values(); /* Force enum statics to run */ } static { Recipient.values(); /* Force enum statics to run */ } + static { RetryableSendFailure.values(); /* Force enum statics to run */ } static { Secp256k1Error.values(); /* Force enum statics to run */ } static { SemanticError.values(); /* Force enum statics to run */ } static { SiPrefix.values(); /* Force enum statics to run */ } + static { UtxoLookupError.values(); /* Force enum statics to run */ } // struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) public static native byte[] BigEndianScalar_get_bytes(long thing); // static void BigEndianScalar_free (struct LDKBigEndianScalar thing) @@ -96,6 +98,40 @@ public class bindings { public static native byte[] TxOut_get_script_pubkey(long thing); // uint64_t TxOut_get_value (struct LDKTxOut* thing) public static native long TxOut_get_value(long thing); + public static class LDKAPIError { + private LDKAPIError() {} + public final static class APIMisuseError extends LDKAPIError { + public java.lang.String err; + APIMisuseError(java.lang.String err) { this.err = err; } + } + public final static class FeeRateTooHigh extends LDKAPIError { + public java.lang.String err; + public int feerate; + FeeRateTooHigh(java.lang.String err, int feerate) { this.err = err; this.feerate = feerate; } + } + public final static class InvalidRoute extends LDKAPIError { + public java.lang.String err; + InvalidRoute(java.lang.String err) { this.err = err; } + } + public final static class ChannelUnavailable extends LDKAPIError { + public java.lang.String err; + ChannelUnavailable(java.lang.String err) { this.err = err; } + } + public final static class MonitorUpdateInProgress extends LDKAPIError { + MonitorUpdateInProgress() { } + } + public final static class IncompatibleShutdownScript extends LDKAPIError { + public long script; + IncompatibleShutdownScript(long script) { this.script = script; } + } + static native void init(); + } + static { LDKAPIError.init(); } + public static native LDKAPIError LDKAPIError_ref_from_ptr(long ptr); + // void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner); + public static native void CResult_NoneAPIErrorZ_get_ok(long owner); + // struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner); + public static native long CResult_NoneAPIErrorZ_get_err(long owner); public static class LDKCOption_HTLCClaimZ { private LDKCOption_HTLCClaimZ() {} public final static class Some extends LDKCOption_HTLCClaimZ { @@ -337,6 +373,70 @@ public class bindings { public static native long CResult_PaymentPurposeDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_PaymentPurposeDecodeErrorZ_get_err(long owner); + public static class LDKNetworkUpdate { + private LDKNetworkUpdate() {} + public final static class ChannelUpdateMessage extends LDKNetworkUpdate { + public long msg; + ChannelUpdateMessage(long msg) { this.msg = msg; } + } + public final static class ChannelFailure extends LDKNetworkUpdate { + public long short_channel_id; + public boolean is_permanent; + ChannelFailure(long short_channel_id, boolean is_permanent) { this.short_channel_id = short_channel_id; this.is_permanent = is_permanent; } + } + public final static class NodeFailure extends LDKNetworkUpdate { + public byte[] node_id; + public boolean is_permanent; + NodeFailure(byte[] node_id, boolean is_permanent) { this.node_id = node_id; this.is_permanent = is_permanent; } + } + static native void init(); + } + static { LDKNetworkUpdate.init(); } + public static native LDKNetworkUpdate LDKNetworkUpdate_ref_from_ptr(long ptr); + public static class LDKCOption_NetworkUpdateZ { + private LDKCOption_NetworkUpdateZ() {} + public final static class Some extends LDKCOption_NetworkUpdateZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_NetworkUpdateZ { + None() { } + } + static native void init(); + } + static { LDKCOption_NetworkUpdateZ.init(); } + public static native LDKCOption_NetworkUpdateZ LDKCOption_NetworkUpdateZ_ref_from_ptr(long ptr); + public static class LDKPathFailure { + private LDKPathFailure() {} + public final static class InitialSend extends LDKPathFailure { + public long err; + InitialSend(long err) { this.err = err; } + } + public final static class OnPath extends LDKPathFailure { + public long network_update; + OnPath(long network_update) { this.network_update = network_update; } + } + static native void init(); + } + static { LDKPathFailure.init(); } + public static native LDKPathFailure LDKPathFailure_ref_from_ptr(long ptr); + public static class LDKCOption_PathFailureZ { + private LDKCOption_PathFailureZ() {} + public final static class Some extends LDKCOption_PathFailureZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_PathFailureZ { + None() { } + } + static native void init(); + } + static { LDKCOption_PathFailureZ.init(); } + public static native LDKCOption_PathFailureZ LDKCOption_PathFailureZ_ref_from_ptr(long ptr); + // struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_PathFailureZDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_PathFailureZDecodeErrorZ_get_err(long owner); public static class LDKClosureReason { private LDKClosureReason() {} public final static class CounterpartyForceClosed extends LDKClosureReason { @@ -439,39 +539,6 @@ public class bindings { } static { LDKCOption_u128Z.init(); } public static native LDKCOption_u128Z LDKCOption_u128Z_ref_from_ptr(long ptr); - public static class LDKNetworkUpdate { - private LDKNetworkUpdate() {} - public final static class ChannelUpdateMessage extends LDKNetworkUpdate { - public long msg; - ChannelUpdateMessage(long msg) { this.msg = msg; } - } - public final static class ChannelFailure extends LDKNetworkUpdate { - public long short_channel_id; - public boolean is_permanent; - ChannelFailure(long short_channel_id, boolean is_permanent) { this.short_channel_id = short_channel_id; this.is_permanent = is_permanent; } - } - public final static class NodeFailure extends LDKNetworkUpdate { - public byte[] node_id; - public boolean is_permanent; - NodeFailure(byte[] node_id, boolean is_permanent) { this.node_id = node_id; this.is_permanent = is_permanent; } - } - static native void init(); - } - static { LDKNetworkUpdate.init(); } - public static native LDKNetworkUpdate LDKNetworkUpdate_ref_from_ptr(long ptr); - public static class LDKCOption_NetworkUpdateZ { - private LDKCOption_NetworkUpdateZ() {} - public final static class Some extends LDKCOption_NetworkUpdateZ { - public long some; - Some(long some) { this.some = some; } - } - public final static class None extends LDKCOption_NetworkUpdateZ { - None() { } - } - static native void init(); - } - static { LDKCOption_NetworkUpdateZ.init(); } - public static native LDKCOption_NetworkUpdateZ LDKCOption_NetworkUpdateZ_ref_from_ptr(long ptr); public static class LDKSpendableOutputDescriptor { private LDKSpendableOutputDescriptor() {} public final static class StaticOutput extends LDKSpendableOutputDescriptor { @@ -539,12 +606,11 @@ public class bindings { public byte[] payment_id; public byte[] payment_hash; public boolean payment_failed_permanently; - public long network_update; - public boolean all_paths_failed; + public long failure; public long[] path; public long short_channel_id; public long retry; - PaymentPathFailed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, 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.payment_failed_permanently = payment_failed_permanently; 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; } + PaymentPathFailed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, long failure, long[] path, long short_channel_id, long retry) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.payment_failed_permanently = payment_failed_permanently; this.failure = failure; this.path = path; this.short_channel_id = short_channel_id; this.retry = retry; } } public final static class ProbeSuccessful extends LDKEvent { public byte[] payment_id; @@ -735,6 +801,10 @@ public class bindings { public long msg; BroadcastChannelUpdate(long msg) { this.msg = msg; } } + public final static class BroadcastNodeAnnouncement extends LDKMessageSendEvent { + public long msg; + BroadcastNodeAnnouncement(long msg) { this.msg = msg; } + } public final static class SendChannelUpdate extends LDKMessageSendEvent { public byte[] node_id; public long msg; @@ -769,10 +839,6 @@ public class bindings { } static { LDKMessageSendEvent.init(); } public static native LDKMessageSendEvent LDKMessageSendEvent_ref_from_ptr(long ptr); - // struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner); - public static native long CResult_TxOutAccessErrorZ_get_ok(long owner); - // enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner); - public static native AccessError CResult_TxOutAccessErrorZ_get_err(long owner); // uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner); public static native long C2Tuple_usizeTransactionZ_get_a(long owner); // struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner); @@ -831,6 +897,27 @@ public class bindings { } static { LDKCOption_C2Tuple_u64u64ZZ.init(); } public static native LDKCOption_C2Tuple_u64u64ZZ LDKCOption_C2Tuple_u64u64ZZ_ref_from_ptr(long ptr); + // struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner); + public static native short[] C2Tuple_Z_get_a(long owner); + // struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner); + public static native short[] C2Tuple_Z_get_b(long owner); + // struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner); + public static native short[] C2Tuple__u168_u168Z_get_a(long owner); + // struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner); + public static native short[] C2Tuple__u168_u168Z_get_b(long owner); + public static class LDKCOption_C2Tuple_EightU16sEightU16sZZ { + private LDKCOption_C2Tuple_EightU16sEightU16sZZ() {} + public final static class Some extends LDKCOption_C2Tuple_EightU16sEightU16sZZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_C2Tuple_EightU16sEightU16sZZ { + None() { } + } + static native void init(); + } + static { LDKCOption_C2Tuple_EightU16sEightU16sZZ.init(); } + public static native LDKCOption_C2Tuple_EightU16sEightU16sZZ LDKCOption_C2Tuple_EightU16sEightU16sZZ_ref_from_ptr(long ptr); public interface LDKLogger { void log(long record); } @@ -855,18 +942,14 @@ public class bindings { public static native long CResult_InvoiceFeaturesDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_InvoiceFeaturesDecodeErrorZ_get_err(long owner); + // struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_BlindedHopFeaturesDecodeErrorZ_get_err(long owner); // struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(long owner); - // struct LDKOfferFeatures CResult_OfferFeaturesDecodeErrorZ_get_ok(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_OfferFeaturesDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_OfferFeaturesDecodeErrorZ_get_err(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_OfferFeaturesDecodeErrorZ_get_err(long owner); - // struct LDKInvoiceRequestFeatures CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(long owner); // struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_NodeIdDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner); @@ -875,25 +958,43 @@ public class bindings { public static native long CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(long owner); - public interface LDKAccess { + // struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner); + public static native long CResult_TxOutUtxoLookupErrorZ_get_ok(long owner); + // enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner); + public static native UtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(long owner); + public static class LDKUtxoResult { + private LDKUtxoResult() {} + public final static class Sync extends LDKUtxoResult { + public long sync; + Sync(long sync) { this.sync = sync; } + } + public final static class Async extends LDKUtxoResult { + public long async; + Async(long async) { this.async = async; } + } + static native void init(); + } + static { LDKUtxoResult.init(); } + public static native LDKUtxoResult LDKUtxoResult_ref_from_ptr(long ptr); + public interface LDKUtxoLookup { long get_utxo(byte[] genesis_hash, long short_channel_id); } - public static native long LDKAccess_new(LDKAccess impl); - // LDKCResult_TxOutAccessErrorZ Access_get_utxo LDKAccess *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id - public static native long Access_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id); - public static class LDKCOption_AccessZ { - private LDKCOption_AccessZ() {} - public final static class Some extends LDKCOption_AccessZ { + public static native long LDKUtxoLookup_new(LDKUtxoLookup impl); + // LDKUtxoResult UtxoLookup_get_utxo LDKUtxoLookup *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id + public static native long UtxoLookup_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id); + public static class LDKCOption_UtxoLookupZ { + private LDKCOption_UtxoLookupZ() {} + public final static class Some extends LDKCOption_UtxoLookupZ { public long some; Some(long some) { this.some = some; } } - public final static class None extends LDKCOption_AccessZ { + public final static class None extends LDKCOption_UtxoLookupZ { None() { } } static native void init(); } - static { LDKCOption_AccessZ.init(); } - public static native LDKCOption_AccessZ LDKCOption_AccessZ_ref_from_ptr(long ptr); + static { LDKCOption_UtxoLookupZ.init(); } + public static native LDKCOption_UtxoLookupZ LDKCOption_UtxoLookupZ_ref_from_ptr(long ptr); // bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner); public static native boolean CResult_boolLightningErrorZ_get_ok(long owner); // struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner); @@ -1018,18 +1119,6 @@ public class bindings { public static native byte[] CResult_SignatureNoneZ_get_ok(long owner); // void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner); public static native void CResult_SignatureNoneZ_get_err(long owner); - // struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner); - public static native byte[] C2Tuple_SignatureSignatureZ_get_a(long owner); - // struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner); - public static native byte[] C2Tuple_SignatureSignatureZ_get_b(long owner); - // struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner); - public static native long CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(long owner); - // void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner); - public static native void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(long owner); - // struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner); - public static native byte[] CResult_SecretKeyNoneZ_get_ok(long owner); - // void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner); - public static native void CResult_SecretKeyNoneZ_get_err(long owner); // struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner); public static native byte[] CResult_PublicKeyNoneZ_get_ok(long owner); // void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner); @@ -1051,11 +1140,31 @@ public class bindings { public static native byte[] CResult_SharedSecretNoneZ_get_ok(long owner); // void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner); public static native void CResult_SharedSecretNoneZ_get_err(long owner); - public interface LDKBaseSign { + // struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner); + public static native byte[] CResult_RecoverableSignatureNoneZ_get_ok(long owner); + // void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner); + public static native void CResult_RecoverableSignatureNoneZ_get_err(long owner); + public interface LDKChannelSigner { byte[] get_per_commitment_point(long idx); byte[] release_commitment_secret(long idx); long validate_holder_commitment(long holder_tx, byte[][] preimages); byte[] channel_keys_id(); + void provide_channel_parameters(long channel_parameters); + } + public static native long LDKChannelSigner_new(LDKChannelSigner impl, long pubkeys); + // LDKPublicKey ChannelSigner_get_per_commitment_point LDKChannelSigner *NONNULL_PTR this_arg, uint64_t idx + public static native byte[] ChannelSigner_get_per_commitment_point(long this_arg, long idx); + // LDKThirtyTwoBytes ChannelSigner_release_commitment_secret LDKChannelSigner *NONNULL_PTR this_arg, uint64_t idx + public static native byte[] ChannelSigner_release_commitment_secret(long this_arg, long idx); + // LDKCResult_NoneNoneZ ChannelSigner_validate_holder_commitment LDKChannelSigner *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages + public static native long ChannelSigner_validate_holder_commitment(long this_arg, long holder_tx, byte[][] preimages); + // LDKThirtyTwoBytes ChannelSigner_channel_keys_id LDKChannelSigner *NONNULL_PTR this_arg + public static native byte[] ChannelSigner_channel_keys_id(long this_arg); + // void ChannelSigner_provide_channel_parameters LDKChannelSigner *NONNULL_PTR this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters + public static native void ChannelSigner_provide_channel_parameters(long this_arg, long channel_parameters); + // LDKChannelPublicKeys ChannelSigner_get_pubkeys LDKChannelSigner *NONNULL_PTR this_arg + public static native long ChannelSigner_get_pubkeys(long this_arg); + public interface LDKEcdsaChannelSigner { long sign_counterparty_commitment(long commitment_tx, byte[][] preimages); long validate_counterparty_revocation(long idx, byte[] secret); long sign_holder_commitment_and_htlcs(long commitment_tx); @@ -1064,55 +1173,40 @@ public class bindings { long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); long sign_closing_transaction(long closing_tx); long sign_holder_anchor_input(byte[] anchor_tx, long input); - long sign_channel_announcement(long msg); - void provide_channel_parameters(long channel_parameters); + long sign_channel_announcement_with_funding_key(long msg); } - public static native long LDKBaseSign_new(LDKBaseSign impl, long pubkeys); - // LDKPublicKey BaseSign_get_per_commitment_point LDKBaseSign *NONNULL_PTR this_arg, uint64_t idx - public static native byte[] BaseSign_get_per_commitment_point(long this_arg, long idx); - // LDKThirtyTwoBytes BaseSign_release_commitment_secret LDKBaseSign *NONNULL_PTR this_arg, uint64_t idx - public static native byte[] BaseSign_release_commitment_secret(long this_arg, long idx); - // LDKCResult_NoneNoneZ BaseSign_validate_holder_commitment LDKBaseSign *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages - public static native long BaseSign_validate_holder_commitment(long this_arg, long holder_tx, byte[][] preimages); - // LDKThirtyTwoBytes BaseSign_channel_keys_id LDKBaseSign *NONNULL_PTR this_arg - public static native byte[] BaseSign_channel_keys_id(long this_arg); - // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ BaseSign_sign_counterparty_commitment LDKBaseSign *NONNULL_PTR this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages - public static native long BaseSign_sign_counterparty_commitment(long this_arg, long commitment_tx, byte[][] preimages); - // LDKCResult_NoneNoneZ BaseSign_validate_counterparty_revocation LDKBaseSign *NONNULL_PTR this_arg, uint64_t idx, const uint8_t (*secret)[32] - public static native long BaseSign_validate_counterparty_revocation(long this_arg, long idx, byte[] secret); - // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ BaseSign_sign_holder_commitment_and_htlcs LDKBaseSign *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx - public static native long BaseSign_sign_holder_commitment_and_htlcs(long this_arg, long commitment_tx); - // LDKCResult_SignatureNoneZ BaseSign_sign_justice_revoked_output LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32] - public static native long BaseSign_sign_justice_revoked_output(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key); - // LDKCResult_SignatureNoneZ BaseSign_sign_justice_revoked_htlc LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc - public static native long BaseSign_sign_justice_revoked_htlc(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); - // LDKCResult_SignatureNoneZ BaseSign_sign_counterparty_htlc_transaction LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc - public static native long BaseSign_sign_counterparty_htlc_transaction(long this_arg, byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); - // LDKCResult_SignatureNoneZ BaseSign_sign_closing_transaction LDKBaseSign *NONNULL_PTR this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx - public static native long BaseSign_sign_closing_transaction(long this_arg, long closing_tx); - // LDKCResult_SignatureNoneZ BaseSign_sign_holder_anchor_input LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction anchor_tx, uintptr_t input - public static native long BaseSign_sign_holder_anchor_input(long this_arg, byte[] anchor_tx, long input); - // LDKCResult_C2Tuple_SignatureSignatureZNoneZ BaseSign_sign_channel_announcement LDKBaseSign *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg - public static native long BaseSign_sign_channel_announcement(long this_arg, long msg); - // void BaseSign_provide_channel_parameters LDKBaseSign *NONNULL_PTR this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters - public static native void BaseSign_provide_channel_parameters(long this_arg, long channel_parameters); - // LDKChannelPublicKeys BaseSign_get_pubkeys LDKBaseSign *NONNULL_PTR this_arg - public static native long BaseSign_get_pubkeys(long this_arg); - public interface LDKSign { + public static native long LDKEcdsaChannelSigner_new(LDKEcdsaChannelSigner impl, LDKChannelSigner ChannelSigner, long pubkeys); + public static native long LDKEcdsaChannelSigner_get_ChannelSigner(long arg); + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ EcdsaChannelSigner_sign_counterparty_commitment LDKEcdsaChannelSigner *NONNULL_PTR this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages + public static native long EcdsaChannelSigner_sign_counterparty_commitment(long this_arg, long commitment_tx, byte[][] preimages); + // LDKCResult_NoneNoneZ EcdsaChannelSigner_validate_counterparty_revocation LDKEcdsaChannelSigner *NONNULL_PTR this_arg, uint64_t idx, const uint8_t (*secret)[32] + public static native long EcdsaChannelSigner_validate_counterparty_revocation(long this_arg, long idx, byte[] secret); + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ EcdsaChannelSigner_sign_holder_commitment_and_htlcs LDKEcdsaChannelSigner *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx + public static native long EcdsaChannelSigner_sign_holder_commitment_and_htlcs(long this_arg, long commitment_tx); + // LDKCResult_SignatureNoneZ EcdsaChannelSigner_sign_justice_revoked_output LDKEcdsaChannelSigner *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32] + public static native long EcdsaChannelSigner_sign_justice_revoked_output(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key); + // LDKCResult_SignatureNoneZ EcdsaChannelSigner_sign_justice_revoked_htlc LDKEcdsaChannelSigner *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc + public static native long EcdsaChannelSigner_sign_justice_revoked_htlc(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); + // LDKCResult_SignatureNoneZ EcdsaChannelSigner_sign_counterparty_htlc_transaction LDKEcdsaChannelSigner *NONNULL_PTR this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc + public static native long EcdsaChannelSigner_sign_counterparty_htlc_transaction(long this_arg, byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); + // LDKCResult_SignatureNoneZ EcdsaChannelSigner_sign_closing_transaction LDKEcdsaChannelSigner *NONNULL_PTR this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx + public static native long EcdsaChannelSigner_sign_closing_transaction(long this_arg, long closing_tx); + // LDKCResult_SignatureNoneZ EcdsaChannelSigner_sign_holder_anchor_input LDKEcdsaChannelSigner *NONNULL_PTR this_arg, struct LDKTransaction anchor_tx, uintptr_t input + public static native long EcdsaChannelSigner_sign_holder_anchor_input(long this_arg, byte[] anchor_tx, long input); + // LDKCResult_SignatureNoneZ EcdsaChannelSigner_sign_channel_announcement_with_funding_key LDKEcdsaChannelSigner *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg + public static native long EcdsaChannelSigner_sign_channel_announcement_with_funding_key(long this_arg, long msg); + public interface LDKWriteableEcdsaChannelSigner { byte[] write(); } - public static native long LDKSign_new(LDKSign impl, LDKBaseSign BaseSign, long pubkeys); - public static native long LDKSign_get_BaseSign(long arg); - // LDKCVec_u8Z Sign_write LDKSign *NONNULL_PTR this_arg - public static native byte[] Sign_write(long this_arg); - // struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_SignDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_SignDecodeErrorZ_get_err(long owner); - // struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner); - public static native byte[] CResult_RecoverableSignatureNoneZ_get_ok(long owner); - // void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner); - public static native void CResult_RecoverableSignatureNoneZ_get_err(long owner); + public static native long LDKWriteableEcdsaChannelSigner_new(LDKWriteableEcdsaChannelSigner impl, LDKEcdsaChannelSigner EcdsaChannelSigner, LDKChannelSigner ChannelSigner, long pubkeys); + public static native long LDKWriteableEcdsaChannelSigner_get_EcdsaChannelSigner(long arg); + public static native long LDKWriteableEcdsaChannelSigner_get_ChannelSigner(long arg); + // LDKCVec_u8Z WriteableEcdsaChannelSigner_write LDKWriteableEcdsaChannelSigner *NONNULL_PTR this_arg + public static native byte[] WriteableEcdsaChannelSigner_write(long this_arg); + // struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(long owner); // struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner); public static native byte[][] CResult_CVec_CVec_u8ZZNoneZ_get_ok(long owner); // void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner); @@ -1146,44 +1240,29 @@ public class bindings { } static { LDKCOption_u16Z.init(); } public static native LDKCOption_u16Z LDKCOption_u16Z_ref_from_ptr(long ptr); - public static class LDKAPIError { - private LDKAPIError() {} - public final static class APIMisuseError extends LDKAPIError { - public java.lang.String err; - APIMisuseError(java.lang.String err) { this.err = err; } - } - public final static class FeeRateTooHigh extends LDKAPIError { - public java.lang.String err; - public int feerate; - FeeRateTooHigh(java.lang.String err, int feerate) { this.err = err; this.feerate = feerate; } - } - public final static class InvalidRoute extends LDKAPIError { - public java.lang.String err; - InvalidRoute(java.lang.String err) { this.err = err; } - } - public final static class ChannelUnavailable extends LDKAPIError { - public java.lang.String err; - ChannelUnavailable(java.lang.String err) { this.err = err; } + // struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner); + public static native byte[] CResult__u832APIErrorZ_get_ok(long owner); + // struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner); + public static native long CResult__u832APIErrorZ_get_err(long owner); + public static class LDKRecentPaymentDetails { + private LDKRecentPaymentDetails() {} + public final static class Pending extends LDKRecentPaymentDetails { + public byte[] payment_hash; + public long total_msat; + Pending(byte[] payment_hash, long total_msat) { this.payment_hash = payment_hash; this.total_msat = total_msat; } } - public final static class MonitorUpdateInProgress extends LDKAPIError { - MonitorUpdateInProgress() { } + public final static class Fulfilled extends LDKRecentPaymentDetails { + public byte[] payment_hash; + Fulfilled(byte[] payment_hash) { this.payment_hash = payment_hash; } } - public final static class IncompatibleShutdownScript extends LDKAPIError { - public long script; - IncompatibleShutdownScript(long script) { this.script = script; } + public final static class Abandoned extends LDKRecentPaymentDetails { + public byte[] payment_hash; + Abandoned(byte[] payment_hash) { this.payment_hash = payment_hash; } } static native void init(); } - static { LDKAPIError.init(); } - public static native LDKAPIError LDKAPIError_ref_from_ptr(long ptr); - // void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner); - public static native void CResult_NoneAPIErrorZ_get_ok(long owner); - // struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner); - public static native long CResult_NoneAPIErrorZ_get_err(long owner); - // struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner); - public static native byte[] CResult__u832APIErrorZ_get_ok(long owner); - // struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner); - public static native long CResult__u832APIErrorZ_get_err(long owner); + static { LDKRecentPaymentDetails.init(); } + public static native LDKRecentPaymentDetails LDKRecentPaymentDetails_ref_from_ptr(long ptr); public static class LDKPaymentSendFailure { private LDKPaymentSendFailure() {} public final static class ParameterError extends LDKPaymentSendFailure { @@ -1215,10 +1294,18 @@ public class bindings { public static native void CResult_NonePaymentSendFailureZ_get_ok(long owner); // struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner); public static native long CResult_NonePaymentSendFailureZ_get_err(long owner); + // void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner); + public static native void CResult_NoneRetryableSendFailureZ_get_ok(long owner); + // enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner); + public static native RetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(long owner); // struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner); public static native byte[] CResult_PaymentHashPaymentSendFailureZ_get_ok(long owner); // struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner); public static native long CResult_PaymentHashPaymentSendFailureZ_get_err(long owner); + // struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner); + public static native byte[] CResult_PaymentHashRetryableSendFailureZ_get_ok(long owner); + // enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner); + public static native RetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(long owner); // struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner); public static native byte[] C2Tuple_PaymentHashPaymentIdZ_get_a(long owner); // struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner); @@ -1275,7 +1362,7 @@ public class bindings { public static native long LDKWatch_new(LDKWatch impl); // LDKChannelMonitorUpdateStatus Watch_watch_channel LDKWatch *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor public static native ChannelMonitorUpdateStatus Watch_watch_channel(long this_arg, long funding_txo, long monitor); - // LDKChannelMonitorUpdateStatus Watch_update_channel LDKWatch *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update + // LDKChannelMonitorUpdateStatus Watch_update_channel LDKWatch *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update public static native ChannelMonitorUpdateStatus Watch_update_channel(long this_arg, long funding_txo, long update); // 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); @@ -1285,48 +1372,81 @@ public class bindings { public static native long LDKBroadcasterInterface_new(LDKBroadcasterInterface impl); // void BroadcasterInterface_broadcast_transaction LDKBroadcasterInterface *NONNULL_PTR this_arg, struct LDKTransaction tx public static native void BroadcasterInterface_broadcast_transaction(long this_arg, byte[] tx); - public interface LDKKeysInterface { - long get_node_secret(Recipient recipient); + public interface LDKEntropySource { + byte[] get_secure_random_bytes(); + } + public static native long LDKEntropySource_new(LDKEntropySource impl); + // LDKThirtyTwoBytes EntropySource_get_secure_random_bytes LDKEntropySource *NONNULL_PTR this_arg + public static native byte[] EntropySource_get_secure_random_bytes(long this_arg); + public static class LDKUnsignedGossipMessage { + private LDKUnsignedGossipMessage() {} + public final static class ChannelAnnouncement extends LDKUnsignedGossipMessage { + public long channel_announcement; + ChannelAnnouncement(long channel_announcement) { this.channel_announcement = channel_announcement; } + } + public final static class ChannelUpdate extends LDKUnsignedGossipMessage { + public long channel_update; + ChannelUpdate(long channel_update) { this.channel_update = channel_update; } + } + public final static class NodeAnnouncement extends LDKUnsignedGossipMessage { + public long node_announcement; + NodeAnnouncement(long node_announcement) { this.node_announcement = node_announcement; } + } + static native void init(); + } + static { LDKUnsignedGossipMessage.init(); } + public static native LDKUnsignedGossipMessage LDKUnsignedGossipMessage_ref_from_ptr(long ptr); + public interface LDKNodeSigner { + byte[] get_inbound_payment_key_material(); long get_node_id(Recipient recipient); long ecdh(Recipient recipient, byte[] other_key, long tweak); - byte[] get_destination_script(); - long get_shutdown_scriptpubkey(); + long sign_invoice(byte[] hrp_bytes, byte[] invoice_data, Recipient recipient); + long sign_gossip_message(long msg); + } + public static native long LDKNodeSigner_new(LDKNodeSigner impl); + // LDKThirtyTwoBytes NodeSigner_get_inbound_payment_key_material LDKNodeSigner *NONNULL_PTR this_arg + public static native byte[] NodeSigner_get_inbound_payment_key_material(long this_arg); + // LDKCResult_PublicKeyNoneZ NodeSigner_get_node_id LDKNodeSigner *NONNULL_PTR this_arg, enum LDKRecipient recipient + public static native long NodeSigner_get_node_id(long this_arg, Recipient recipient); + // LDKCResult_SharedSecretNoneZ NodeSigner_ecdh LDKNodeSigner *NONNULL_PTR this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak + public static native long NodeSigner_ecdh(long this_arg, Recipient recipient, byte[] other_key, long tweak); + // LDKCResult_RecoverableSignatureNoneZ NodeSigner_sign_invoice LDKNodeSigner *NONNULL_PTR this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient + public static native long NodeSigner_sign_invoice(long this_arg, byte[] hrp_bytes, byte[] invoice_data, Recipient recipient); + // LDKCResult_SignatureNoneZ NodeSigner_sign_gossip_message LDKNodeSigner *NONNULL_PTR this_arg, struct LDKUnsignedGossipMessage msg + public static native long NodeSigner_sign_gossip_message(long this_arg, long msg); + public interface LDKSignerProvider { byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, byte[] user_channel_id); long derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id); - byte[] get_secure_random_bytes(); long read_chan_signer(byte[] reader); - long sign_invoice(byte[] hrp_bytes, byte[] invoice_data, Recipient receipient); - byte[] get_inbound_payment_key_material(); + byte[] get_destination_script(); + long get_shutdown_scriptpubkey(); } - public static native long LDKKeysInterface_new(LDKKeysInterface impl); - // LDKCResult_SecretKeyNoneZ KeysInterface_get_node_secret LDKKeysInterface *NONNULL_PTR this_arg, enum LDKRecipient recipient - public static native long KeysInterface_get_node_secret(long this_arg, Recipient recipient); - // LDKCResult_PublicKeyNoneZ KeysInterface_get_node_id LDKKeysInterface *NONNULL_PTR this_arg, enum LDKRecipient recipient - public static native long KeysInterface_get_node_id(long this_arg, Recipient recipient); - // LDKCResult_SharedSecretNoneZ KeysInterface_ecdh LDKKeysInterface *NONNULL_PTR this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak - public static native long KeysInterface_ecdh(long this_arg, Recipient recipient, byte[] other_key, long tweak); - // LDKCVec_u8Z KeysInterface_get_destination_script LDKKeysInterface *NONNULL_PTR this_arg - public static native byte[] KeysInterface_get_destination_script(long this_arg); - // LDKShutdownScript KeysInterface_get_shutdown_scriptpubkey LDKKeysInterface *NONNULL_PTR this_arg - public static native long KeysInterface_get_shutdown_scriptpubkey(long this_arg); - // LDKThirtyTwoBytes KeysInterface_generate_channel_keys_id LDKKeysInterface *NONNULL_PTR this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id - public static native byte[] KeysInterface_generate_channel_keys_id(long this_arg, boolean inbound, long channel_value_satoshis, byte[] user_channel_id); - // LDKSign KeysInterface_derive_channel_signer LDKKeysInterface *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id - public static native long KeysInterface_derive_channel_signer(long this_arg, long channel_value_satoshis, byte[] channel_keys_id); - // LDKThirtyTwoBytes KeysInterface_get_secure_random_bytes LDKKeysInterface *NONNULL_PTR this_arg - public static native byte[] KeysInterface_get_secure_random_bytes(long this_arg); - // LDKCResult_SignDecodeErrorZ KeysInterface_read_chan_signer LDKKeysInterface *NONNULL_PTR this_arg, struct LDKu8slice reader - public static native long KeysInterface_read_chan_signer(long this_arg, byte[] reader); - // LDKCResult_RecoverableSignatureNoneZ KeysInterface_sign_invoice LDKKeysInterface *NONNULL_PTR this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient receipient - public static native long KeysInterface_sign_invoice(long this_arg, byte[] hrp_bytes, byte[] invoice_data, Recipient receipient); - // LDKThirtyTwoBytes KeysInterface_get_inbound_payment_key_material LDKKeysInterface *NONNULL_PTR this_arg - public static native byte[] KeysInterface_get_inbound_payment_key_material(long this_arg); + public static native long LDKSignerProvider_new(LDKSignerProvider impl); + // LDKThirtyTwoBytes SignerProvider_generate_channel_keys_id LDKSignerProvider *NONNULL_PTR this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id + public static native byte[] SignerProvider_generate_channel_keys_id(long this_arg, boolean inbound, long channel_value_satoshis, byte[] user_channel_id); + // LDKWriteableEcdsaChannelSigner SignerProvider_derive_channel_signer LDKSignerProvider *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id + public static native long SignerProvider_derive_channel_signer(long this_arg, long channel_value_satoshis, byte[] channel_keys_id); + // LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ SignerProvider_read_chan_signer LDKSignerProvider *NONNULL_PTR this_arg, struct LDKu8slice reader + public static native long SignerProvider_read_chan_signer(long this_arg, byte[] reader); + // LDKCVec_u8Z SignerProvider_get_destination_script LDKSignerProvider *NONNULL_PTR this_arg + public static native byte[] SignerProvider_get_destination_script(long this_arg); + // LDKShutdownScript SignerProvider_get_shutdown_scriptpubkey LDKSignerProvider *NONNULL_PTR this_arg + public static native long SignerProvider_get_shutdown_scriptpubkey(long this_arg); public interface LDKFeeEstimator { int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target); } public static native long LDKFeeEstimator_new(LDKFeeEstimator impl); // uint32_t FeeEstimator_get_est_sat_per_1000_weight LDKFeeEstimator *NONNULL_PTR this_arg, enum LDKConfirmationTarget confirmation_target public static native int FeeEstimator_get_est_sat_per_1000_weight(long this_arg, ConfirmationTarget confirmation_target); + public interface LDKRouter { + long find_route(byte[] payer, long route_params, long[] first_hops, long inflight_htlcs); + long find_route_with_id(byte[] payer, long route_params, long[] first_hops, long inflight_htlcs, byte[] _payment_hash, byte[] _payment_id); + } + public static native long LDKRouter_new(LDKRouter impl); + // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs + public static native long Router_find_route(long this_arg, byte[] payer, long route_params, long[] first_hops, long inflight_htlcs); + // LDKCResult_RouteLightningErrorZ Router_find_route_with_id LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id + public static native long Router_find_route_with_id(long this_arg, byte[] payer, long route_params, long[] first_hops, long inflight_htlcs, byte[] _payment_hash, byte[] _payment_id); // struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner); public static native byte[] C2Tuple_BlockHashChannelManagerZ_get_a(long owner); // struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner); @@ -1339,6 +1459,23 @@ public class bindings { public static native long CResult_ChannelConfigDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ChannelConfigDecodeErrorZ_get_err(long owner); + public static class LDKCOption_APIErrorZ { + private LDKCOption_APIErrorZ() {} + public final static class Some extends LDKCOption_APIErrorZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_APIErrorZ { + None() { } + } + static native void init(); + } + static { LDKCOption_APIErrorZ.init(); } + public static native LDKCOption_APIErrorZ LDKCOption_APIErrorZ_ref_from_ptr(long ptr); + // struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_APIErrorZDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_APIErrorZDecodeErrorZ_get_err(long owner); // struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_OutPointDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner); @@ -1378,13 +1515,9 @@ public class bindings { public java.lang.String invoice; Invoice(java.lang.String invoice) { this.invoice = invoice; } } - public final static class Routing extends LDKPaymentError { - public long routing; - Routing(long routing) { this.routing = routing; } - } public final static class Sending extends LDKPaymentError { - public long sending; - Sending(long sending) { this.sending = sending; } + public org.ldk.enums.RetryableSendFailure sending; + Sending(org.ldk.enums.RetryableSendFailure sending) { this.sending = sending; } } static native void init(); } @@ -1532,6 +1665,10 @@ public class bindings { } static { LDKCOption_NetAddressZ.init(); } public static native LDKCOption_NetAddressZ LDKCOption_NetAddressZ_ref_from_ptr(long ptr); + // struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner); + public static native byte[] C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(long owner); + // struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner); + public static native long C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(long owner); // struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner); public static native byte[] CResult_CVec_u8ZPeerHandleErrorZ_get_ok(long owner); // struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner); @@ -1981,15 +2118,29 @@ public class bindings { public static native long LDKPersist_new(LDKPersist impl); // LDKChannelMonitorUpdateStatus Persist_persist_new_channel LDKPersist *NONNULL_PTR this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id public static native ChannelMonitorUpdateStatus Persist_persist_new_channel(long this_arg, long channel_id, long data, long update_id); - // LDKChannelMonitorUpdateStatus Persist_update_persisted_channel LDKPersist *NONNULL_PTR this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id + // LDKChannelMonitorUpdateStatus Persist_update_persisted_channel LDKPersist *NONNULL_PTR this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id public static native ChannelMonitorUpdateStatus Persist_update_persisted_channel(long this_arg, long channel_id, long update, long data, long update_id); + public static class LDKRetry { + private LDKRetry() {} + public final static class Attempts extends LDKRetry { + public long attempts; + Attempts(long attempts) { this.attempts = attempts; } + } + public final static class Timeout extends LDKRetry { + public long timeout; + Timeout(long timeout) { this.timeout = timeout; } + } + static native void init(); + } + static { LDKRetry.init(); } + public static native LDKRetry LDKRetry_ref_from_ptr(long ptr); public interface LDKChannelMessageHandler { - void handle_open_channel(byte[] their_node_id, long their_features, long msg); - void handle_accept_channel(byte[] their_node_id, long their_features, long msg); + void handle_open_channel(byte[] their_node_id, long msg); + void handle_accept_channel(byte[] their_node_id, long msg); void handle_funding_created(byte[] their_node_id, long msg); void handle_funding_signed(byte[] their_node_id, long msg); void handle_channel_ready(byte[] their_node_id, long msg); - void handle_shutdown(byte[] their_node_id, long their_features, long msg); + void handle_shutdown(byte[] their_node_id, long msg); void handle_closing_signed(byte[] their_node_id, long msg); void handle_update_add_htlc(byte[] their_node_id, long msg); void handle_update_fulfill_htlc(byte[] their_node_id, long msg); @@ -1999,8 +2150,8 @@ public class bindings { void handle_revoke_and_ack(byte[] their_node_id, long msg); void handle_update_fee(byte[] their_node_id, long msg); void handle_announcement_signatures(byte[] their_node_id, long msg); - void peer_disconnected(byte[] their_node_id, boolean no_connection_possible); - long peer_connected(byte[] their_node_id, long msg); + void peer_disconnected(byte[] their_node_id); + long peer_connected(byte[] their_node_id, long msg, boolean inbound); void handle_channel_reestablish(byte[] their_node_id, long msg); void handle_channel_update(byte[] their_node_id, long msg); void handle_error(byte[] their_node_id, long msg); @@ -2009,18 +2160,18 @@ public class bindings { } public static native long LDKChannelMessageHandler_new(LDKChannelMessageHandler impl, LDKMessageSendEventsProvider MessageSendEventsProvider); public static native long LDKChannelMessageHandler_get_MessageSendEventsProvider(long arg); - // void ChannelMessageHandler_handle_open_channel LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg - public static native void ChannelMessageHandler_handle_open_channel(long this_arg, byte[] their_node_id, long their_features, long msg); - // void ChannelMessageHandler_handle_accept_channel LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg - public static native void ChannelMessageHandler_handle_accept_channel(long this_arg, byte[] their_node_id, long their_features, long msg); + // void ChannelMessageHandler_handle_open_channel LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg + public static native void ChannelMessageHandler_handle_open_channel(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_handle_accept_channel LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg + public static native void ChannelMessageHandler_handle_accept_channel(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_funding_created LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_funding_created(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_funding_signed LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_funding_signed(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_channel_ready LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_channel_ready(long this_arg, byte[] their_node_id, long msg); - // void ChannelMessageHandler_handle_shutdown LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg - public static native void ChannelMessageHandler_handle_shutdown(long this_arg, byte[] their_node_id, long their_features, long msg); + // void ChannelMessageHandler_handle_shutdown LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg + public static native void ChannelMessageHandler_handle_shutdown(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_closing_signed LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_closing_signed(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_update_add_htlc LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg @@ -2039,10 +2190,10 @@ public class bindings { public static native void ChannelMessageHandler_handle_update_fee(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_announcement_signatures LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_announcement_signatures(long this_arg, byte[] their_node_id, long msg); - // void ChannelMessageHandler_peer_disconnected LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible - public static native void ChannelMessageHandler_peer_disconnected(long this_arg, byte[] their_node_id, boolean no_connection_possible); - // LDKCResult_NoneNoneZ ChannelMessageHandler_peer_connected LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg - public static native long ChannelMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_peer_disconnected LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id + public static native void ChannelMessageHandler_peer_disconnected(long this_arg, byte[] their_node_id); + // LDKCResult_NoneNoneZ ChannelMessageHandler_peer_connected LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound + public static native long ChannelMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long msg, boolean inbound); // void ChannelMessageHandler_handle_channel_reestablish LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_channel_reestablish(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_channel_update LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg @@ -2058,12 +2209,13 @@ public class bindings { long handle_channel_announcement(long msg); long handle_channel_update(long msg); long get_next_channel_announcement(long starting_point); - long get_next_node_announcement(byte[] starting_point); - long peer_connected(byte[] their_node_id, long init); + long get_next_node_announcement(long starting_point); + long peer_connected(byte[] their_node_id, long init, boolean inbound); long handle_reply_channel_range(byte[] their_node_id, long msg); long handle_reply_short_channel_ids_end(byte[] their_node_id, long msg); long handle_query_channel_range(byte[] their_node_id, long msg); long handle_query_short_channel_ids(byte[] their_node_id, long msg); + boolean processing_queue_high(); long provided_node_features(); long provided_init_features(byte[] their_node_id); } @@ -2077,10 +2229,10 @@ public class bindings { public static native long RoutingMessageHandler_handle_channel_update(long this_arg, long msg); // LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ RoutingMessageHandler_get_next_channel_announcement LDKRoutingMessageHandler *NONNULL_PTR this_arg, uint64_t starting_point public static native long RoutingMessageHandler_get_next_channel_announcement(long this_arg, long starting_point); - // LDKNodeAnnouncement RoutingMessageHandler_get_next_node_announcement LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey starting_point - public static native long RoutingMessageHandler_get_next_node_announcement(long this_arg, byte[] starting_point); - // LDKCResult_NoneNoneZ RoutingMessageHandler_peer_connected LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init - public static native long RoutingMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long init); + // LDKNodeAnnouncement RoutingMessageHandler_get_next_node_announcement LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKNodeId starting_point + public static native long RoutingMessageHandler_get_next_node_announcement(long this_arg, long starting_point); + // LDKCResult_NoneNoneZ RoutingMessageHandler_peer_connected LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound + public static native long RoutingMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long init, boolean inbound); // LDKCResult_NoneLightningErrorZ RoutingMessageHandler_handle_reply_channel_range LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg public static native long RoutingMessageHandler_handle_reply_channel_range(long this_arg, byte[] their_node_id, long msg); // LDKCResult_NoneLightningErrorZ RoutingMessageHandler_handle_reply_short_channel_ids_end LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg @@ -2089,14 +2241,16 @@ public class bindings { public static native long RoutingMessageHandler_handle_query_channel_range(long this_arg, byte[] their_node_id, long msg); // LDKCResult_NoneLightningErrorZ RoutingMessageHandler_handle_query_short_channel_ids LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg public static native long RoutingMessageHandler_handle_query_short_channel_ids(long this_arg, byte[] their_node_id, long msg); + // bool RoutingMessageHandler_processing_queue_high LDKRoutingMessageHandler *NONNULL_PTR this_arg + public static native boolean RoutingMessageHandler_processing_queue_high(long this_arg); // LDKNodeFeatures RoutingMessageHandler_provided_node_features LDKRoutingMessageHandler *NONNULL_PTR this_arg public static native long RoutingMessageHandler_provided_node_features(long this_arg); // LDKInitFeatures RoutingMessageHandler_provided_init_features LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id public static native long RoutingMessageHandler_provided_init_features(long this_arg, byte[] their_node_id); public interface LDKOnionMessageHandler { void handle_onion_message(byte[] peer_node_id, long msg); - long peer_connected(byte[] their_node_id, long init); - void peer_disconnected(byte[] their_node_id, boolean no_connection_possible); + long peer_connected(byte[] their_node_id, long init, boolean inbound); + void peer_disconnected(byte[] their_node_id); long provided_node_features(); long provided_init_features(byte[] their_node_id); } @@ -2104,10 +2258,10 @@ public class bindings { public static native long LDKOnionMessageHandler_get_OnionMessageProvider(long arg); // void OnionMessageHandler_handle_onion_message LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg public static native void OnionMessageHandler_handle_onion_message(long this_arg, byte[] peer_node_id, long msg); - // LDKCResult_NoneNoneZ OnionMessageHandler_peer_connected LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init - public static native long OnionMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long init); - // void OnionMessageHandler_peer_disconnected LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible - public static native void OnionMessageHandler_peer_disconnected(long this_arg, byte[] their_node_id, boolean no_connection_possible); + // LDKCResult_NoneNoneZ OnionMessageHandler_peer_connected LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound + public static native long OnionMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long init, boolean inbound); + // void OnionMessageHandler_peer_disconnected LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id + public static native void OnionMessageHandler_peer_disconnected(long this_arg, byte[] their_node_id); // LDKNodeFeatures OnionMessageHandler_provided_node_features LDKOnionMessageHandler *NONNULL_PTR this_arg public static native long OnionMessageHandler_provided_node_features(long this_arg); // LDKInitFeatures OnionMessageHandler_provided_init_features LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id @@ -2175,27 +2329,6 @@ public class bindings { } static { LDKEffectiveCapacity.init(); } public static native LDKEffectiveCapacity LDKEffectiveCapacity_ref_from_ptr(long ptr); - public interface LDKRouter { - long find_route(byte[] payer, long route_params, long[] first_hops, long inflight_htlcs); - long find_route_with_id(byte[] payer, long route_params, long[] first_hops, long inflight_htlcs, byte[] _payment_hash, byte[] _payment_id); - void notify_payment_path_failed(long[] path, long short_channel_id); - void notify_payment_path_successful(long[] path); - void notify_payment_probe_successful(long[] path); - void notify_payment_probe_failed(long[] path, long short_channel_id); - } - public static native long LDKRouter_new(LDKRouter impl); - // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs - public static native long Router_find_route(long this_arg, byte[] payer, long route_params, long[] first_hops, long inflight_htlcs); - // LDKCResult_RouteLightningErrorZ Router_find_route_with_id LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id - public static native long Router_find_route_with_id(long this_arg, byte[] payer, long route_params, long[] first_hops, long inflight_htlcs, byte[] _payment_hash, byte[] _payment_id); - // void Router_notify_payment_path_failed LDKRouter *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id - public static native void Router_notify_payment_path_failed(long this_arg, long[] path, long short_channel_id); - // void Router_notify_payment_path_successful LDKRouter *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path - public static native void Router_notify_payment_path_successful(long this_arg, long[] path); - // void Router_notify_payment_probe_successful LDKRouter *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path - public static native void Router_notify_payment_probe_successful(long this_arg, long[] path); - // void Router_notify_payment_probe_failed LDKRouter *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id - public static native void Router_notify_payment_probe_failed(long this_arg, long[] path, long short_channel_id); public static class LDKDestination { private LDKDestination() {} public final static class Node extends LDKDestination { @@ -2256,44 +2389,6 @@ public class bindings { } static { LDKFallback.init(); } public static native LDKFallback LDKFallback_ref_from_ptr(long ptr); - public interface LDKPayer { - byte[] node_id(); - long[] first_hops(); - long send_payment(long route, byte[] payment_hash, byte[] payment_secret, byte[] payment_id); - long send_spontaneous_payment(long route, byte[] payment_preimage, byte[] payment_id); - long retry_payment(long route, byte[] payment_id); - void abandon_payment(byte[] payment_id); - long inflight_htlcs(); - } - public static native long LDKPayer_new(LDKPayer impl); - // LDKPublicKey Payer_node_id LDKPayer *NONNULL_PTR this_arg - public static native byte[] Payer_node_id(long this_arg); - // LDKCVec_ChannelDetailsZ Payer_first_hops LDKPayer *NONNULL_PTR this_arg - public static native long[] Payer_first_hops(long this_arg); - // LDKCResult_NonePaymentSendFailureZ Payer_send_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id - public static native long Payer_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret, byte[] payment_id); - // LDKCResult_NonePaymentSendFailureZ Payer_send_spontaneous_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id - public static native long Payer_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage, byte[] payment_id); - // LDKCResult_NonePaymentSendFailureZ Payer_retry_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id - public static native long Payer_retry_payment(long this_arg, long route, byte[] payment_id); - // void Payer_abandon_payment LDKPayer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id - public static native void Payer_abandon_payment(long this_arg, byte[] payment_id); - // LDKInFlightHtlcs Payer_inflight_htlcs LDKPayer *NONNULL_PTR this_arg - public static native long Payer_inflight_htlcs(long this_arg); - public static class LDKRetry { - private LDKRetry() {} - public final static class Attempts extends LDKRetry { - public long attempts; - Attempts(long attempts) { this.attempts = attempts; } - } - public final static class Timeout extends LDKRetry { - public long timeout; - Timeout(long timeout) { this.timeout = timeout; } - } - static native void init(); - } - static { LDKRetry.init(); } - public static native LDKRetry LDKRetry_ref_from_ptr(long ptr); // struct LDKStr _ldk_get_compiled_version(void); public static native String _ldk_get_compiled_version(); // struct LDKStr _ldk_c_bindings_get_compiled_version(void); @@ -2324,6 +2419,22 @@ public class bindings { public static native long TxOut_clone(long orig); // void Str_free(struct LDKStr _res); public static native void Str_free(String _res); + // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); + public static native long CResult_NoneAPIErrorZ_ok(); + // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); + public static native long CResult_NoneAPIErrorZ_err(long e); + // bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); + public static native boolean CResult_NoneAPIErrorZ_is_ok(long o); + // void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); + public static native void CResult_NoneAPIErrorZ_free(long _res); + // uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg); + public static native long CResult_NoneAPIErrorZ_clone_ptr(long arg); + // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); + public static native long CResult_NoneAPIErrorZ_clone(long orig); + // void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); + public static native void CVec_CResult_NoneAPIErrorZZ_free(long[] _res); + // void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); + public static native void CVec_APIErrorZ_free(long[] _res); // struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); public static native long COption_HTLCClaimZ_some(HTLCClaim o); // struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); @@ -2706,6 +2817,38 @@ public class bindings { public static native long CResult_PaymentPurposeDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_PaymentPurposeDecodeErrorZ_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); + public static native long COption_NetworkUpdateZ_none(); + // void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); + public static native void COption_NetworkUpdateZ_free(long _res); + // uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg); + public static native long COption_NetworkUpdateZ_clone_ptr(long arg); + // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); + public static native long COption_NetworkUpdateZ_clone(long orig); + // struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); + public static native long COption_PathFailureZ_some(long o); + // struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); + public static native long COption_PathFailureZ_none(); + // void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); + public static native void COption_PathFailureZ_free(long _res); + // uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg); + public static native long COption_PathFailureZ_clone_ptr(long arg); + // struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); + public static native long COption_PathFailureZ_clone(long orig); + // struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); + public static native long CResult_COption_PathFailureZDecodeErrorZ_ok(long o); + // struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_COption_PathFailureZDecodeErrorZ_err(long e); + // bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_COption_PathFailureZDecodeErrorZ_is_ok(long o); + // void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); + public static native void CResult_COption_PathFailureZDecodeErrorZ_free(long _res); + // uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_COption_PathFailureZDecodeErrorZ_clone(long orig); // struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); public static native long COption_ClosureReasonZ_some(long o); // struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); @@ -2760,16 +2903,6 @@ public class bindings { public static native long COption_u128Z_clone_ptr(long arg); // struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); public static native long COption_u128Z_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); - public static native long COption_NetworkUpdateZ_none(); - // void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); - public static native void COption_NetworkUpdateZ_free(long _res); - // uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg); - public static native long COption_NetworkUpdateZ_clone_ptr(long arg); - // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); - public static native long COption_NetworkUpdateZ_clone(long orig); // void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); public static native void CVec_SpendableOutputDescriptorZ_free(long[] _res); // struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); @@ -2796,18 +2929,6 @@ public class bindings { public static native long CResult_COption_EventZDecodeErrorZ_clone(long orig); // void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); public static native void CVec_MessageSendEventZ_free(long[] _res); - // struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); - public static native long CResult_TxOutAccessErrorZ_ok(long o); - // struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); - public static native long CResult_TxOutAccessErrorZ_err(AccessError e); - // bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); - public static native boolean CResult_TxOutAccessErrorZ_is_ok(long o); - // void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); - public static native void CResult_TxOutAccessErrorZ_free(long _res); - // uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg); - public static native long CResult_TxOutAccessErrorZ_clone_ptr(long arg); - // struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); - public static native long CResult_TxOutAccessErrorZ_clone(long orig); // uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg); public static native long C2Tuple_usizeTransactionZ_clone_ptr(long arg); // struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); @@ -2870,6 +2991,32 @@ public class bindings { public static native long COption_C2Tuple_u64u64ZZ_clone_ptr(long arg); // struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); public static native long COption_C2Tuple_u64u64ZZ_clone(long orig); + // uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg); + public static native long C2Tuple_Z_clone_ptr(long arg); + // struct LDKC2Tuple_Z C2Tuple_Z_clone(const struct LDKC2Tuple_Z *NONNULL_PTR orig); + public static native long C2Tuple_Z_clone(long orig); + // struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b); + public static native long C2Tuple_Z_new(short[] a, short[] b); + // void C2Tuple_Z_free(struct LDKC2Tuple_Z _res); + public static native void C2Tuple_Z_free(long _res); + // uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg); + public static native long C2Tuple__u168_u168Z_clone_ptr(long arg); + // struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig); + public static native long C2Tuple__u168_u168Z_clone(long orig); + // struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b); + public static native long C2Tuple__u168_u168Z_new(short[] a, short[] b); + // void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res); + public static native void C2Tuple__u168_u168Z_free(long _res); + // struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o); + public static native long COption_C2Tuple_EightU16sEightU16sZZ_some(long o); + // struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void); + public static native long COption_C2Tuple_EightU16sEightU16sZZ_none(); + // void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res); + public static native void COption_C2Tuple_EightU16sEightU16sZZ_free(long _res); + // uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg); + public static native long COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(long arg); + // struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_clone(const struct LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR orig); + public static native long COption_C2Tuple_EightU16sEightU16sZZ_clone(long orig); // void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); public static native void CVec_NodeIdZ_free(long[] _res); // struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); @@ -2928,6 +3075,18 @@ public class bindings { public static native long CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_InvoiceFeaturesDecodeErrorZ_clone(long orig); + // struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); + public static native long CResult_BlindedHopFeaturesDecodeErrorZ_ok(long o); + // struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_BlindedHopFeaturesDecodeErrorZ_err(long e); + // bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(long o); + // void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); + public static native void CResult_BlindedHopFeaturesDecodeErrorZ_free(long _res); + // uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_BlindedHopFeaturesDecodeErrorZ_clone(long orig); // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_ok(long o); // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); @@ -2940,30 +3099,6 @@ public class bindings { public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_clone(long orig); - // struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_ok(struct LDKOfferFeatures o); - public static native long CResult_OfferFeaturesDecodeErrorZ_ok(long o); - // struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_OfferFeaturesDecodeErrorZ_err(long e); - // bool CResult_OfferFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_OfferFeaturesDecodeErrorZ_is_ok(long o); - // void CResult_OfferFeaturesDecodeErrorZ_free(struct LDKCResult_OfferFeaturesDecodeErrorZ _res); - public static native void CResult_OfferFeaturesDecodeErrorZ_free(long _res); - // uint64_t CResult_OfferFeaturesDecodeErrorZ_clone_ptr(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_OfferFeaturesDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_clone(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_OfferFeaturesDecodeErrorZ_clone(long orig); - // struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(struct LDKInvoiceRequestFeatures o); - public static native long CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(long o); - // struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_InvoiceRequestFeaturesDecodeErrorZ_err(long e); - // bool CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(long o); - // void CResult_InvoiceRequestFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res); - public static native void CResult_InvoiceRequestFeaturesDecodeErrorZ_free(long _res); - // uint64_t CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(long orig); // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); public static native long CResult_NodeIdDecodeErrorZ_ok(long o); // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); @@ -2988,12 +3123,12 @@ public class bindings { public static native long CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_COption_NetworkUpdateZDecodeErrorZ_clone(long orig); - // struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); - public static native long COption_AccessZ_some(long o); - // struct LDKCOption_AccessZ COption_AccessZ_none(void); - public static native long COption_AccessZ_none(); - // void COption_AccessZ_free(struct LDKCOption_AccessZ _res); - public static native void COption_AccessZ_free(long _res); + // struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); + public static native long COption_UtxoLookupZ_some(long o); + // struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); + public static native long COption_UtxoLookupZ_none(); + // void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); + public static native void COption_UtxoLookupZ_free(long _res); // struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); public static native long CResult_boolLightningErrorZ_ok(boolean o); // struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); @@ -3198,38 +3333,6 @@ public class bindings { public static native long CResult_SignatureNoneZ_clone_ptr(long arg); // struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); public static native long CResult_SignatureNoneZ_clone(long orig); - // uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg); - public static native long C2Tuple_SignatureSignatureZ_clone_ptr(long arg); - // struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig); - public static native long C2Tuple_SignatureSignatureZ_clone(long orig); - // struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b); - public static native long C2Tuple_SignatureSignatureZ_new(byte[] a, byte[] b); - // void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res); - public static native void C2Tuple_SignatureSignatureZ_free(long _res); - // struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o); - public static native long CResult_C2Tuple_SignatureSignatureZNoneZ_ok(long o); - // struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void); - public static native long CResult_C2Tuple_SignatureSignatureZNoneZ_err(); - // bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o); - public static native boolean CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(long o); - // void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res); - public static native void CResult_C2Tuple_SignatureSignatureZNoneZ_free(long _res); - // uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg); - public static native long CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(long arg); - // struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig); - public static native long CResult_C2Tuple_SignatureSignatureZNoneZ_clone(long orig); - // struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o); - public static native long CResult_SecretKeyNoneZ_ok(byte[] o); - // struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void); - public static native long CResult_SecretKeyNoneZ_err(); - // bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o); - public static native boolean CResult_SecretKeyNoneZ_is_ok(long o); - // void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res); - public static native void CResult_SecretKeyNoneZ_free(long _res); - // uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg); - public static native long CResult_SecretKeyNoneZ_clone_ptr(long arg); - // struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig); - public static native long CResult_SecretKeyNoneZ_clone(long orig); // struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); public static native long CResult_PublicKeyNoneZ_ok(byte[] o); // struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); @@ -3260,18 +3363,6 @@ public class bindings { public static native long CResult_SharedSecretNoneZ_clone_ptr(long arg); // struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); public static native long CResult_SharedSecretNoneZ_clone(long orig); - // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); - public static native long CResult_SignDecodeErrorZ_ok(long o); - // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_SignDecodeErrorZ_err(long e); - // bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_SignDecodeErrorZ_is_ok(long o); - // void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); - public static native void CResult_SignDecodeErrorZ_free(long _res); - // uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_SignDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_SignDecodeErrorZ_clone(long orig); // void CVec_U5Z_free(struct LDKCVec_U5Z _res); public static native void CVec_U5Z_free(byte[] _res); // struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); @@ -3286,6 +3377,18 @@ public class bindings { public static native long CResult_RecoverableSignatureNoneZ_clone_ptr(long arg); // struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); public static native long CResult_RecoverableSignatureNoneZ_clone(long orig); + // struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o); + public static native long CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(long o); + // struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(long e); + // bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(long o); + // void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res); + public static native void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(long _res); + // uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(long orig); // void CVec_u8Z_free(struct LDKCVec_u8Z _res); public static native void CVec_u8Z_free(byte[] _res); // void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); @@ -3360,22 +3463,6 @@ public class bindings { public static native long COption_u16Z_clone_ptr(long arg); // struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); public static native long COption_u16Z_clone(long orig); - // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); - public static native long CResult_NoneAPIErrorZ_ok(); - // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); - public static native long CResult_NoneAPIErrorZ_err(long e); - // bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); - public static native boolean CResult_NoneAPIErrorZ_is_ok(long o); - // void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); - public static native void CResult_NoneAPIErrorZ_free(long _res); - // uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg); - public static native long CResult_NoneAPIErrorZ_clone_ptr(long arg); - // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); - public static native long CResult_NoneAPIErrorZ_clone(long orig); - // void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); - public static native void CVec_CResult_NoneAPIErrorZZ_free(long[] _res); - // void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); - public static native void CVec_APIErrorZ_free(long[] _res); // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); public static native long CResult__u832APIErrorZ_ok(byte[] o); // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); @@ -3388,6 +3475,8 @@ public class bindings { public static native long CResult__u832APIErrorZ_clone_ptr(long arg); // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); public static native long CResult__u832APIErrorZ_clone(long orig); + // void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); + public static native void CVec_RecentPaymentDetailsZ_free(long[] _res); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); public static native long CResult_NonePaymentSendFailureZ_ok(); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); @@ -3400,6 +3489,18 @@ public class bindings { public static native long CResult_NonePaymentSendFailureZ_clone_ptr(long arg); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); public static native long CResult_NonePaymentSendFailureZ_clone(long orig); + // struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); + public static native long CResult_NoneRetryableSendFailureZ_ok(); + // struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); + public static native long CResult_NoneRetryableSendFailureZ_err(RetryableSendFailure e); + // bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); + public static native boolean CResult_NoneRetryableSendFailureZ_is_ok(long o); + // void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); + public static native void CResult_NoneRetryableSendFailureZ_free(long _res); + // uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg); + public static native long CResult_NoneRetryableSendFailureZ_clone_ptr(long arg); + // struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); + public static native long CResult_NoneRetryableSendFailureZ_clone(long orig); // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); public static native long CResult_PaymentHashPaymentSendFailureZ_ok(byte[] o); // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); @@ -3412,6 +3513,18 @@ public class bindings { public static native long CResult_PaymentHashPaymentSendFailureZ_clone_ptr(long arg); // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); public static native long CResult_PaymentHashPaymentSendFailureZ_clone(long orig); + // struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); + public static native long CResult_PaymentHashRetryableSendFailureZ_ok(byte[] o); + // struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); + public static native long CResult_PaymentHashRetryableSendFailureZ_err(RetryableSendFailure e); + // bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o); + public static native boolean CResult_PaymentHashRetryableSendFailureZ_is_ok(long o); + // void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res); + public static native void CResult_PaymentHashRetryableSendFailureZ_free(long _res); + // uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg); + public static native long CResult_PaymentHashRetryableSendFailureZ_clone_ptr(long arg); + // struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig); + public static native long CResult_PaymentHashRetryableSendFailureZ_clone(long orig); // uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg); public static native long C2Tuple_PaymentHashPaymentIdZ_clone_ptr(long arg); // struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); @@ -3576,6 +3689,28 @@ public class bindings { public static native long CResult_ChannelConfigDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_ChannelConfigDecodeErrorZ_clone(long orig); + // struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); + public static native long COption_APIErrorZ_some(long o); + // struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); + public static native long COption_APIErrorZ_none(); + // void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res); + public static native void COption_APIErrorZ_free(long _res); + // uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg); + public static native long COption_APIErrorZ_clone_ptr(long arg); + // struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); + public static native long COption_APIErrorZ_clone(long orig); + // struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); + public static native long CResult_COption_APIErrorZDecodeErrorZ_ok(long o); + // struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_COption_APIErrorZDecodeErrorZ_err(long e); + // bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_COption_APIErrorZDecodeErrorZ_is_ok(long o); + // void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); + public static native void CResult_COption_APIErrorZDecodeErrorZ_free(long _res); + // uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_COption_APIErrorZDecodeErrorZ_clone(long orig); // struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); public static native long CResult_OutPointDecodeErrorZ_ok(long o); // struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); @@ -3812,6 +3947,16 @@ public class bindings { public static native long COption_NetAddressZ_clone_ptr(long arg); // struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); public static native long COption_NetAddressZ_clone(long orig); + // uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg); + public static native long C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(long arg); + // struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig); + public static native long C2Tuple_PublicKeyCOption_NetAddressZZ_clone(long orig); + // struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b); + public static native long C2Tuple_PublicKeyCOption_NetAddressZZ_new(byte[] a, long b); + // void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res); + public static native void C2Tuple_PublicKeyCOption_NetAddressZZ_free(long _res); + // void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res); + public static native void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(long[] _res); // struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); public static native long CResult_CVec_u8ZPeerHandleErrorZ_ok(byte[] o); // struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); @@ -3848,6 +3993,18 @@ public class bindings { public static native long CResult_boolPeerHandleErrorZ_clone_ptr(long arg); // struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); public static native long CResult_boolPeerHandleErrorZ_clone(long orig); + // struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); + public static native long CResult_TxOutUtxoLookupErrorZ_ok(long o); + // struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); + public static native long CResult_TxOutUtxoLookupErrorZ_err(UtxoLookupError e); + // bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); + public static native boolean CResult_TxOutUtxoLookupErrorZ_is_ok(long o); + // void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); + public static native void CResult_TxOutUtxoLookupErrorZ_free(long _res); + // uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg); + public static native long CResult_TxOutUtxoLookupErrorZ_clone_ptr(long arg); + // struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); + public static native long CResult_TxOutUtxoLookupErrorZ_clone(long orig); // struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); public static native long CResult_NoneSendErrorZ_ok(); // struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); @@ -4462,10 +4619,28 @@ public class bindings { public static native long PaymentPurpose_invoice_payment(byte[] payment_preimage, byte[] payment_secret); // struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); public static native long PaymentPurpose_spontaneous_payment(byte[] a); + // bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); + public static native boolean PaymentPurpose_eq(long a, long b); // struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); public static native byte[] PaymentPurpose_write(long obj); // struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); public static native long PaymentPurpose_read(byte[] ser); + // void PathFailure_free(struct LDKPathFailure this_ptr); + public static native void PathFailure_free(long this_ptr); + // uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg); + public static native long PathFailure_clone_ptr(long arg); + // struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); + public static native long PathFailure_clone(long orig); + // struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); + public static native long PathFailure_initial_send(long err); + // struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); + public static native long PathFailure_on_path(long network_update); + // bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); + public static native boolean PathFailure_eq(long a, long b); + // struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); + public static native byte[] PathFailure_write(long obj); + // struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); + public static native long PathFailure_read(byte[] ser); // void ClosureReason_free(struct LDKClosureReason this_ptr); public static native void ClosureReason_free(long this_ptr); // uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg); @@ -4532,8 +4707,8 @@ public class bindings { public static native long Event_payment_failed(byte[] payment_id, byte[] payment_hash); // struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); 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 payment_failed_permanently, 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 payment_failed_permanently, long network_update, boolean all_paths_failed, long[] path, long short_channel_id, long retry); + // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, 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 payment_failed_permanently, long failure, 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); @@ -4556,6 +4731,8 @@ public class bindings { 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); + // bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); + public static native boolean Event_eq(long a, long b); // 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); @@ -4594,6 +4771,8 @@ public class bindings { public static native long MessageSendEvent_broadcast_channel_announcement(long msg, long update_msg); // struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); public static native long MessageSendEvent_broadcast_channel_update(long msg); + // struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); + public static native long MessageSendEvent_broadcast_node_announcement(long msg); // struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); public static native long MessageSendEvent_send_channel_update(byte[] node_id, long msg); // struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); @@ -4634,6 +4813,10 @@ public class bindings { public static native long APIError_incompatible_shutdown_script(long script); // bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); public static native boolean APIError_eq(long a, long b); + // struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); + public static native byte[] APIError_write(long obj); + // struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); + public static native long APIError_read(byte[] ser); // void BigSize_free(struct LDKBigSize this_obj); public static native void BigSize_free(long this_obj); // uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr); @@ -4898,22 +5081,14 @@ public class bindings { public static native long BestBlock_clone(long orig); // bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b); public static native boolean BestBlock_eq(long a, long b); - // MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network); - public static native long BestBlock_from_genesis(Network network); + // MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network); + public static native long BestBlock_from_network(Network network); // MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height); public static native long BestBlock_new(byte[] block_hash, int height); // MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg); public static native byte[] BestBlock_block_hash(long this_arg); // MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); public static native int BestBlock_height(long this_arg); - // enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); - public static native AccessError AccessError_clone(long orig); - // enum LDKAccessError AccessError_unknown_chain(void); - public static native AccessError AccessError_unknown_chain(); - // enum LDKAccessError AccessError_unknown_tx(void); - public static native AccessError AccessError_unknown_tx(); - // void Access_free(struct LDKAccess this_ptr); - public static native void Access_free(long this_ptr); // void Listen_free(struct LDKListen this_ptr); public static native void Listen_free(long this_ptr); // void Confirm_free(struct LDKConfirm this_ptr); @@ -5116,8 +5291,8 @@ public class bindings { public static native long ChannelMonitor_current_best_block(long this_arg); // MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); public static native long[] ChannelMonitor_get_claimable_balances(long this_arg); - // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); - public static native long C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, long arg); + // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); + public static native long C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, long arg_a, long arg_b); // void OutPoint_free(struct LDKOutPoint this_obj); public static native void OutPoint_free(long this_obj); // const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; @@ -5234,22 +5409,28 @@ public class bindings { public static native byte[] SpendableOutputDescriptor_write(long obj); // struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); public static native long SpendableOutputDescriptor_read(byte[] ser); - // void BaseSign_free(struct LDKBaseSign this_ptr); - public static native void BaseSign_free(long this_ptr); - // uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg); - public static native long Sign_clone_ptr(long arg); - // struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); - public static native long Sign_clone(long orig); - // void Sign_free(struct LDKSign this_ptr); - public static native void Sign_free(long this_ptr); + // void ChannelSigner_free(struct LDKChannelSigner this_ptr); + public static native void ChannelSigner_free(long this_ptr); + // void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); + public static native void EcdsaChannelSigner_free(long this_ptr); + // uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg); + public static native long WriteableEcdsaChannelSigner_clone_ptr(long arg); + // struct LDKWriteableEcdsaChannelSigner WriteableEcdsaChannelSigner_clone(const struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR orig); + public static native long WriteableEcdsaChannelSigner_clone(long orig); + // void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr); + public static native void WriteableEcdsaChannelSigner_free(long this_ptr); // enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); public static native Recipient Recipient_clone(long orig); // enum LDKRecipient Recipient_node(void); public static native Recipient Recipient_node(); // enum LDKRecipient Recipient_phantom_node(void); public static native Recipient Recipient_phantom_node(); - // void KeysInterface_free(struct LDKKeysInterface this_ptr); - public static native void KeysInterface_free(long this_ptr); + // void EntropySource_free(struct LDKEntropySource this_ptr); + public static native void EntropySource_free(long this_ptr); + // void NodeSigner_free(struct LDKNodeSigner this_ptr); + public static native void NodeSigner_free(long this_ptr); + // void SignerProvider_free(struct LDKSignerProvider this_ptr); + public static native void SignerProvider_free(long this_ptr); // void InMemorySigner_free(struct LDKInMemorySigner this_obj); public static native void InMemorySigner_free(long this_obj); // const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; @@ -5280,8 +5461,8 @@ public class bindings { public static native long InMemorySigner_clone_ptr(long arg); // struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); public static native long InMemorySigner_clone(long orig); - // MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey node_secret, struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); - public static native long InMemorySigner_new(byte[] node_secret, byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id); + // MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + public static native long InMemorySigner_new(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id); // MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); public static native long InMemorySigner_counterparty_pubkeys(long this_arg); // MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -5300,34 +5481,58 @@ public class bindings { public static native long InMemorySigner_sign_counterparty_payment_input(long this_arg, byte[] spend_tx, long input_idx, long descriptor); // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); public static native long InMemorySigner_sign_dynamic_p2wsh_input(long this_arg, byte[] spend_tx, long input_idx, long descriptor); - // struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); - public static native long InMemorySigner_as_BaseSign(long this_arg); - // struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); - public static native long InMemorySigner_as_Sign(long this_arg); + // struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_as_ChannelSigner(long this_arg); + // struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_as_EcdsaChannelSigner(long this_arg); + // struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_as_WriteableEcdsaChannelSigner(long this_arg); // struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); public static native byte[] InMemorySigner_write(long obj); - // struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg); - public static native long InMemorySigner_read(byte[] ser, byte[] arg); + // struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); + public static native long InMemorySigner_read(byte[] ser); // void KeysManager_free(struct LDKKeysManager this_obj); public static native void KeysManager_free(long this_obj); // MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); public static native long KeysManager_new(byte[] seed, long starting_time_secs, int starting_time_nanos); + // MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); + public static native byte[] KeysManager_get_node_secret_key(long this_arg); // MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); public static native long KeysManager_derive_channel_keys(long this_arg, long channel_value_satoshis, byte[] params); // MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); public static native long KeysManager_spend_spendable_outputs(long this_arg, long[] descriptors, long[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight); - // struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); - public static native long KeysManager_as_KeysInterface(long this_arg); + // struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); + public static native long KeysManager_as_EntropySource(long this_arg); + // struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); + public static native long KeysManager_as_NodeSigner(long this_arg); + // struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); + public static native long KeysManager_as_SignerProvider(long this_arg); // void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); public static native void PhantomKeysManager_free(long this_obj); - // struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); - public static native long PhantomKeysManager_as_KeysInterface(long this_arg); + // struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + public static native long PhantomKeysManager_as_EntropySource(long this_arg); + // struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + public static native long PhantomKeysManager_as_NodeSigner(long this_arg); + // struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + public static native long PhantomKeysManager_as_SignerProvider(long this_arg); // MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32]); public static native long PhantomKeysManager_new(byte[] seed, long starting_time_secs, int starting_time_nanos, byte[] cross_node_seed); // MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); public static native long PhantomKeysManager_spend_spendable_outputs(long this_arg, long[] descriptors, long[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight); // MUST_USE_RES struct LDKInMemorySigner PhantomKeysManager_derive_channel_keys(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); public static native long PhantomKeysManager_derive_channel_keys(long this_arg, long channel_value_satoshis, byte[] params); + // MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + public static native byte[] PhantomKeysManager_get_node_secret_key(long this_arg); + // MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + public static native byte[] PhantomKeysManager_get_phantom_node_secret_key(long this_arg); + // enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig); + public static native FailureCode FailureCode_clone(long orig); + // enum LDKFailureCode FailureCode_temporary_node_failure(void); + public static native FailureCode FailureCode_temporary_node_failure(); + // enum LDKFailureCode FailureCode_required_node_feature_missing(void); + public static native FailureCode FailureCode_required_node_feature_missing(); + // enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); + public static native FailureCode FailureCode_incorrect_or_unknown_payment_details(); // void ChannelManager_free(struct LDKChannelManager this_obj); public static native void ChannelManager_free(long this_obj); // void ChainParameters_free(struct LDKChainParameters this_obj); @@ -5506,22 +5711,18 @@ public class bindings { public static native long ChannelDetails_get_inbound_payment_scid(long this_arg); // MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); public static native long ChannelDetails_get_outbound_payment_scid(long this_arg); - // void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); - public static native void PaymentSendFailure_free(long this_ptr); - // uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg); - public static native long PaymentSendFailure_clone_ptr(long arg); - // struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); - public static native long PaymentSendFailure_clone(long orig); - // struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); - public static native long PaymentSendFailure_parameter_error(long a); - // struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); - public static native long PaymentSendFailure_path_parameter_error(long[] a); - // struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); - public static native long PaymentSendFailure_all_failed_resend_safe(long[] a); - // struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); - public static native long PaymentSendFailure_duplicate_payment(); - // struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); - public static native long PaymentSendFailure_partial_failure(long[] results, long failed_paths_retry, byte[] payment_id); + // void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); + public static native void RecentPaymentDetails_free(long this_ptr); + // uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg); + public static native long RecentPaymentDetails_clone_ptr(long arg); + // struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); + public static native long RecentPaymentDetails_clone(long orig); + // struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); + public static native long RecentPaymentDetails_pending(byte[] payment_hash, long total_msat); + // struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_hash); + public static native long RecentPaymentDetails_fulfilled(byte[] payment_hash); + // struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash); + public static native long RecentPaymentDetails_abandoned(byte[] payment_hash); // void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); public static native void PhantomRouteHints_free(long this_obj); // struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); @@ -5542,8 +5743,8 @@ public class bindings { public static native long PhantomRouteHints_clone_ptr(long arg); // struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); public static native long PhantomRouteHints_clone(long orig); - // MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params); - public static native long ChannelManager_new(long fee_est, long chain_monitor, long tx_broadcaster, long logger, long keys_manager, long config, long params); + // MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params); + public static native long ChannelManager_new(long fee_est, long chain_monitor, long tx_broadcaster, long router, long logger, long entropy_source, long node_signer, long signer_provider, long config, long params); // MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_get_current_default_configuration(long this_arg); // MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config); @@ -5552,6 +5753,8 @@ public class bindings { public static native long[] ChannelManager_list_channels(long this_arg); // MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long[] ChannelManager_list_usable_channels(long this_arg); + // MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long[] ChannelManager_list_recent_payments(long this_arg); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); public static native long ChannelManager_close_channel(long this_arg, byte[] channel_id, byte[] counterparty_node_id); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight); @@ -5566,20 +5769,22 @@ public class bindings { public static native void ChannelManager_force_close_all_channels_without_broadcasting_txn(long this_arg); // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id); public static native long ChannelManager_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret, byte[] payment_id); - // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); - public static native long ChannelManager_retry_payment(long this_arg, long route, byte[] payment_id); + // MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); + public static native long ChannelManager_send_payment_with_retry(long this_arg, byte[] payment_hash, byte[] payment_secret, byte[] payment_id, long route_params, long retry_strategy); // void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); public static native void ChannelManager_abandon_payment(long this_arg, byte[] payment_id); // MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id); public static native long ChannelManager_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage, byte[] payment_id); + // MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); + public static native long ChannelManager_send_spontaneous_payment_with_retry(long this_arg, byte[] payment_preimage, byte[] payment_id, long route_params, long retry_strategy); // 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); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); public static native long ChannelManager_update_channel_config(long this_arg, byte[] counterparty_node_id, byte[][] channel_ids, long config); - // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const uint8_t (*next_hop_channel_id)[32], struct LDKPublicKey _next_node_id, uint64_t amt_to_forward_msat); - public static native long ChannelManager_forward_intercepted_htlc(long this_arg, byte[] intercept_id, byte[] next_hop_channel_id, byte[] _next_node_id, long amt_to_forward_msat); + // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const uint8_t (*next_hop_channel_id)[32], struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); + public static native long ChannelManager_forward_intercepted_htlc(long this_arg, byte[] intercept_id, byte[] next_hop_channel_id, byte[] next_node_id, long amt_to_forward_msat); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); public static native long ChannelManager_fail_intercepted_htlc(long this_arg, byte[] intercept_id); // void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -5588,6 +5793,8 @@ public class bindings { public static native void ChannelManager_timer_tick_occurred(long this_arg); // void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); public static native void ChannelManager_fail_htlc_backwards(long this_arg, byte[] payment_hash); + // void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code); + public static native void ChannelManager_fail_htlc_backwards_with_reason(long this_arg, byte[] payment_hash, FailureCode failure_code); // void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); public static native void ChannelManager_claim_funds(long this_arg, byte[] payment_preimage); // MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -5596,12 +5803,12 @@ public class bindings { public static native long ChannelManager_accept_inbound_channel(long this_arg, byte[] temporary_channel_id, byte[] counterparty_node_id, byte[] user_channel_id); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); public static native long ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(long this_arg, byte[] temporary_channel_id, byte[] counterparty_node_id, byte[] user_channel_id); - // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); - public static native long ChannelManager_create_inbound_payment(long this_arg, long min_value_msat, int invoice_expiry_delta_secs); + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long ChannelManager_create_inbound_payment(long this_arg, long min_value_msat, int invoice_expiry_delta_secs, long min_final_cltv_expiry_delta); // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); public static native long ChannelManager_create_inbound_payment_legacy(long this_arg, long min_value_msat, int invoice_expiry_delta_secs); - // MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); - public static native long ChannelManager_create_inbound_payment_for_hash(long this_arg, byte[] payment_hash, long min_value_msat, int invoice_expiry_delta_secs); + // MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); + public static native long ChannelManager_create_inbound_payment_for_hash(long this_arg, byte[] payment_hash, long min_value_msat, int invoice_expiry_delta_secs, long min_final_cltv_expiry); // MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); public static native long ChannelManager_create_inbound_payment_for_hash_legacy(long this_arg, byte[] payment_hash, long min_value_msat, int invoice_expiry_delta_secs); // MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); @@ -5630,14 +5837,18 @@ public class bindings { public static native long ChannelManager_get_persistable_update_future(long this_arg); // MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_current_best_block(long this_arg); + // MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_node_features(long this_arg); + // MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_channel_features(long this_arg); + // MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_channel_type_features(long this_arg); + // MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_init_features(long this_arg); // struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_ChannelMessageHandler(long this_arg); - // struct LDKNodeFeatures provided_node_features(void); - public static native long provided_node_features(); - // struct LDKChannelFeatures provided_channel_features(void); - public static native long provided_channel_features(); - // struct LDKInitFeatures provided_init_features(void); - public static native long provided_init_features(); + // struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR _config); + public static native long provided_init_features(long _config); // struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); public static native byte[] CounterpartyForwardingInfo_write(long obj); // struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); @@ -5658,10 +5869,18 @@ public class bindings { public static native byte[] ChannelManager_write(long obj); // void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); public static native void ChannelManagerReadArgs_free(long this_obj); - // const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); - public static native long ChannelManagerReadArgs_get_keys_manager(long this_ptr); - // void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); - public static native void ChannelManagerReadArgs_set_keys_manager(long this_ptr, long val); + // const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + public static native long ChannelManagerReadArgs_get_entropy_source(long this_ptr); + // void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); + public static native void ChannelManagerReadArgs_set_entropy_source(long this_ptr, long val); + // const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + public static native long ChannelManagerReadArgs_get_node_signer(long this_ptr); + // void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); + public static native void ChannelManagerReadArgs_set_node_signer(long this_ptr, long val); + // const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + public static native long ChannelManagerReadArgs_get_signer_provider(long this_ptr); + // void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); + public static native void ChannelManagerReadArgs_set_signer_provider(long this_ptr, long val); // const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); public static native long ChannelManagerReadArgs_get_fee_estimator(long this_ptr); // void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); @@ -5674,6 +5893,10 @@ public class bindings { public static native long ChannelManagerReadArgs_get_tx_broadcaster(long this_ptr); // void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); public static native void ChannelManagerReadArgs_set_tx_broadcaster(long this_ptr, long val); + // const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + public static native long ChannelManagerReadArgs_get_router(long this_ptr); + // void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); + public static native void ChannelManagerReadArgs_set_router(long this_ptr, long val); // const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); public static native long ChannelManagerReadArgs_get_logger(long this_ptr); // void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); @@ -5682,18 +5905,18 @@ public class bindings { public static native long ChannelManagerReadArgs_get_default_config(long this_ptr); // void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); public static native void ChannelManagerReadArgs_set_default_config(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); - public static native long ChannelManagerReadArgs_new(long keys_manager, long fee_estimator, long chain_monitor, long tx_broadcaster, long logger, long default_config, long[] channel_monitors); + // MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); + public static native long ChannelManagerReadArgs_new(long entropy_source, long node_signer, long signer_provider, long fee_estimator, long chain_monitor, long tx_broadcaster, long router, long logger, long default_config, long[] channel_monitors); // struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); public static native long C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, long arg); // void ExpandedKey_free(struct LDKExpandedKey this_obj); public static native void ExpandedKey_free(long this_obj); // MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); public static native long ExpandedKey_new(byte[] key_material); - // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKKeysInterface *NONNULL_PTR keys_manager, uint64_t current_time); - public static native long create(long keys, long min_value_msat, int invoice_expiry_delta_secs, long keys_manager, long current_time); - // struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time); - public static native long create_from_hash(long keys, long min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create(long keys, long min_value_msat, int invoice_expiry_delta_secs, long entropy_source, long current_time, long min_final_cltv_expiry_delta); + // struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create_from_hash(long keys, long min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time, long min_final_cltv_expiry_delta); // void DecodeError_free(struct LDKDecodeError this_ptr); public static native void DecodeError_free(long this_ptr); // uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg); @@ -6328,6 +6551,20 @@ public class bindings { public static native byte[] NetAddress_write(long obj); // struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); public static native long NetAddress_read(byte[] ser); + // void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); + public static native void UnsignedGossipMessage_free(long this_ptr); + // uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg); + public static native long UnsignedGossipMessage_clone_ptr(long arg); + // struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); + public static native long UnsignedGossipMessage_clone(long orig); + // struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); + public static native long UnsignedGossipMessage_channel_announcement(long a); + // struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); + public static native long UnsignedGossipMessage_channel_update(long a); + // struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); + public static native long UnsignedGossipMessage_node_announcement(long a); + // struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); + public static native byte[] UnsignedGossipMessage_write(long obj); // void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); public static native void UnsignedNodeAnnouncement_free(long this_obj); // struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); @@ -6338,10 +6575,10 @@ public class bindings { public static native int UnsignedNodeAnnouncement_get_timestamp(long this_ptr); // void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); public static native void UnsignedNodeAnnouncement_set_timestamp(long this_ptr, int val); - // struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); - public static native byte[] UnsignedNodeAnnouncement_get_node_id(long this_ptr); - // void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void UnsignedNodeAnnouncement_set_node_id(long this_ptr, byte[] val); + // struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); + public static native long UnsignedNodeAnnouncement_get_node_id(long this_ptr); + // void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void UnsignedNodeAnnouncement_set_node_id(long this_ptr, long val); // const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; public static native byte[] UnsignedNodeAnnouncement_get_rgb(long this_ptr); // void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); @@ -6392,22 +6629,22 @@ public class bindings { public static native long UnsignedChannelAnnouncement_get_short_channel_id(long this_ptr); // void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); public static native void UnsignedChannelAnnouncement_set_short_channel_id(long this_ptr, long val); - // struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); - public static native byte[] UnsignedChannelAnnouncement_get_node_id_1(long this_ptr); - // void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void UnsignedChannelAnnouncement_set_node_id_1(long this_ptr, byte[] val); - // struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); - public static native byte[] UnsignedChannelAnnouncement_get_node_id_2(long this_ptr); - // void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void UnsignedChannelAnnouncement_set_node_id_2(long this_ptr, byte[] val); - // struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); - public static native byte[] UnsignedChannelAnnouncement_get_bitcoin_key_1(long this_ptr); - // void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void UnsignedChannelAnnouncement_set_bitcoin_key_1(long this_ptr, byte[] val); - // struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); - public static native byte[] UnsignedChannelAnnouncement_get_bitcoin_key_2(long this_ptr); - // void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void UnsignedChannelAnnouncement_set_bitcoin_key_2(long this_ptr, byte[] val); + // struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + public static native long UnsignedChannelAnnouncement_get_node_id_1(long this_ptr); + // void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void UnsignedChannelAnnouncement_set_node_id_1(long this_ptr, long val); + // struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + public static native long UnsignedChannelAnnouncement_get_node_id_2(long this_ptr); + // void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void UnsignedChannelAnnouncement_set_node_id_2(long this_ptr, long val); + // struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + public static native long UnsignedChannelAnnouncement_get_bitcoin_key_1(long this_ptr); + // void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void UnsignedChannelAnnouncement_set_bitcoin_key_1(long this_ptr, long val); + // struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + public static native long UnsignedChannelAnnouncement_get_bitcoin_key_2(long this_ptr); + // void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void UnsignedChannelAnnouncement_set_bitcoin_key_2(long this_ptr, long val); // uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg); public static native long UnsignedChannelAnnouncement_clone_ptr(long arg); // struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); @@ -6886,22 +7123,18 @@ public class bindings { public static native void SocketDescriptor_free(long this_ptr); // void PeerHandleError_free(struct LDKPeerHandleError this_obj); public static native void PeerHandleError_free(long this_obj); - // bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); - public static native boolean PeerHandleError_get_no_connection_possible(long this_ptr); - // void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); - public static native void PeerHandleError_set_no_connection_possible(long this_ptr, boolean val); - // MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); - public static native long PeerHandleError_new(boolean no_connection_possible_arg); + // MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); + public static native long PeerHandleError_new(); // uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg); public static native long PeerHandleError_clone_ptr(long arg); // struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); public static native long PeerHandleError_clone(long orig); // void PeerManager_free(struct LDKPeerManager this_obj); public static native void PeerManager_free(long this_obj); - // MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler); - public static native long PeerManager_new(long message_handler, byte[] our_node_secret, int current_time, byte[] ephemeral_random_data, long logger, long custom_message_handler); - // MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); - public static native byte[][] PeerManager_get_peer_node_ids(long this_arg); + // MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler, struct LDKNodeSigner node_signer); + public static native long PeerManager_new(long message_handler, int current_time, byte[] ephemeral_random_data, long logger, long custom_message_handler, long node_signer); + // MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); + public static native long[] PeerManager_get_peer_node_ids(long this_arg); // MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); public static native long PeerManager_new_outbound_connection(long this_arg, byte[] their_node_id, long descriptor, long remote_network_address); // MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); @@ -6914,8 +7147,8 @@ public class bindings { public static native void PeerManager_process_events(long this_arg); // void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); public static native void PeerManager_socket_disconnected(long this_arg, long descriptor); - // void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); - public static native void PeerManager_disconnect_by_node_id(long this_arg, byte[] node_id, boolean no_connection_possible); + // void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); + public static native void PeerManager_disconnect_by_node_id(long this_arg, byte[] node_id); // void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); public static native void PeerManager_disconnect_all_peers(long this_arg); // void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); @@ -7298,6 +7531,10 @@ public class bindings { public static native boolean OfferFeatures_eq(long a, long b); // bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); public static native boolean InvoiceRequestFeatures_eq(long a, long b); + // bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b); + public static native boolean Bolt12InvoiceFeatures_eq(long a, long b); + // bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b); + public static native boolean BlindedHopFeatures_eq(long a, long b); // bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); public static native boolean ChannelTypeFeatures_eq(long a, long b); // uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg); @@ -7324,6 +7561,14 @@ public class bindings { public static native long InvoiceRequestFeatures_clone_ptr(long arg); // struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); public static native long InvoiceRequestFeatures_clone(long orig); + // uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg); + public static native long Bolt12InvoiceFeatures_clone_ptr(long arg); + // struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); + public static native long Bolt12InvoiceFeatures_clone(long orig); + // uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg); + public static native long BlindedHopFeatures_clone_ptr(long arg); + // struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); + public static native long BlindedHopFeatures_clone(long orig); // uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg); public static native long ChannelTypeFeatures_clone_ptr(long arg); // struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); @@ -7340,6 +7585,10 @@ public class bindings { public static native void OfferFeatures_free(long this_obj); // void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); public static native void InvoiceRequestFeatures_free(long this_obj); + // void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); + public static native void Bolt12InvoiceFeatures_free(long this_obj); + // void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); + public static native void BlindedHopFeatures_free(long this_obj); // void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); public static native void ChannelTypeFeatures_free(long this_obj); // MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); @@ -7366,6 +7615,14 @@ public class bindings { public static native long InvoiceRequestFeatures_empty(); // MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); public static native boolean InvoiceRequestFeatures_requires_unknown_bits(long this_arg); + // MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); + public static native long Bolt12InvoiceFeatures_empty(); + // MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + public static native boolean Bolt12InvoiceFeatures_requires_unknown_bits(long this_arg); + // MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); + public static native long BlindedHopFeatures_empty(); + // MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); + public static native boolean BlindedHopFeatures_requires_unknown_bits(long this_arg); // MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); public static native long ChannelTypeFeatures_empty(); // MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); @@ -7386,18 +7643,14 @@ public class bindings { public static native byte[] InvoiceFeatures_write(long obj); // struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); public static native long InvoiceFeatures_read(byte[] ser); + // struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); + public static native byte[] BlindedHopFeatures_write(long obj); + // struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); + public static native long BlindedHopFeatures_read(byte[] ser); // struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); public static native byte[] ChannelTypeFeatures_write(long obj); // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); public static native long ChannelTypeFeatures_read(byte[] ser); - // struct LDKCVec_u8Z OfferFeatures_write(const struct LDKOfferFeatures *NONNULL_PTR obj); - public static native byte[] OfferFeatures_write(long obj); - // struct LDKCResult_OfferFeaturesDecodeErrorZ OfferFeatures_read(struct LDKu8slice ser); - public static native long OfferFeatures_read(byte[] ser); - // struct LDKCVec_u8Z InvoiceRequestFeatures_write(const struct LDKInvoiceRequestFeatures *NONNULL_PTR obj); - public static native byte[] InvoiceRequestFeatures_write(long obj); - // struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ InvoiceRequestFeatures_read(struct LDKu8slice ser); - public static native long InvoiceRequestFeatures_read(byte[] ser); // void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); public static native void InitFeatures_set_data_loss_protect_optional(long this_arg); // void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); @@ -7542,12 +7795,20 @@ public class bindings { public static native void InvoiceFeatures_set_basic_mpp_required(long this_arg); // MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); public static native boolean InvoiceFeatures_supports_basic_mpp(long this_arg); + // void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + public static native void Bolt12InvoiceFeatures_set_basic_mpp_optional(long this_arg); + // void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + public static native void Bolt12InvoiceFeatures_set_basic_mpp_required(long this_arg); + // MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + public static native boolean Bolt12InvoiceFeatures_supports_basic_mpp(long this_arg); // MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); public static native boolean InitFeatures_requires_basic_mpp(long this_arg); // MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); public static native boolean NodeFeatures_requires_basic_mpp(long this_arg); // MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); public static native boolean InvoiceFeatures_requires_basic_mpp(long this_arg); + // MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + public static native boolean Bolt12InvoiceFeatures_requires_basic_mpp(long this_arg); // void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); public static native void InitFeatures_set_wumbo_optional(long this_arg); // void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); @@ -7564,6 +7825,30 @@ public class bindings { public static native boolean InitFeatures_requires_wumbo(long this_arg); // MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); public static native boolean NodeFeatures_requires_wumbo(long this_arg); + // void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + public static native void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(long this_arg); + // void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + public static native void InitFeatures_set_anchors_zero_fee_htlc_tx_required(long this_arg); + // MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); + public static native boolean InitFeatures_supports_anchors_zero_fee_htlc_tx(long this_arg); + // void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + public static native void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(long this_arg); + // void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + public static native void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(long this_arg); + // MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + public static native boolean NodeFeatures_supports_anchors_zero_fee_htlc_tx(long this_arg); + // void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + public static native void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(long this_arg); + // void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + public static native void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(long this_arg); + // MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + public static native boolean ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(long this_arg); + // MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); + public static native boolean InitFeatures_requires_anchors_zero_fee_htlc_tx(long this_arg); + // MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + public static native boolean NodeFeatures_requires_anchors_zero_fee_htlc_tx(long this_arg); + // MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + public static native boolean ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(long this_arg); // void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); public static native void InitFeatures_set_shutdown_any_segwit_optional(long this_arg); // void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); @@ -7704,6 +7989,44 @@ public class bindings { public static native byte[] ShutdownScript_as_legacy_pubkey(long this_arg); // MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); public static native boolean ShutdownScript_is_compatible(long this_arg, long features); + // void Retry_free(struct LDKRetry this_ptr); + public static native void Retry_free(long this_ptr); + // uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg); + public static native long Retry_clone_ptr(long arg); + // struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); + public static native long Retry_clone(long orig); + // struct LDKRetry Retry_attempts(uintptr_t a); + public static native long Retry_attempts(long a); + // struct LDKRetry Retry_timeout(uint64_t a); + public static native long Retry_timeout(long a); + // bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); + public static native boolean Retry_eq(long a, long b); + // uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); + public static native long Retry_hash(long o); + // enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); + public static native RetryableSendFailure RetryableSendFailure_clone(long orig); + // enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); + public static native RetryableSendFailure RetryableSendFailure_payment_expired(); + // enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); + public static native RetryableSendFailure RetryableSendFailure_route_not_found(); + // enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); + public static native RetryableSendFailure RetryableSendFailure_duplicate_payment(); + // void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); + public static native void PaymentSendFailure_free(long this_ptr); + // uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg); + public static native long PaymentSendFailure_clone_ptr(long arg); + // struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); + public static native long PaymentSendFailure_clone(long orig); + // struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); + public static native long PaymentSendFailure_parameter_error(long a); + // struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); + public static native long PaymentSendFailure_path_parameter_error(long[] a); + // struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); + public static native long PaymentSendFailure_all_failed_resend_safe(long[] a); + // struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); + public static native long PaymentSendFailure_duplicate_payment(); + // struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); + public static native long PaymentSendFailure_partial_failure(long[] results, long failed_paths_retry, byte[] payment_id); // void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); public static native void CustomMessageReader_free(long this_ptr); // uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg); @@ -7712,6 +8035,36 @@ public class bindings { public static native long Type_clone(long orig); // void Type_free(struct LDKType this_ptr); public static native void Type_free(long this_ptr); + // enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); + public static native UtxoLookupError UtxoLookupError_clone(long orig); + // enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); + public static native UtxoLookupError UtxoLookupError_unknown_chain(); + // enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); + public static native UtxoLookupError UtxoLookupError_unknown_tx(); + // void UtxoResult_free(struct LDKUtxoResult this_ptr); + public static native void UtxoResult_free(long this_ptr); + // uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg); + public static native long UtxoResult_clone_ptr(long arg); + // struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); + public static native long UtxoResult_clone(long orig); + // struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); + public static native long UtxoResult_sync(long a); + // struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); + public static native long UtxoResult_async(long a); + // void UtxoLookup_free(struct LDKUtxoLookup this_ptr); + public static native void UtxoLookup_free(long this_ptr); + // void UtxoFuture_free(struct LDKUtxoFuture this_obj); + public static native void UtxoFuture_free(long this_obj); + // uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg); + public static native long UtxoFuture_clone_ptr(long arg); + // struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); + public static native long UtxoFuture_clone(long orig); + // MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); + public static native long UtxoFuture_new(); + // void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); + public static native void UtxoFuture_resolve_without_forwarding(long this_arg, long graph, long result); + // void UtxoFuture_resolve(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, const struct LDKP2PGossipSync *NONNULL_PTR gossip, struct LDKCResult_TxOutUtxoLookupErrorZ result); + public static native void UtxoFuture_resolve(long this_arg, long graph, long gossip, long result); // void NodeId_free(struct LDKNodeId this_obj); public static native void NodeId_free(long this_obj); // uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg); @@ -7752,10 +8105,10 @@ public class bindings { public static native long NetworkUpdate_read(byte[] ser); // void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); public static native void P2PGossipSync_free(long this_obj); - // MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); - public static native long P2PGossipSync_new(long network_graph, long chain_access, long logger); - // void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); - public static native void P2PGossipSync_add_chain_access(long this_arg, long chain_access); + // MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger); + public static native long P2PGossipSync_new(long network_graph, long utxo_lookup, long logger); + // void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); + public static native void P2PGossipSync_add_utxo_lookup(long this_arg, long utxo_lookup); // void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); public static native void NetworkGraph_handle_network_update(long this_arg, long network_update); // struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); @@ -7962,16 +8315,12 @@ public class bindings { public static native long[] NodeInfo_get_channels(long this_ptr); // void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); public static native void NodeInfo_set_channels(long this_ptr, long[] val); - // struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); - public static native long NodeInfo_get_lowest_inbound_channel_fees(long this_ptr); - // void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - public static native void NodeInfo_set_lowest_inbound_channel_fees(long this_ptr, long val); // struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); public static native long NodeInfo_get_announcement_info(long this_ptr); // void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); public static native void NodeInfo_set_announcement_info(long this_ptr, long val); - // MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); - public static native long NodeInfo_new(long[] channels_arg, long lowest_inbound_channel_fees_arg, long announcement_info_arg); + // MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); + public static native long NodeInfo_new(long[] channels_arg, long announcement_info_arg); // uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg); public static native long NodeInfo_clone_ptr(long arg); // struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); @@ -7986,8 +8335,8 @@ public class bindings { public static native byte[] NetworkGraph_write(long obj); // struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); public static native long NetworkGraph_read(byte[] ser, long arg); - // MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger); - public static native long NetworkGraph_new(byte[] genesis_hash, long logger); + // MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); + public static native long NetworkGraph_new(Network network, long logger); // MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); public static native long NetworkGraph_read_only(long this_arg); // MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); @@ -7998,10 +8347,10 @@ public class bindings { public static native long NetworkGraph_update_node_from_announcement(long this_arg, long msg); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); public static native long NetworkGraph_update_node_from_unsigned_announcement(long this_arg, long msg); - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); - public static native long NetworkGraph_update_channel_from_announcement(long this_arg, long msg, long chain_access); - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); - public static native long NetworkGraph_update_channel_from_unsigned_announcement(long this_arg, long msg, long chain_access); + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); + public static native long NetworkGraph_update_channel_from_announcement(long this_arg, long msg, long utxo_lookup); + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); + public static native long NetworkGraph_update_channel_from_unsigned_announcement(long this_arg, long msg, long utxo_lookup); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2); public static native long NetworkGraph_add_channel_from_partial_announcement(long this_arg, long short_channel_id, long timestamp, long features, byte[] node_id_1, byte[] node_id_2); // void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); @@ -8036,7 +8385,7 @@ public class bindings { public static native void Router_free(long this_ptr); // void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); public static native void ScorerAccountingForInFlightHtlcs_free(long this_obj); - // MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, struct LDKInFlightHtlcs inflight_htlcs); + // MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); public static native long ScorerAccountingForInFlightHtlcs_new(long scorer, long inflight_htlcs); // struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj); public static native byte[] ScorerAccountingForInFlightHtlcs_write(long obj); @@ -8134,16 +8483,14 @@ public class bindings { public static native long RouteParameters_get_final_value_msat(long this_ptr); // void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void RouteParameters_set_final_value_msat(long this_ptr, long val); - // uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr); - public static native int RouteParameters_get_final_cltv_expiry_delta(long this_ptr); - // void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val); - public static native void RouteParameters_set_final_cltv_expiry_delta(long this_ptr, int val); - // MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg); - public static native long RouteParameters_new(long payment_params_arg, long final_value_msat_arg, int final_cltv_expiry_delta_arg); + // MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg); + public static native long RouteParameters_new(long payment_params_arg, long final_value_msat_arg); // uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg); public static native long RouteParameters_clone_ptr(long arg); // struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); public static native long RouteParameters_clone(long orig); + // bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); + public static native boolean RouteParameters_eq(long a, long b); // struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); public static native byte[] RouteParameters_write(long obj); // struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); @@ -8182,8 +8529,12 @@ public class bindings { public static native long[] PaymentParameters_get_previously_failed_channels(long this_ptr); // 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); + // uint32_t PaymentParameters_get_final_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native int PaymentParameters_get_final_cltv_expiry_delta(long this_ptr); + // void PaymentParameters_set_final_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); + public static native void PaymentParameters_set_final_cltv_expiry_delta(long this_ptr, int 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, uint32_t final_cltv_expiry_delta_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, int final_cltv_expiry_delta_arg); // uint64_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); @@ -8194,12 +8545,12 @@ public class bindings { public static native boolean PaymentParameters_eq(long a, long b); // struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); public static native byte[] PaymentParameters_write(long obj); - // struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser); - public static native long PaymentParameters_read(byte[] ser); - // MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey); - public static native long PaymentParameters_from_node_id(byte[] payee_pubkey); - // MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey); - public static native long PaymentParameters_for_keysend(byte[] payee_pubkey); + // struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); + public static native long PaymentParameters_read(byte[] ser, int arg); + // MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); + public static native long PaymentParameters_from_node_id(byte[] payee_pubkey, int final_cltv_expiry_delta); + // MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); + public static native long PaymentParameters_for_keysend(byte[] payee_pubkey, int final_cltv_expiry_delta); // void RouteHint_free(struct LDKRouteHint this_obj); public static native void RouteHint_free(long this_obj); // struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); @@ -8374,6 +8725,8 @@ public class bindings { public static native void ProbabilisticScorer_debug_log_liquidity_stats(long this_arg); // MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); public static native long ProbabilisticScorer_estimated_channel_liquidity_range(long this_arg, long scid, long target); + // MUST_USE_RES struct LDKCOption_C2Tuple_EightU16sEightU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); + public static native long ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(long this_arg, long scid, long target); // void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); 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); @@ -8406,8 +8759,8 @@ public class bindings { public static native long BlindedHop_clone_ptr(long arg); // struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); public static native long BlindedHop_clone(long orig); - // MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager); - public static native long BlindedPath_new(byte[][] node_pks, long keys_manager); + // MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); + public static native long BlindedPath_new(byte[][] node_pks, long entropy_source); // struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj); public static native byte[] BlindedPath_write(long obj); // struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser); @@ -8454,8 +8807,8 @@ public class bindings { public static native boolean SendError_eq(long a, long b); // void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); public static native void CustomOnionMessageHandler_free(long this_ptr); - // MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); - public static native long OnionMessenger_new(long keys_manager, long logger, long custom_handler); + // MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); + public static native long OnionMessenger_new(long entropy_source, long node_signer, long logger, long custom_handler); // MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); public static native long OnionMessenger_send_onion_message(long this_arg, byte[][] intermediate_nodes, long destination, long message, long reply_path); // struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); @@ -8482,8 +8835,8 @@ public class bindings { public static native long FilesystemPersister_new(String path_to_channel_data); // MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg); public static native String FilesystemPersister_get_data_dir(long this_arg); - // MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager); - public static native long FilesystemPersister_read_channelmonitors(long this_arg, long keys_manager); + // MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKEntropySource entropy_source, const struct LDKSignerProvider *NONNULL_PTR signer_provider); + public static native long FilesystemPersister_read_channelmonitors(long this_arg, long entropy_source, long signer_provider); // void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj); public static native void BackgroundProcessor_free(long this_obj); // void GossipSync_free(struct LDKGossipSync this_ptr); @@ -8692,22 +9045,22 @@ public class bindings { public static native long ExpiryTime_hash(long o); // bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b); public static native boolean ExpiryTime_eq(long a, long b); - // void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj); - public static native void MinFinalCltvExpiry_free(long this_obj); - // uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr); - public static native long MinFinalCltvExpiry_get_a(long this_ptr); - // void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val); - public static native void MinFinalCltvExpiry_set_a(long this_ptr, long val); - // MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg); - public static native long MinFinalCltvExpiry_new(long a_arg); - // uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg); - public static native long MinFinalCltvExpiry_clone_ptr(long arg); - // struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig); - public static native long MinFinalCltvExpiry_clone(long orig); - // uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o); - public static native long MinFinalCltvExpiry_hash(long o); - // bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b); - public static native boolean MinFinalCltvExpiry_eq(long a, long b); + // void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj); + public static native void MinFinalCltvExpiryDelta_free(long this_obj); + // uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr); + public static native long MinFinalCltvExpiryDelta_get_a(long this_ptr); + // void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val); + public static native void MinFinalCltvExpiryDelta_set_a(long this_ptr, long val); + // MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg); + public static native long MinFinalCltvExpiryDelta_new(long a_arg); + // uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg); + public static native long MinFinalCltvExpiryDelta_clone_ptr(long arg); + // struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig); + public static native long MinFinalCltvExpiryDelta_clone(long orig); + // uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o); + public static native long MinFinalCltvExpiryDelta_hash(long o); + // bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b); + public static native boolean MinFinalCltvExpiryDelta_eq(long a, long b); // void Fallback_free(struct LDKFallback this_ptr); public static native void Fallback_free(long this_ptr); // uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg); @@ -8768,8 +9121,8 @@ public class bindings { public static native long RawInvoice_description_hash(long this_arg); // MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg); public static native long RawInvoice_expiry_time(long this_arg); - // MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg); - public static native long RawInvoice_min_final_cltv_expiry(long this_arg); + // MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawInvoice_min_final_cltv_expiry_delta(const struct LDKRawInvoice *NONNULL_PTR this_arg); + public static native long RawInvoice_min_final_cltv_expiry_delta(long this_arg); // MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg); public static native byte[] RawInvoice_payment_secret(long this_arg); // MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg); @@ -8818,8 +9171,8 @@ public class bindings { public static native boolean Invoice_is_expired(long this_arg); // MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time); public static native boolean Invoice_would_expire(long this_arg, long at_time); - // MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg); - public static native long Invoice_min_final_cltv_expiry(long this_arg); + // MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry_delta(const struct LDKInvoice *NONNULL_PTR this_arg); + public static native long Invoice_min_final_cltv_expiry_delta(long this_arg); // MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg); public static native long[] Invoice_private_routes(long this_arg); // MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg); @@ -8856,6 +9209,8 @@ public class bindings { public static native CreationError CreationError_invalid_amount(); // enum LDKCreationError CreationError_missing_route_hints(void); public static native CreationError CreationError_missing_route_hints(); + // enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void); + public static native CreationError CreationError_min_final_cltv_expiry_delta_too_short(); // bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b); public static native boolean CreationError_eq(long a, long b); // struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o); @@ -8900,24 +9255,14 @@ public class bindings { public static native boolean SignOrCreationError_eq(long a, long b); // struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); public static native String SignOrCreationError_to_str(long o); - // void InvoicePayer_free(struct LDKInvoicePayer this_obj); - public static native void InvoicePayer_free(long this_obj); - // void Payer_free(struct LDKPayer this_ptr); - public static native void Payer_free(long this_ptr); - // void Retry_free(struct LDKRetry this_ptr); - public static native void Retry_free(long this_ptr); - // uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg); - public static native long Retry_clone_ptr(long arg); - // struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); - public static native long Retry_clone(long orig); - // struct LDKRetry Retry_attempts(uintptr_t a); - public static native long Retry_attempts(long a); - // struct LDKRetry Retry_timeout(uint64_t a); - public static native long Retry_timeout(long a); - // bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); - public static native boolean Retry_eq(long a, long b); - // uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); - public static native long Retry_hash(long o); + // struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); + public static native long pay_invoice(long invoice, long retry_strategy, long channelmanager); + // struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); + public static native long pay_invoice_with_id(long invoice, byte[] payment_id, long retry_strategy, long channelmanager); + // struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); + public static native long pay_zero_value_invoice(long invoice, long amount_msats, long retry_strategy, long channelmanager); + // struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); + public static native long pay_zero_value_invoice_with_id(long invoice, long amount_msats, byte[] payment_id, long retry_strategy, long channelmanager); // void PaymentError_free(struct LDKPaymentError this_ptr); public static native void PaymentError_free(long this_ptr); // uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg); @@ -8926,44 +9271,22 @@ public class bindings { public static native long PaymentError_clone(long orig); // struct LDKPaymentError PaymentError_invoice(struct LDKStr a); public static native long PaymentError_invoice(String a); - // struct LDKPaymentError PaymentError_routing(struct LDKLightningError a); - public static native long PaymentError_routing(long a); - // struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a); - public static native long PaymentError_sending(long a); - // MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry); - public static native long InvoicePayer_new(long payer, long router, long logger, long event_handler, long retry); - // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice); - public static native long InvoicePayer_pay_invoice(long this_arg, long invoice); - // MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id); - public static native long InvoicePayer_pay_invoice_with_id(long this_arg, long invoice, byte[] payment_id); - // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats); - public static native long InvoicePayer_pay_zero_value_invoice(long this_arg, long invoice, long amount_msats); - // MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_zero_value_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); - public static native long InvoicePayer_pay_zero_value_invoice_with_id(long this_arg, long invoice, long amount_msats, byte[] payment_id); - // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); - public static native long InvoicePayer_pay_pubkey(long this_arg, byte[] pubkey, byte[] payment_preimage, long amount_msats, int final_cltv_expiry_delta); - // MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_pubkey_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); - public static native long InvoicePayer_pay_pubkey_with_id(long this_arg, byte[] pubkey, byte[] payment_preimage, byte[] payment_id, long amount_msats, int final_cltv_expiry_delta); - // void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); - public static native void InvoicePayer_remove_cached_payment(long this_arg, byte[] payment_hash); - // struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg); - public static native long InvoicePayer_as_EventHandler(long this_arg); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network); - public static native long create_phantom_invoice(long amt_msat, byte[] payment_hash, String description, int invoice_expiry_delta_secs, long[] phantom_route_hints, long keys_manager, long logger, Currency network); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network); - public static native long create_phantom_invoice_with_description_hash(long amt_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long description_hash, long[] phantom_route_hints, long keys_manager, long logger, Currency network); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs); - public static native long create_invoice_from_channelmanager(long channelmanager, long keys_manager, long logger, Currency network, long amt_msat, String description, int invoice_expiry_delta_secs); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs); - public static native long create_invoice_from_channelmanager_with_description_hash(long channelmanager, long keys_manager, long logger, Currency network, long amt_msat, long description_hash, int invoice_expiry_delta_secs); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs); - public static native long create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(long channelmanager, long keys_manager, long logger, Currency network, long amt_msat, long description_hash, long duration_since_epoch, int invoice_expiry_delta_secs); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs); - public static native long create_invoice_from_channelmanager_and_duration_since_epoch(long channelmanager, long keys_manager, long logger, Currency network, long amt_msat, String description, long duration_since_epoch, int invoice_expiry_delta_secs); - // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash); - public static native long create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(long channelmanager, long keys_manager, long logger, Currency network, long amt_msat, String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash); - // struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg); - public static native long ChannelManager_as_Payer(long this_arg); + // struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a); + public static native long PaymentError_sending(RetryableSendFailure a); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); + public static native long create_phantom_invoice(long amt_msat, byte[] payment_hash, String description, int invoice_expiry_delta_secs, long[] phantom_route_hints, long entropy_source, long node_signer, long logger, Currency network, long min_final_cltv_expiry_delta, long duration_since_epoch); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); + public static native long create_phantom_invoice_with_description_hash(long amt_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long description_hash, long[] phantom_route_hints, long entropy_source, long node_signer, long logger, Currency network, long min_final_cltv_expiry_delta, long duration_since_epoch); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create_invoice_from_channelmanager(long channelmanager, long node_signer, long logger, Currency network, long amt_msat, String description, int invoice_expiry_delta_secs, long min_final_cltv_expiry_delta); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create_invoice_from_channelmanager_with_description_hash(long channelmanager, long node_signer, long logger, Currency network, long amt_msat, long description_hash, int invoice_expiry_delta_secs, long min_final_cltv_expiry_delta); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(long channelmanager, long node_signer, long logger, Currency network, long amt_msat, long description_hash, long duration_since_epoch, int invoice_expiry_delta_secs, long min_final_cltv_expiry_delta); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create_invoice_from_channelmanager_and_duration_since_epoch(long channelmanager, long node_signer, long logger, Currency network, long amt_msat, String description, long duration_since_epoch, int invoice_expiry_delta_secs, long min_final_cltv_expiry_delta); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta); + public static native long create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(long channelmanager, long node_signer, long logger, Currency network, long amt_msat, String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash, long min_final_cltv_expiry_delta); // struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s); public static native long SiPrefix_from_str(String s); // struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s); @@ -8984,10 +9307,12 @@ public class bindings { public static native String SiPrefix_to_str(long o); // void RapidGossipSync_free(struct LDKRapidGossipSync this_obj); public static native void RapidGossipSync_free(long this_obj); - // MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph); - public static native long RapidGossipSync_new(long network_graph); + // MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); + public static native long RapidGossipSync_new(long network_graph, long logger); // MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data); public static native long RapidGossipSync_update_network_graph(long this_arg, byte[] update_data); + // MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph_no_std(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data, struct LDKCOption_u64Z current_time_unix); + public static native long RapidGossipSync_update_network_graph_no_std(long this_arg, byte[] update_data, long current_time_unix); // MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg); public static native boolean RapidGossipSync_is_initial_sync_complete(long this_arg); // void GraphSyncError_free(struct LDKGraphSyncError this_ptr); diff --git a/src/main/java/org/ldk/structs/APIError.java b/src/main/java/org/ldk/structs/APIError.java index 2ff70592..4bb9968b 100644 --- a/src/main/java/org/ldk/structs/APIError.java +++ b/src/main/java/org/ldk/structs/APIError.java @@ -122,13 +122,13 @@ public class APIError extends CommonBase { } } /** - * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible * with the channel counterparty as negotiated in [`InitFeatures`]. * * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open * a channel or cooperatively close one with this peer (and will have to force-close instead). * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey * [`InitFeatures`]: crate::ln::features::InitFeatures */ public final static class IncompatibleShutdownScript extends APIError { @@ -250,4 +250,13 @@ public class APIError extends CommonBase { if (!(o instanceof APIError)) return false; return this.eq((APIError)o); } + /** + * Serialize the APIError object into a byte array which can be read by APIError_read + */ + public byte[] write() { + byte[] ret = bindings.APIError_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/AcceptChannel.java b/src/main/java/org/ldk/structs/AcceptChannel.java index fd6f23b0..66bafbaf 100644 --- a/src/main/java/org/ldk/structs/AcceptChannel.java +++ b/src/main/java/org/ldk/structs/AcceptChannel.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An accept_channel message to be sent or received from a peer + * An [`accept_channel`] message to be sent to or received from a peer. + * + * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class AcceptChannel extends CommonBase { @@ -273,10 +275,10 @@ public class AcceptChannel extends CommonBase { } /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent. * + * If this is `None`, we derive the channel type from the intersection of + * our feature bits with our counterparty's feature bits from the [`Init`] message. * This is required to match the equivalent field in [`OpenChannel::channel_type`]. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -292,10 +294,10 @@ public class AcceptChannel extends CommonBase { } /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent. * + * If this is `None`, we derive the channel type from the intersection of + * our feature bits with our counterparty's feature bits from the [`Init`] message. * This is required to match the equivalent field in [`OpenChannel::channel_type`]. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None diff --git a/src/main/java/org/ldk/structs/Access.java b/src/main/java/org/ldk/structs/Access.java deleted file mode 100644 index 169e9015..00000000 --- a/src/main/java/org/ldk/structs/Access.java +++ /dev/null @@ -1,68 +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; - -/** - * The `Access` trait defines behavior for accessing chain data and state, such as blocks and - * UTXOs. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Access extends CommonBase { - final bindings.LDKAccess bindings_instance; - Access(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private Access(bindings.LDKAccess arg) { - super(bindings.LDKAccess_new(arg)); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.Access_free(ptr); } super.finalize(); - } - - public static interface AccessInterface { - /** - * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. - * - * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id - */ - Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id); - } - private static class LDKAccessHolder { Access held; } - public static Access new_impl(AccessInterface arg) { - final LDKAccessHolder impl_holder = new LDKAccessHolder(); - impl_holder.held = new Access(new bindings.LDKAccess() { - @Override public long get_utxo(byte[] genesis_hash, long short_channel_id) { - Result_TxOutAccessErrorZ ret = arg.get_utxo(genesis_hash, short_channel_id); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - }); - return impl_holder.held; - } - /** - * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. - * - * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id - */ - public Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id) { - long ret = bindings.Access_get_utxo(this.ptr, InternalUtils.check_arr_len(genesis_hash, 32), short_channel_id); - Reference.reachabilityFence(this); - Reference.reachabilityFence(genesis_hash); - Reference.reachabilityFence(short_channel_id); - if (ret >= 0 && ret <= 4096) { return null; } - Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/AnnouncementSignatures.java b/src/main/java/org/ldk/structs/AnnouncementSignatures.java index 66c5e2f9..4bc5677c 100644 --- a/src/main/java/org/ldk/structs/AnnouncementSignatures.java +++ b/src/main/java/org/ldk/structs/AnnouncementSignatures.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An announcement_signatures message to be sent or received from a peer + * An [`announcement_signatures`] message to be sent to or received from a peer. + * + * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class AnnouncementSignatures extends CommonBase { diff --git a/src/main/java/org/ldk/structs/BackgroundProcessor.java b/src/main/java/org/ldk/structs/BackgroundProcessor.java index bba09837..5762eb0d 100644 --- a/src/main/java/org/ldk/structs/BackgroundProcessor.java +++ b/src/main/java/org/ldk/structs/BackgroundProcessor.java @@ -107,6 +107,7 @@ public class BackgroundProcessor extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(event_handler); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(chain_monitor); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(gossip_sync); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(peer_manager); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); }; diff --git a/src/main/java/org/ldk/structs/BaseSign.java b/src/main/java/org/ldk/structs/BaseSign.java deleted file mode 100644 index ec7aa54a..00000000 --- a/src/main/java/org/ldk/structs/BaseSign.java +++ /dev/null @@ -1,612 +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 trait to sign Lightning channel transactions as described in - * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). - * - * Signing services could be implemented on a hardware wallet and should implement signing - * policies in order to be secure. Please refer to the [VLS Policy - * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) - * for an example of such policies. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class BaseSign extends CommonBase { - final bindings.LDKBaseSign bindings_instance; - BaseSign(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private BaseSign(bindings.LDKBaseSign arg, ChannelPublicKeys pubkeys) { - super(bindings.LDKBaseSign_new(arg, pubkeys == null ? 0 : pubkeys.clone_ptr())); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.BaseSign_free(ptr); } super.finalize(); - } - - public static interface BaseSignInterface { - /** - * Gets the per-commitment point for a specific commitment number - * - * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. - */ - byte[] get_per_commitment_point(long idx); - /** - * Gets the commitment secret for a specific commitment number as part of the revocation process - * - * An external signer implementation should error here if the commitment was already signed - * and should refuse to sign it in the future. - * - * May be called more than once for the same index. - * - * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. - */ - byte[] release_commitment_secret(long idx); - /** - * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. - * - * This is required in order for the signer to make sure that releasing a commitment - * secret won't leave us without a broadcastable holder transaction. - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * Note that all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. - */ - Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages); - /** - * Returns an arbitrary identifier describing the set of keys which are provided back to you in - * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this - * [`BaseSign`] object uniquely and lookup or re-derive its keys. - */ - byte[] channel_keys_id(); - /** - * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. - * - * Note that if signing fails or is rejected, the channel will be force-closed. - * - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * Note that all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. - */ - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] preimages); - /** - * Validate the counterparty's revocation. - * - * This is required in order for the signer to make sure that the state has moved - * forward and it is safe to sign the next counterparty commitment. - */ - Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret); - /** - * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. - * - * This will be called - * - with a non-revoked `commitment_tx`. - * - with the latest `commitment_tx` when we initiate a force-close. - * - with the previous `commitment_tx`, just to get claiming HTLC - * signatures, if we are reacting to a [`ChannelMonitor`] - * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) - * that decided to broadcast before it had been updated to the latest `commitment_tx`. - * - * This may be called multiple times for the same transaction. - * - * An external signer implementation should check that the commitment has not been revoked. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - */ - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx); - /** - * Create a signature for the given input in a transaction spending an HTLC transaction output - * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * `per_commitment_key` is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do - * so). - */ - Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key); - /** - * Create a signature for the given input in a transaction spending a commitment transaction - * HTLC output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * `amount` is the value of the output spent by this input, committed to in the BIP 143 - * signature. - * - * `per_commitment_key` is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). - * - * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script - * (which is committed to in the BIP 143 signatures). - */ - Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc); - /** - * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment - * transaction, either offered or received. - * - * Such a transaction may claim multiples offered outputs at same time if we know the - * preimage for each when we create it, but only the input at index `input` should be - * signed for here. It may be called multiple times for same output(s) if a fee-bump is - * needed with regards to an upcoming timelock expiration. - * - * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC - * outputs. - * - * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. - * - * `per_commitment_point` is the dynamic point corresponding to the channel state - * detected onchain. It has been generated by our counterparty and is used to derive - * channel state keys, which are then included in the witness script and committed to in the - * BIP 143 signature. - */ - Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc); - /** - * Create a signature for a (proposed) closing transaction. - * - * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have - * chosen to forgo their output as dust. - */ - Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx); - /** - * Computes the signature for a commitment transaction's anchor output used as an - * input within `anchor_tx`, which spends the commitment transaction, at index `input`. - */ - Result_SignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input); - /** - * Signs a channel announcement message with our funding key and our node secret key (aka - * node_id or network_key), proving it comes from one of the channel participants. - * - * The first returned signature should be from our node secret key, the second from our - * funding key. - * - * Note that if this fails or is rejected, the channel will not be publicly announced and - * our counterparty may (though likely will not) close the channel on us for violating the - * protocol. - */ - Result_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg); - /** - * Set the counterparty static channel data, including basepoints, - * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these - * are static channel data, they MUST NOT be allowed to change to different values once set, - * as LDK may call this method more than once. - * - * channel_parameters.is_populated() MUST be true. - */ - void provide_channel_parameters(ChannelTransactionParameters channel_parameters); - } - private static class LDKBaseSignHolder { BaseSign held; } - public static BaseSign new_impl(BaseSignInterface arg, ChannelPublicKeys pubkeys) { - final LDKBaseSignHolder impl_holder = new LDKBaseSignHolder(); - impl_holder.held = new BaseSign(new bindings.LDKBaseSign() { - @Override public byte[] get_per_commitment_point(long idx) { - byte[] ret = arg.get_per_commitment_point(idx); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 33); - return result; - } - @Override public byte[] release_commitment_secret(long idx) { - byte[] ret = arg.release_commitment_secret(idx); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 32); - return result; - } - @Override public long validate_holder_commitment(long holder_tx, byte[][] preimages) { - org.ldk.structs.HolderCommitmentTransaction holder_tx_hu_conv = null; if (holder_tx < 0 || holder_tx > 4096) { holder_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, holder_tx); } - Result_NoneNoneZ ret = arg.validate_holder_commitment(holder_tx_hu_conv, preimages); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public byte[] channel_keys_id() { - byte[] ret = arg.channel_keys_id(); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 32); - return result; - } - @Override public long sign_counterparty_commitment(long commitment_tx, byte[][] preimages) { - org.ldk.structs.CommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new org.ldk.structs.CommitmentTransaction(null, commitment_tx); } - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv, preimages); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long validate_counterparty_revocation(long idx, byte[] secret) { - Result_NoneNoneZ ret = arg.validate_counterparty_revocation(idx, secret); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_holder_commitment_and_htlcs(long commitment_tx) { - org.ldk.structs.HolderCommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, commitment_tx); } - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) { - Result_SignatureNoneZ ret = arg.sign_justice_revoked_output(justice_tx, input, amount, per_commitment_key); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) { - org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); } - Result_SignatureNoneZ ret = arg.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) { - org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); } - Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_closing_transaction(long closing_tx) { - org.ldk.structs.ClosingTransaction closing_tx_hu_conv = null; if (closing_tx < 0 || closing_tx > 4096) { closing_tx_hu_conv = new org.ldk.structs.ClosingTransaction(null, closing_tx); } - Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_holder_anchor_input(byte[] anchor_tx, long input) { - Result_SignatureNoneZ ret = arg.sign_holder_anchor_input(anchor_tx, input); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_channel_announcement(long msg) { - org.ldk.structs.UnsignedChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, msg); } - Result_C2Tuple_SignatureSignatureZNoneZ ret = arg.sign_channel_announcement(msg_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public void provide_channel_parameters(long channel_parameters) { - org.ldk.structs.ChannelTransactionParameters channel_parameters_hu_conv = null; if (channel_parameters < 0 || channel_parameters > 4096) { channel_parameters_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, channel_parameters); } - arg.provide_channel_parameters(channel_parameters_hu_conv); - Reference.reachabilityFence(arg); - } - }, pubkeys); - return impl_holder.held; - } - /** - * Gets the per-commitment point for a specific commitment number - * - * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. - */ - public byte[] get_per_commitment_point(long idx) { - byte[] ret = bindings.BaseSign_get_per_commitment_point(this.ptr, idx); - Reference.reachabilityFence(this); - Reference.reachabilityFence(idx); - return ret; - } - - /** - * Gets the commitment secret for a specific commitment number as part of the revocation process - * - * An external signer implementation should error here if the commitment was already signed - * and should refuse to sign it in the future. - * - * May be called more than once for the same index. - * - * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. - */ - public byte[] release_commitment_secret(long idx) { - byte[] ret = bindings.BaseSign_release_commitment_secret(this.ptr, idx); - Reference.reachabilityFence(this); - Reference.reachabilityFence(idx); - return ret; - } - - /** - * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. - * - * This is required in order for the signer to make sure that releasing a commitment - * secret won't leave us without a broadcastable holder transaction. - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * Note that all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. - */ - public Result_NoneNoneZ validate_holder_commitment(org.ldk.structs.HolderCommitmentTransaction holder_tx, byte[][] preimages) { - long ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr, preimages != null ? Arrays.stream(preimages).map(preimages_conv_8 -> InternalUtils.check_arr_len(preimages_conv_8, 32)).toArray(byte[][]::new) : null); - Reference.reachabilityFence(this); - Reference.reachabilityFence(holder_tx); - Reference.reachabilityFence(preimages); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(holder_tx); }; - return ret_hu_conv; - } - - /** - * Returns an arbitrary identifier describing the set of keys which are provided back to you in - * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this - * [`BaseSign`] object uniquely and lookup or re-derive its keys. - */ - public byte[] channel_keys_id() { - byte[] ret = bindings.BaseSign_channel_keys_id(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. - * - * Note that if signing fails or is rejected, the channel will be force-closed. - * - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * Note that all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. - */ - public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] preimages) { - long ret = bindings.BaseSign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr, preimages != null ? Arrays.stream(preimages).map(preimages_conv_8 -> InternalUtils.check_arr_len(preimages_conv_8, 32)).toArray(byte[][]::new) : null); - Reference.reachabilityFence(this); - Reference.reachabilityFence(commitment_tx); - Reference.reachabilityFence(preimages); - if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(commitment_tx); }; - return ret_hu_conv; - } - - /** - * Validate the counterparty's revocation. - * - * This is required in order for the signer to make sure that the state has moved - * forward and it is safe to sign the next counterparty commitment. - */ - public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) { - long ret = bindings.BaseSign_validate_counterparty_revocation(this.ptr, idx, InternalUtils.check_arr_len(secret, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(idx); - Reference.reachabilityFence(secret); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. - * - * This will be called - * - with a non-revoked `commitment_tx`. - * - with the latest `commitment_tx` when we initiate a force-close. - * - with the previous `commitment_tx`, just to get claiming HTLC - * signatures, if we are reacting to a [`ChannelMonitor`] - * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) - * that decided to broadcast before it had been updated to the latest `commitment_tx`. - * - * This may be called multiple times for the same transaction. - * - * An external signer implementation should check that the commitment has not been revoked. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - */ - public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(org.ldk.structs.HolderCommitmentTransaction commitment_tx) { - long ret = bindings.BaseSign_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(commitment_tx); - if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(commitment_tx); }; - return ret_hu_conv; - } - - /** - * Create a signature for the given input in a transaction spending an HTLC transaction output - * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * `per_commitment_key` is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do - * so). - */ - public Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) { - long ret = bindings.BaseSign_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(justice_tx); - Reference.reachabilityFence(input); - Reference.reachabilityFence(amount); - Reference.reachabilityFence(per_commitment_key); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Create a signature for the given input in a transaction spending a commitment transaction - * HTLC output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * `amount` is the value of the output spent by this input, committed to in the BIP 143 - * signature. - * - * `per_commitment_key` is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). - * - * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script - * (which is committed to in the BIP 143 signatures). - */ - public Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) { - long ret = bindings.BaseSign_sign_justice_revoked_htlc(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32), htlc == null ? 0 : htlc.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(justice_tx); - Reference.reachabilityFence(input); - Reference.reachabilityFence(amount); - Reference.reachabilityFence(per_commitment_key); - Reference.reachabilityFence(htlc); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(htlc); }; - return ret_hu_conv; - } - - /** - * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment - * transaction, either offered or received. - * - * Such a transaction may claim multiples offered outputs at same time if we know the - * preimage for each when we create it, but only the input at index `input` should be - * signed for here. It may be called multiple times for same output(s) if a fee-bump is - * needed with regards to an upcoming timelock expiration. - * - * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC - * outputs. - * - * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. - * - * `per_commitment_point` is the dynamic point corresponding to the channel state - * detected onchain. It has been generated by our counterparty and is used to derive - * channel state keys, which are then included in the witness script and committed to in the - * BIP 143 signature. - */ - public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) { - long ret = bindings.BaseSign_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, InternalUtils.check_arr_len(per_commitment_point, 33), htlc == null ? 0 : htlc.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(htlc_tx); - Reference.reachabilityFence(input); - Reference.reachabilityFence(amount); - Reference.reachabilityFence(per_commitment_point); - Reference.reachabilityFence(htlc); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(htlc); }; - return ret_hu_conv; - } - - /** - * Create a signature for a (proposed) closing transaction. - * - * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have - * chosen to forgo their output as dust. - */ - public Result_SignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) { - long ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(closing_tx); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(closing_tx); }; - return ret_hu_conv; - } - - /** - * Computes the signature for a commitment transaction's anchor output used as an - * input within `anchor_tx`, which spends the commitment transaction, at index `input`. - */ - public Result_SignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) { - long ret = bindings.BaseSign_sign_holder_anchor_input(this.ptr, anchor_tx, input); - Reference.reachabilityFence(this); - Reference.reachabilityFence(anchor_tx); - Reference.reachabilityFence(input); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Signs a channel announcement message with our funding key and our node secret key (aka - * node_id or network_key), proving it comes from one of the channel participants. - * - * The first returned signature should be from our node secret key, the second from our - * funding key. - * - * Note that if this fails or is rejected, the channel will not be publicly announced and - * our counterparty may (though likely will not) close the channel on us for violating the - * protocol. - */ - public Result_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement(org.ldk.structs.UnsignedChannelAnnouncement msg) { - long ret = bindings.BaseSign_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(msg); - if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_SignatureSignatureZNoneZ ret_hu_conv = Result_C2Tuple_SignatureSignatureZNoneZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(msg); }; - return ret_hu_conv; - } - - /** - * Set the counterparty static channel data, including basepoints, - * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these - * are static channel data, they MUST NOT be allowed to change to different values once set, - * as LDK may call this method more than once. - * - * channel_parameters.is_populated() MUST be true. - */ - public void provide_channel_parameters(org.ldk.structs.ChannelTransactionParameters channel_parameters) { - bindings.BaseSign_provide_channel_parameters(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(channel_parameters); - if (this != null) { this.ptrs_to.add(channel_parameters); }; - } - - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - public ChannelPublicKeys get_pubkeys() { - long ret = bindings.BaseSign_get_pubkeys(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/BestBlock.java b/src/main/java/org/ldk/structs/BestBlock.java index 8857c045..fa485b60 100644 --- a/src/main/java/org/ldk/structs/BestBlock.java +++ b/src/main/java/org/ldk/structs/BestBlock.java @@ -59,8 +59,8 @@ public class BestBlock extends CommonBase { * Constructs a `BestBlock` that represents the genesis block at height 0 of the given * network. */ - public static BestBlock from_genesis(org.ldk.enums.Network network) { - long ret = bindings.BestBlock_from_genesis(network); + public static BestBlock from_network(org.ldk.enums.Network network) { + long ret = bindings.BestBlock_from_network(network); Reference.reachabilityFence(network); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); } diff --git a/src/main/java/org/ldk/structs/BigSize.java b/src/main/java/org/ldk/structs/BigSize.java index 3b80ea34..c87c9ae3 100644 --- a/src/main/java/org/ldk/structs/BigSize.java +++ b/src/main/java/org/ldk/structs/BigSize.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's + * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's * variable-length integers except that it is serialized in big-endian instead of little-endian. * * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be diff --git a/src/main/java/org/ldk/structs/BlindedHopFeatures.java b/src/main/java/org/ldk/structs/BlindedHopFeatures.java new file mode 100644 index 00000000..283f1c97 --- /dev/null +++ b/src/main/java/org/ldk/structs/BlindedHopFeatures.java @@ -0,0 +1,99 @@ +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; + + +/** + * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class BlindedHopFeatures extends CommonBase { + BlindedHopFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.BlindedHopFeatures_free(ptr); } + } + + /** + * Checks if two BlindedHopFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(org.ldk.structs.BlindedHopFeatures b) { + boolean ret = bindings.BlindedHopFeatures_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + if (this != null) { this.ptrs_to.add(b); }; + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof BlindedHopFeatures)) return false; + return this.eq((BlindedHopFeatures)o); + } + long clone_ptr() { + long ret = bindings.BlindedHopFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the BlindedHopFeatures + */ + public BlindedHopFeatures clone() { + long ret = bindings.BlindedHopFeatures_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.BlindedHopFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHopFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Create a blank Features with no features set + */ + public static BlindedHopFeatures empty() { + long ret = bindings.BlindedHopFeatures_empty(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.BlindedHopFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHopFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ + public boolean requires_unknown_bits() { + boolean ret = bindings.BlindedHopFeatures_requires_unknown_bits(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read + */ + public byte[] write() { + byte[] ret = bindings.BlindedHopFeatures_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write + */ + public static Result_BlindedHopFeaturesDecodeErrorZ read(byte[] ser) { + long ret = bindings.BlindedHopFeatures_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_BlindedHopFeaturesDecodeErrorZ ret_hu_conv = Result_BlindedHopFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/BlindedPath.java b/src/main/java/org/ldk/structs/BlindedPath.java index 756855da..7a32ebab 100644 --- a/src/main/java/org/ldk/structs/BlindedPath.java +++ b/src/main/java/org/ldk/structs/BlindedPath.java @@ -45,13 +45,13 @@ public class BlindedPath extends CommonBase { * * Errors if less than two hops are provided or if `node_pk`(s) are invalid. */ - public static Result_BlindedPathNoneZ of(byte[][] node_pks, org.ldk.structs.KeysInterface keys_manager) { - long ret = bindings.BlindedPath_new(node_pks != null ? Arrays.stream(node_pks).map(node_pks_conv_8 -> InternalUtils.check_arr_len(node_pks_conv_8, 33)).toArray(byte[][]::new) : null, keys_manager == null ? 0 : keys_manager.ptr); + public static Result_BlindedPathNoneZ of(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) { + long ret = bindings.BlindedPath_new(node_pks != null ? Arrays.stream(node_pks).map(node_pks_conv_8 -> InternalUtils.check_arr_len(node_pks_conv_8, 33)).toArray(byte[][]::new) : null, entropy_source == null ? 0 : entropy_source.ptr); Reference.reachabilityFence(node_pks); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(entropy_source); if (ret >= 0 && ret <= 4096) { return null; } Result_BlindedPathNoneZ ret_hu_conv = Result_BlindedPathNoneZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Bolt12InvoiceFeatures.java b/src/main/java/org/ldk/structs/Bolt12InvoiceFeatures.java new file mode 100644 index 00000000..0e7965df --- /dev/null +++ b/src/main/java/org/ldk/structs/Bolt12InvoiceFeatures.java @@ -0,0 +1,113 @@ +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; + + +/** + * Features used within an `invoice`. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Bolt12InvoiceFeatures extends CommonBase { + Bolt12InvoiceFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.Bolt12InvoiceFeatures_free(ptr); } + } + + /** + * Checks if two Bolt12InvoiceFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(org.ldk.structs.Bolt12InvoiceFeatures b) { + boolean ret = bindings.Bolt12InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + if (this != null) { this.ptrs_to.add(b); }; + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof Bolt12InvoiceFeatures)) return false; + return this.eq((Bolt12InvoiceFeatures)o); + } + long clone_ptr() { + long ret = bindings.Bolt12InvoiceFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the Bolt12InvoiceFeatures + */ + public Bolt12InvoiceFeatures clone() { + long ret = bindings.Bolt12InvoiceFeatures_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Create a blank Features with no features set + */ + public static Bolt12InvoiceFeatures empty() { + long ret = bindings.Bolt12InvoiceFeatures_empty(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ + public boolean requires_unknown_bits() { + boolean ret = bindings.Bolt12InvoiceFeatures_requires_unknown_bits(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Set this feature as optional. + */ + public void set_basic_mpp_optional() { + bindings.Bolt12InvoiceFeatures_set_basic_mpp_optional(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Set this feature as required. + */ + public void set_basic_mpp_required() { + bindings.Bolt12InvoiceFeatures_set_basic_mpp_required(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Checks if this feature is supported. + */ + public boolean supports_basic_mpp() { + boolean ret = bindings.Bolt12InvoiceFeatures_supports_basic_mpp(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Checks if this feature is required. + */ + public boolean requires_basic_mpp() { + boolean ret = bindings.Bolt12InvoiceFeatures_requires_basic_mpp(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/BroadcasterInterface.java b/src/main/java/org/ldk/structs/BroadcasterInterface.java index 5192133c..0ecc2feb 100644 --- a/src/main/java/org/ldk/structs/BroadcasterInterface.java +++ b/src/main/java/org/ldk/structs/BroadcasterInterface.java @@ -23,7 +23,19 @@ public class BroadcasterInterface extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.BroadcasterInterface_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.BroadcasterInterface_free(ptr); } + ptr = 0; + } public static interface BroadcasterInterfaceInterface { /** * Sends a transaction out to (hopefully) be mined. diff --git a/src/main/java/org/ldk/structs/ChannelAnnouncement.java b/src/main/java/org/ldk/structs/ChannelAnnouncement.java index f5bb9de8..f897915a 100644 --- a/src/main/java/org/ldk/structs/ChannelAnnouncement.java +++ b/src/main/java/org/ldk/structs/ChannelAnnouncement.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A channel_announcement message to be sent or received from a peer + * A [`channel_announcement`] message to be sent to or received from a peer. + * + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChannelAnnouncement extends CommonBase { diff --git a/src/main/java/org/ldk/structs/ChannelCounterparty.java b/src/main/java/org/ldk/structs/ChannelCounterparty.java index 185e5cd7..6613db12 100644 --- a/src/main/java/org/ldk/structs/ChannelCounterparty.java +++ b/src/main/java/org/ldk/structs/ChannelCounterparty.java @@ -147,6 +147,7 @@ public class ChannelCounterparty extends CommonBase { bindings.ChannelCounterparty_set_outbound_htlc_minimum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -168,6 +169,7 @@ public class ChannelCounterparty extends CommonBase { bindings.ChannelCounterparty_set_outbound_htlc_maximum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -186,6 +188,8 @@ public class ChannelCounterparty extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(features_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(forwarding_info_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_htlc_minimum_msat_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_htlc_maximum_msat_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ChannelDetails.java b/src/main/java/org/ldk/structs/ChannelDetails.java index 6975a876..323ff778 100644 --- a/src/main/java/org/ldk/structs/ChannelDetails.java +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -177,6 +177,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -214,6 +215,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_outbound_scid_alias(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -251,6 +253,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -306,6 +309,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -504,6 +508,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -529,6 +534,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_confirmations(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -562,6 +568,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -675,6 +682,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_inbound_htlc_minimum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -696,6 +704,7 @@ public class ChannelDetails extends CommonBase { bindings.ChannelDetails_set_inbound_htlc_maximum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -764,6 +773,15 @@ public class ChannelDetails extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(counterparty_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_scid_alias_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_scid_alias_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(unspendable_punishment_reserve_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(confirmations_required_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(confirmations_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(force_close_spend_delay_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_htlc_minimum_msat_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_htlc_maximum_msat_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index 0dce840d..46520674 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -303,11 +303,11 @@ public class ChannelHandshakeConfig extends CommonBase { * any attacker who is able to take control of a channel can just as easily send the funds via * lightning payments, so we never require that our counterparties support this option. * - * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. * * Default value: true. * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey */ public boolean get_commit_upfront_shutdown_pubkey() { boolean ret = bindings.ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(this.ptr); @@ -324,11 +324,11 @@ public class ChannelHandshakeConfig extends CommonBase { * any attacker who is able to take control of a channel can just as easily send the funds via * lightning payments, so we never require that our counterparties support this option. * - * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. * * Default value: true. * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey */ public void set_commit_upfront_shutdown_pubkey(boolean val) { bindings.ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java b/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java index eeb51e43..6f9f5443 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java @@ -13,7 +13,7 @@ import javax.annotation.Nullable; * * These limits are only applied to our counterparty's limits, not our own. * - * Use 0/::max_value() as appropriate to skip checking. + * Use 0/`::max_value()` as appropriate to skip checking. * * Provides sane defaults for most configurations. * diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index 864f64e2..b00fa3d7 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -160,6 +160,7 @@ public class ChannelInfo extends CommonBase { bindings.ChannelInfo_set_capacity_sats(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index 902b633b..5a2ccd0b 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -40,6 +40,15 @@ import javax.annotation.Nullable; * offline for a full minute. In order to track this, you must call * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. * + * To avoid trivial DoS issues, ChannelManager limits the number of inbound connections and + * inbound channels without confirmed funding transactions. This may result in nodes which we do + * not have a channel with being unable to connect to us or open new channels with us if we have + * many peers with unfunded channels. + * + * Because it is an indication of trust, inbound channels which we've accepted as 0conf are + * exempted from the count of unfunded channels. Similarly, outbound channels and connections are + * never limited. Please ensure you limit the count of such channels yourself. + * * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but * essentially you should default to using a SimpleRefChannelManager, and use a @@ -67,13 +76,16 @@ public class ChannelManager extends CommonBase { * disconnected using its `block_connected` and `block_disconnected` methods, starting * from after `params.latest_hash`. */ - public static ChannelManager of(org.ldk.structs.FeeEstimator fee_est, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Logger logger, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.UserConfig config, org.ldk.structs.ChainParameters params) { - long ret = bindings.ChannelManager_new(fee_est == null ? 0 : fee_est.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, keys_manager == null ? 0 : keys_manager.ptr, config == null ? 0 : config.ptr, params == null ? 0 : params.ptr); + public static ChannelManager of(org.ldk.structs.FeeEstimator fee_est, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Router router, org.ldk.structs.Logger logger, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.SignerProvider signer_provider, org.ldk.structs.UserConfig config, org.ldk.structs.ChainParameters params) { + long ret = bindings.ChannelManager_new(fee_est == null ? 0 : fee_est.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, router == null ? 0 : router.ptr, logger == null ? 0 : logger.ptr, entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, signer_provider == null ? 0 : signer_provider.ptr, config == null ? 0 : config.ptr, params == null ? 0 : params.ptr); Reference.reachabilityFence(fee_est); Reference.reachabilityFence(chain_monitor); Reference.reachabilityFence(tx_broadcaster); + Reference.reachabilityFence(router); Reference.reachabilityFence(logger); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(node_signer); + Reference.reachabilityFence(signer_provider); Reference.reachabilityFence(config); Reference.reachabilityFence(params); if (ret >= 0 && ret <= 4096) { return null; } @@ -82,8 +94,11 @@ public class ChannelManager extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_est); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(chain_monitor); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(tx_broadcaster); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(router); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(signer_provider); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(params); }; return ret_hu_conv; @@ -163,14 +178,12 @@ public class ChannelManager extends CommonBase { } /** - * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`] - * to ensure non-announced channels are used. + * Gets the list of usable channels, in random order. Useful as an argument to + * [`Router::find_route`] to ensure non-announced channels are used. * * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria * are. - * - * [`find_route`]: crate::routing::router::find_route */ public ChannelDetails[] list_usable_channels() { long[] ret = bindings.ChannelManager_list_usable_channels(this.ptr); @@ -186,6 +199,30 @@ public class ChannelManager extends CommonBase { return ret_conv_16_arr; } + /** + * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a + * successful path, or have unresolved HTLCs. + * + * This can be useful for payments that may have been prepared, but ultimately not sent, as a + * result of a crash. If such a payment exists, is not listed here, and an + * [`Event::PaymentSent`] has not been received, you may consider resending the payment. + * + * [`Event::PaymentSent`]: events::Event::PaymentSent + */ + public RecentPaymentDetails[] list_recent_payments() { + long[] ret = bindings.ChannelManager_list_recent_payments(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_22_len = ret.length; + RecentPaymentDetails[] ret_conv_22_arr = new RecentPaymentDetails[ret_conv_22_len]; + for (int w = 0; w < ret_conv_22_len; w++) { + long ret_conv_22 = ret[w]; + org.ldk.structs.RecentPaymentDetails ret_conv_22_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret_conv_22); + if (ret_conv_22_hu_conv != null) { ret_conv_22_hu_conv.ptrs_to.add(this); }; + ret_conv_22_arr[w] = ret_conv_22_hu_conv; + } + return ret_conv_22_arr; + } + /** * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs * will be accepted on the given channel, and after additional timeout/the closing of all @@ -302,14 +339,19 @@ public class ChannelManager extends CommonBase { /** * Sends a payment along a given route. * - * Value parameters are provided via the last hop in route, see documentation for RouteHop + * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] * fields for more info. * + * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via + * [`PeerManager::process_events`]). + * + * # Avoiding Duplicate Payments + * * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an - * [`Event::PaymentSent`]) LDK will not stop you from sending a second payment with the same - * [`PaymentId`]. + * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a + * second payment with the same [`PaymentId`]. * * Thus, in order to ensure duplicate payments are not sent, you should implement your own * tracking of payments, including state to indicate once a payment has completed. Because you @@ -317,12 +359,16 @@ public class ChannelManager extends CommonBase { * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. * - * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via - * [`PeerManager::process_events`]). + * Additionally, in the scenario where we begin the process of sending a payment, but crash + * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're + * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See + * [`ChannelManager::list_recent_payments`] for more information. + * + * # Possible Error States on [`PaymentSendFailure`] * * Each path may have a different return value, and PaymentSendValue may return a Vec with * each entry matching the corresponding-index entry in the route paths, see - * PaymentSendFailure for more info. + * [`PaymentSendFailure`] for more info. * * In general, a path may raise: * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, @@ -337,18 +383,22 @@ public class ChannelManager extends CommonBase { * irrevocably committed to on our end. In such a case, do NOT retry the payment with a * different route unless you intend to pay twice! * - * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate - * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For - * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route - * must not contain multiple paths as multi-path payments require a recipient-provided - * payment_secret. + * # A caution on `payment_secret` + * + * `payment_secret` is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to + * authenticate the sender to the recipient and prevent payment-probing (deanonymization) + * attacks. For newer nodes, it will be provided to you in the invoice. If you do not have one, + * the [`Route`] must not contain multiple paths as multi-path payments require a + * recipient-provided `payment_secret`. * - * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature - * bit set (either as required or as available). If multiple paths are present in the Route, - * we assume the invoice had the basic_mpp feature set. + * If a `payment_secret` *is* provided, we assume that the invoice had the payment_secret + * feature bit set (either as required or as available). If multiple paths are present in the + * [`Route`], we assume the invoice had the basic_mpp feature set. * * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`Event::PaymentFailed`]: events::Event::PaymentFailed * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress * * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -366,47 +416,41 @@ public class ChannelManager extends CommonBase { } /** - * Retries a payment along the given [`Route`]. + * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on + * `route_params` and retry failed payment paths based on `retry_strategy`. * - * Errors returned are a superset of those returned from [`send_payment`], so see - * [`send_payment`] documentation for more details on errors. This method will also error if the - * retry amount puts the payment more than 10% over the payment's total amount, if the payment - * for the given `payment_id` cannot be found (likely due to timeout or success), or if - * further retries have been disabled with [`abandon_payment`]. - * - * [`send_payment`]: [`ChannelManager::send_payment`] - * [`abandon_payment`]: [`ChannelManager::abandon_payment`] + * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_NonePaymentSendFailureZ retry_payment(org.ldk.structs.Route route, byte[] payment_id) { - long ret = bindings.ChannelManager_retry_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_id, 32)); + public Result_NoneRetryableSendFailureZ send_payment_with_retry(byte[] payment_hash, @Nullable byte[] payment_secret, byte[] payment_id, org.ldk.structs.RouteParameters route_params, org.ldk.structs.Retry retry_strategy) { + long ret = bindings.ChannelManager_send_payment_with_retry(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32), InternalUtils.check_arr_len(payment_id, 32), route_params == null ? 0 : route_params.ptr, retry_strategy.ptr); Reference.reachabilityFence(this); - Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(payment_secret); Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(route_params); + Reference.reachabilityFence(retry_strategy); if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(route); }; + Result_NoneRetryableSendFailureZ ret_hu_conv = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(route_params); }; + if (this != null) { this.ptrs_to.add(retry_strategy); }; return ret_hu_conv; } /** - * Signals that no further retries for the given payment will occur. + * Signals that no further retries for the given payment should occur. Useful if you have a + * pending outbound payment with retries remaining, but wish to stop retrying the payment before + * retries are exhausted. * - * After this method returns, no future calls to [`retry_payment`] for the given `payment_id` - * are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be - * generated as soon as there are no remaining pending HTLCs for this payment. + * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon + * as there are no remaining pending HTLCs for this payment. * * Note that calling this method does *not* prevent a payment from succeeding. You must still * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to * determine the ultimate status of a payment. * * If an [`Event::PaymentFailed`] event is generated and we restart without this - * [`ChannelManager`] having been persisted, the payment may still be in the pending state - * upon restart. This allows further calls to [`retry_payment`] (and requiring a second call - * to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to - * [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`]. + * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated. * - * [`abandon_payment`]: Self::abandon_payment - * [`retry_payment`]: Self::retry_payment * [`Event::PaymentFailed`]: events::Event::PaymentFailed * [`Event::PaymentSent`]: events::Event::PaymentSent */ @@ -447,6 +491,31 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route + * based on `route_params` and retry failed payment paths based on `retry_strategy`. + * + * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous + * payments. + * + * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend + * + * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public Result_PaymentHashRetryableSendFailureZ send_spontaneous_payment_with_retry(@Nullable byte[] payment_preimage, byte[] payment_id, org.ldk.structs.RouteParameters route_params, org.ldk.structs.Retry retry_strategy) { + long ret = bindings.ChannelManager_send_spontaneous_payment_with_retry(this.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_id, 32), route_params == null ? 0 : route_params.ptr, retry_strategy.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_preimage); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(route_params); + Reference.reachabilityFence(retry_strategy); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentHashRetryableSendFailureZ ret_hu_conv = Result_PaymentHashRetryableSendFailureZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(route_params); }; + if (this != null) { this.ptrs_to.add(retry_strategy); }; + 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 @@ -563,12 +632,12 @@ public class ChannelManager extends CommonBase { * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs * [`HTLCIntercepted`]: events::Event::HTLCIntercepted */ - public Result_NoneAPIErrorZ forward_intercepted_htlc(byte[] intercept_id, byte[] next_hop_channel_id, byte[] _next_node_id, long amt_to_forward_msat) { - long ret = bindings.ChannelManager_forward_intercepted_htlc(this.ptr, InternalUtils.check_arr_len(intercept_id, 32), InternalUtils.check_arr_len(next_hop_channel_id, 32), InternalUtils.check_arr_len(_next_node_id, 33), amt_to_forward_msat); + public Result_NoneAPIErrorZ forward_intercepted_htlc(byte[] intercept_id, byte[] next_hop_channel_id, byte[] next_node_id, long amt_to_forward_msat) { + long ret = bindings.ChannelManager_forward_intercepted_htlc(this.ptr, InternalUtils.check_arr_len(intercept_id, 32), InternalUtils.check_arr_len(next_hop_channel_id, 32), InternalUtils.check_arr_len(next_node_id, 33), amt_to_forward_msat); Reference.reachabilityFence(this); Reference.reachabilityFence(intercept_id); Reference.reachabilityFence(next_hop_channel_id); - Reference.reachabilityFence(_next_node_id); + Reference.reachabilityFence(next_node_id); Reference.reachabilityFence(amt_to_forward_msat); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); @@ -614,6 +683,7 @@ public class ChannelManager extends CommonBase { * the channel. * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs * with the current `ChannelConfig`. + * Removing peers which have disconnected but and no longer have any channels. * * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate * estimate fetches. @@ -644,6 +714,19 @@ public class ChannelManager extends CommonBase { Reference.reachabilityFence(payment_hash); } + /** + * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the + * reason for the failure. + * + * See [`FailureCode`] for valid failure codes. + */ + public void fail_htlc_backwards_with_reason(byte[] payment_hash, org.ldk.enums.FailureCode failure_code) { + bindings.ChannelManager_fail_htlc_backwards_with_reason(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), failure_code); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(failure_code); + } + /** * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any * [`MessageSendEvent`]s needed to claim the payment. @@ -746,7 +829,8 @@ public class ChannelManager extends CommonBase { * [`PaymentHash`] and [`PaymentPreimage`] for you. * * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which - * will have the [`PaymentClaimable::payment_preimage`] field filled in. That should then be + * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with + * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be * passed directly to [`claim_funds`]. * * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. @@ -761,18 +845,26 @@ public class ChannelManager extends CommonBase { * * Errors if `min_value_msat` is greater than total bitcoin supply. * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [`claim_funds`]: Self::claim_funds * [`PaymentClaimable`]: events::Event::PaymentClaimable - * [`PaymentClaimable::payment_preimage`]: events::Event::PaymentClaimable::payment_preimage + * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose + * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment + * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ - public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) { - long ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs); + public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(min_value_msat); Reference.reachabilityFence(invoice_expiry_delta_secs); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(min_value_msat); }; + if (this != null) { this.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -794,6 +886,7 @@ public class ChannelManager extends CommonBase { Reference.reachabilityFence(invoice_expiry_delta_secs); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(min_value_msat); }; return ret_hu_conv; } @@ -826,8 +919,8 @@ public class ChannelManager extends CommonBase { * If you need exact expiry semantics, you should enforce them upon receipt of * [`PaymentClaimable`]. * - * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` - * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. + * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta` + * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. * * Note that a malicious eavesdropper can intuit whether an inbound payment was created by * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. @@ -839,17 +932,23 @@ public class ChannelManager extends CommonBase { * * Errors if `min_value_msat` is greater than total bitcoin supply. * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [`create_inbound_payment`]: Self::create_inbound_payment * [`PaymentClaimable`]: events::Event::PaymentClaimable */ - public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs) { - long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs); + public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry) { + long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(min_value_msat); Reference.reachabilityFence(invoice_expiry_delta_secs); + Reference.reachabilityFence(min_final_cltv_expiry); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(min_value_msat); }; + if (this != null) { this.ptrs_to.add(min_final_cltv_expiry); }; return ret_hu_conv; } @@ -872,6 +971,7 @@ public class ChannelManager extends CommonBase { Reference.reachabilityFence(invoice_expiry_delta_secs); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(min_value_msat); }; return ret_hu_conv; } @@ -1055,6 +1155,58 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Fetches the set of [`NodeFeatures`] flags which are provided by or required by + * [`ChannelManager`]. + */ + public NodeFeatures node_features() { + long ret = bindings.ChannelManager_node_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by + * [`ChannelManager`]. + */ + public ChannelFeatures channel_features() { + long ret = bindings.ChannelManager_channel_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by + * [`ChannelManager`]. + */ + public ChannelTypeFeatures channel_type_features() { + long ret = bindings.ChannelManager_channel_type_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * [`ChannelManager`]. + */ + public InitFeatures init_features() { + long ret = bindings.ChannelManager_init_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + /** * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is @@ -1077,17 +1229,4 @@ public class ChannelManager extends CommonBase { return ret; } - /** - * Constructs a new Payer which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is - */ - public Payer as_Payer() { - long ret = bindings.ChannelManager_as_Payer(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Payer ret_hu_conv = new Payer(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - } diff --git a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java index cfe4274b..d542693e 100644 --- a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java +++ b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java @@ -51,16 +51,60 @@ public class ChannelManagerReadArgs extends CommonBase { if (ptr != 0) { bindings.ChannelManagerReadArgs_free(ptr); } } + /** + * A cryptographically secure source of entropy. + */ + public EntropySource get_entropy_source() { + long ret = bindings.ChannelManagerReadArgs_get_entropy_source(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + EntropySource ret_hu_conv = new EntropySource(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * A cryptographically secure source of entropy. + */ + public void set_entropy_source(org.ldk.structs.EntropySource val) { + bindings.ChannelManagerReadArgs_set_entropy_source(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + + /** + * A signer that is able to perform node-scoped cryptographic operations. + */ + public NodeSigner get_node_signer() { + long ret = bindings.ChannelManagerReadArgs_get_node_signer(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + NodeSigner ret_hu_conv = new NodeSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * A signer that is able to perform node-scoped cryptographic operations. + */ + public void set_node_signer(org.ldk.structs.NodeSigner val) { + bindings.ChannelManagerReadArgs_set_node_signer(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + /** * The keys provider which will give us relevant keys. Some keys will be loaded during * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel * signing data. */ - public KeysInterface get_keys_manager() { - long ret = bindings.ChannelManagerReadArgs_get_keys_manager(this.ptr); + public SignerProvider get_signer_provider() { + long ret = bindings.ChannelManagerReadArgs_get_signer_provider(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - KeysInterface ret_hu_conv = new KeysInterface(null, ret); + SignerProvider ret_hu_conv = new SignerProvider(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -70,8 +114,8 @@ public class ChannelManagerReadArgs extends CommonBase { * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel * signing data. */ - public void set_keys_manager(org.ldk.structs.KeysInterface val) { - bindings.ChannelManagerReadArgs_set_keys_manager(this.ptr, val == null ? 0 : val.ptr); + public void set_signer_provider(org.ldk.structs.SignerProvider val) { + bindings.ChannelManagerReadArgs_set_signer_provider(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -159,6 +203,34 @@ public class ChannelManagerReadArgs extends CommonBase { if (this != null) { this.ptrs_to.add(val); }; } + /** + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. + */ + public Router get_router() { + long ret = bindings.ChannelManagerReadArgs_get_router(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Router ret_hu_conv = new Router(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. + */ + public void set_router(org.ldk.structs.Router val) { + bindings.ChannelManagerReadArgs_set_router(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; + } + /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. @@ -212,22 +284,28 @@ public class ChannelManagerReadArgs extends CommonBase { * HashMap for you. This is primarily useful for C bindings where it is not practical to * populate a HashMap directly from C. */ - public static ChannelManagerReadArgs of(org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Logger logger, org.ldk.structs.UserConfig default_config, ChannelMonitor[] channel_monitors) { - long ret = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : keys_manager.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr, channel_monitors != null ? Arrays.stream(channel_monitors).mapToLong(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr).toArray() : null); - Reference.reachabilityFence(keys_manager); + public static ChannelManagerReadArgs of(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.SignerProvider signer_provider, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Router router, org.ldk.structs.Logger logger, org.ldk.structs.UserConfig default_config, ChannelMonitor[] channel_monitors) { + long ret = bindings.ChannelManagerReadArgs_new(entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, signer_provider == null ? 0 : signer_provider.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, router == null ? 0 : router.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr, channel_monitors != null ? Arrays.stream(channel_monitors).mapToLong(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr).toArray() : null); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(node_signer); + Reference.reachabilityFence(signer_provider); Reference.reachabilityFence(fee_estimator); Reference.reachabilityFence(chain_monitor); Reference.reachabilityFence(tx_broadcaster); + Reference.reachabilityFence(router); Reference.reachabilityFence(logger); Reference.reachabilityFence(default_config); Reference.reachabilityFence(channel_monitors); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelManagerReadArgs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelManagerReadArgs(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(signer_provider); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_estimator); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(chain_monitor); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(tx_broadcaster); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(router); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(default_config); }; for (ChannelMonitor channel_monitors_conv_16: channel_monitors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_monitors_conv_16); }; }; diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index 19192e04..75dcbcb1 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -10,8 +10,8 @@ import javax.annotation.Nullable; /** * A trait to describe an object which can receive channel messages. * - * Messages MAY be called in parallel when they originate from different their_node_ids, however - * they MUST NOT be called in parallel when the two calls have the same their_node_id. + * Messages MAY be called in parallel when they originate from different `their_node_ids`, however + * they MUST NOT be called in parallel when the two calls have the same `their_node_id`. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChannelMessageHandler extends CommonBase { @@ -27,96 +27,102 @@ public class ChannelMessageHandler extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.ChannelMessageHandler_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.ChannelMessageHandler_free(ptr); } + ptr = 0; + } public static interface ChannelMessageHandlerInterface { /** - * Handle an incoming open_channel message from the given peer. + * Handle an incoming `open_channel` message from the given peer. */ - void handle_open_channel(byte[] their_node_id, InitFeatures their_features, OpenChannel msg); + void handle_open_channel(byte[] their_node_id, OpenChannel msg); /** - * Handle an incoming accept_channel message from the given peer. + * Handle an incoming `accept_channel` message from the given peer. */ - void handle_accept_channel(byte[] their_node_id, InitFeatures their_features, AcceptChannel msg); + void handle_accept_channel(byte[] their_node_id, AcceptChannel msg); /** - * Handle an incoming funding_created message from the given peer. + * Handle an incoming `funding_created` message from the given peer. */ void handle_funding_created(byte[] their_node_id, FundingCreated msg); /** - * Handle an incoming funding_signed message from the given peer. + * Handle an incoming `funding_signed` message from the given peer. */ void handle_funding_signed(byte[] their_node_id, FundingSigned msg); /** - * Handle an incoming channel_ready message from the given peer. + * Handle an incoming `channel_ready` message from the given peer. */ void handle_channel_ready(byte[] their_node_id, ChannelReady msg); /** - * Handle an incoming shutdown message from the given peer. + * Handle an incoming `shutdown` message from the given peer. */ - void handle_shutdown(byte[] their_node_id, InitFeatures their_features, Shutdown msg); + void handle_shutdown(byte[] their_node_id, Shutdown msg); /** - * Handle an incoming closing_signed message from the given peer. + * Handle an incoming `closing_signed` message from the given peer. */ void handle_closing_signed(byte[] their_node_id, ClosingSigned msg); /** - * Handle an incoming update_add_htlc message from the given peer. + * Handle an incoming `update_add_htlc` message from the given peer. */ void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg); /** - * Handle an incoming update_fulfill_htlc message from the given peer. + * Handle an incoming `update_fulfill_htlc` message from the given peer. */ void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg); /** - * Handle an incoming update_fail_htlc message from the given peer. + * Handle an incoming `update_fail_htlc` message from the given peer. */ void handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg); /** - * Handle an incoming update_fail_malformed_htlc message from the given peer. + * Handle an incoming `update_fail_malformed_htlc` message from the given peer. */ void handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg); /** - * Handle an incoming commitment_signed message from the given peer. + * Handle an incoming `commitment_signed` message from the given peer. */ void handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg); /** - * Handle an incoming revoke_and_ack message from the given peer. + * Handle an incoming `revoke_and_ack` message from the given peer. */ void handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg); /** - * Handle an incoming update_fee message from the given peer. + * Handle an incoming `update_fee` message from the given peer. */ void handle_update_fee(byte[] their_node_id, UpdateFee msg); /** - * Handle an incoming announcement_signatures message from the given peer. + * Handle an incoming `announcement_signatures` message from the given peer. */ void handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg); /** - * Indicates a connection to the peer failed/an existing connection was lost. If no connection - * is believed to be possible in the future (eg they're sending us messages we don't - * understand or indicate they require unknown feature bits), no_connection_possible is set - * and any outstanding channels should be failed. - * - * Note that in some rare cases this may be called without a corresponding - * [`Self::peer_connected`]. + * Indicates a connection to the peer failed/an existing connection was lost. */ - void peer_disconnected(byte[] their_node_id, boolean no_connection_possible); + void peer_disconnected(byte[] their_node_id); /** - * Handle a peer reconnecting, possibly generating channel_reestablish message(s). + * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). * * May return an `Err(())` if the features the peer supports are not sufficient to communicate * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - Result_NoneNoneZ peer_connected(byte[] their_node_id, Init msg); + Result_NoneNoneZ peer_connected(byte[] their_node_id, Init msg, boolean inbound); /** - * Handle an incoming channel_reestablish message from the given peer. + * Handle an incoming `channel_reestablish` message from the given peer. */ void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg); /** - * Handle an incoming channel update from the given peer. + * Handle an incoming `channel_update` message from the given peer. */ void handle_channel_update(byte[] their_node_id, ChannelUpdate msg); /** - * Handle an incoming error message from the given peer. + * Handle an incoming `error` message from the given peer. */ void handle_error(byte[] their_node_id, ErrorMessage msg); /** @@ -138,18 +144,14 @@ public class ChannelMessageHandler extends CommonBase { public static ChannelMessageHandler new_impl(ChannelMessageHandlerInterface arg, MessageSendEventsProvider.MessageSendEventsProviderInterface MessageSendEventsProvider_impl) { final LDKChannelMessageHandlerHolder impl_holder = new LDKChannelMessageHandlerHolder(); impl_holder.held = new ChannelMessageHandler(new bindings.LDKChannelMessageHandler() { - @Override public void handle_open_channel(byte[] their_node_id, long their_features, long msg) { - org.ldk.structs.InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new org.ldk.structs.InitFeatures(null, their_features); } - if (their_features_hu_conv != null) { their_features_hu_conv.ptrs_to.add(this); }; + @Override public void handle_open_channel(byte[] their_node_id, long msg) { org.ldk.structs.OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.OpenChannel(null, msg); } - arg.handle_open_channel(their_node_id, their_features_hu_conv, msg_hu_conv); + arg.handle_open_channel(their_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } - @Override public void handle_accept_channel(byte[] their_node_id, long their_features, long msg) { - org.ldk.structs.InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new org.ldk.structs.InitFeatures(null, their_features); } - if (their_features_hu_conv != null) { their_features_hu_conv.ptrs_to.add(this); }; + @Override public void handle_accept_channel(byte[] their_node_id, long msg) { org.ldk.structs.AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.AcceptChannel(null, msg); } - arg.handle_accept_channel(their_node_id, their_features_hu_conv, msg_hu_conv); + arg.handle_accept_channel(their_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } @Override public void handle_funding_created(byte[] their_node_id, long msg) { @@ -167,10 +169,9 @@ public class ChannelMessageHandler extends CommonBase { arg.handle_channel_ready(their_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } - @Override public void handle_shutdown(byte[] their_node_id, long their_features, long msg) { - org.ldk.structs.InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new org.ldk.structs.InitFeatures(null, their_features); } + @Override public void handle_shutdown(byte[] their_node_id, long msg) { org.ldk.structs.Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.Shutdown(null, msg); } - arg.handle_shutdown(their_node_id, their_features_hu_conv, msg_hu_conv); + arg.handle_shutdown(their_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } @Override public void handle_closing_signed(byte[] their_node_id, long msg) { @@ -218,13 +219,13 @@ public class ChannelMessageHandler extends CommonBase { arg.handle_announcement_signatures(their_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } - @Override public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) { - arg.peer_disconnected(their_node_id, no_connection_possible); + @Override public void peer_disconnected(byte[] their_node_id) { + arg.peer_disconnected(their_node_id); Reference.reachabilityFence(arg); } - @Override public long peer_connected(byte[] their_node_id, long msg) { + @Override public long peer_connected(byte[] their_node_id, long msg, boolean inbound) { org.ldk.structs.Init msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.Init(null, msg); } - Result_NoneNoneZ ret = arg.peer_connected(their_node_id, msg_hu_conv); + Result_NoneNoneZ ret = arg.peer_connected(their_node_id, msg_hu_conv, inbound); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; @@ -265,38 +266,34 @@ public class ChannelMessageHandler extends CommonBase { */ public MessageSendEventsProvider get_message_send_events_provider() { MessageSendEventsProvider res = new MessageSendEventsProvider(null, bindings.LDKChannelMessageHandler_get_MessageSendEventsProvider(this.ptr)); - this.ptrs_to.add(res); + res.ptrs_to.add(this); return res; } /** - * Handle an incoming open_channel message from the given peer. + * Handle an incoming `open_channel` message from the given peer. */ - public void handle_open_channel(byte[] their_node_id, org.ldk.structs.InitFeatures their_features, org.ldk.structs.OpenChannel msg) { - bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr, msg == null ? 0 : msg.ptr); + public void handle_open_channel(byte[] their_node_id, org.ldk.structs.OpenChannel msg) { + bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); - Reference.reachabilityFence(their_features); Reference.reachabilityFence(msg); - if (this != null) { this.ptrs_to.add(their_features); }; if (this != null) { this.ptrs_to.add(msg); }; } /** - * Handle an incoming accept_channel message from the given peer. + * Handle an incoming `accept_channel` message from the given peer. */ - public void handle_accept_channel(byte[] their_node_id, org.ldk.structs.InitFeatures their_features, org.ldk.structs.AcceptChannel msg) { - bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr, msg == null ? 0 : msg.ptr); + public void handle_accept_channel(byte[] their_node_id, org.ldk.structs.AcceptChannel msg) { + bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); - Reference.reachabilityFence(their_features); Reference.reachabilityFence(msg); - if (this != null) { this.ptrs_to.add(their_features); }; if (this != null) { this.ptrs_to.add(msg); }; } /** - * Handle an incoming funding_created message from the given peer. + * Handle an incoming `funding_created` message from the given peer. */ public void handle_funding_created(byte[] their_node_id, org.ldk.structs.FundingCreated msg) { bindings.ChannelMessageHandler_handle_funding_created(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -307,7 +304,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming funding_signed message from the given peer. + * Handle an incoming `funding_signed` message from the given peer. */ public void handle_funding_signed(byte[] their_node_id, org.ldk.structs.FundingSigned msg) { bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -318,7 +315,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming channel_ready message from the given peer. + * Handle an incoming `channel_ready` message from the given peer. */ public void handle_channel_ready(byte[] their_node_id, org.ldk.structs.ChannelReady msg) { bindings.ChannelMessageHandler_handle_channel_ready(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -329,20 +326,18 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming shutdown message from the given peer. + * Handle an incoming `shutdown` message from the given peer. */ - public void handle_shutdown(byte[] their_node_id, org.ldk.structs.InitFeatures their_features, org.ldk.structs.Shutdown msg) { - bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr, msg == null ? 0 : msg.ptr); + public void handle_shutdown(byte[] their_node_id, org.ldk.structs.Shutdown msg) { + bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); - Reference.reachabilityFence(their_features); Reference.reachabilityFence(msg); - if (this != null) { this.ptrs_to.add(their_features); }; if (this != null) { this.ptrs_to.add(msg); }; } /** - * Handle an incoming closing_signed message from the given peer. + * Handle an incoming `closing_signed` message from the given peer. */ public void handle_closing_signed(byte[] their_node_id, org.ldk.structs.ClosingSigned msg) { bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -353,7 +348,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming update_add_htlc message from the given peer. + * Handle an incoming `update_add_htlc` message from the given peer. */ public void handle_update_add_htlc(byte[] their_node_id, org.ldk.structs.UpdateAddHTLC msg) { bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -364,7 +359,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming update_fulfill_htlc message from the given peer. + * Handle an incoming `update_fulfill_htlc` message from the given peer. */ public void handle_update_fulfill_htlc(byte[] their_node_id, org.ldk.structs.UpdateFulfillHTLC msg) { bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -375,7 +370,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming update_fail_htlc message from the given peer. + * Handle an incoming `update_fail_htlc` message from the given peer. */ public void handle_update_fail_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailHTLC msg) { bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -386,7 +381,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming update_fail_malformed_htlc message from the given peer. + * Handle an incoming `update_fail_malformed_htlc` message from the given peer. */ public void handle_update_fail_malformed_htlc(byte[] their_node_id, org.ldk.structs.UpdateFailMalformedHTLC msg) { bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -397,7 +392,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming commitment_signed message from the given peer. + * Handle an incoming `commitment_signed` message from the given peer. */ public void handle_commitment_signed(byte[] their_node_id, org.ldk.structs.CommitmentSigned msg) { bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -408,7 +403,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming revoke_and_ack message from the given peer. + * Handle an incoming `revoke_and_ack` message from the given peer. */ public void handle_revoke_and_ack(byte[] their_node_id, org.ldk.structs.RevokeAndACK msg) { bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -419,7 +414,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming update_fee message from the given peer. + * Handle an incoming `update_fee` message from the given peer. */ public void handle_update_fee(byte[] their_node_id, org.ldk.structs.UpdateFee msg) { bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -430,7 +425,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming announcement_signatures message from the given peer. + * Handle an incoming `announcement_signatures` message from the given peer. */ public void handle_announcement_signatures(byte[] their_node_id, org.ldk.structs.AnnouncementSignatures msg) { bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -441,33 +436,27 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Indicates a connection to the peer failed/an existing connection was lost. If no connection - * is believed to be possible in the future (eg they're sending us messages we don't - * understand or indicate they require unknown feature bits), no_connection_possible is set - * and any outstanding channels should be failed. - * - * Note that in some rare cases this may be called without a corresponding - * [`Self::peer_connected`]. + * Indicates a connection to the peer failed/an existing connection was lost. */ - public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) { - bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), no_connection_possible); + public void peer_disconnected(byte[] their_node_id) { + bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33)); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); - Reference.reachabilityFence(no_connection_possible); } /** - * Handle a peer reconnecting, possibly generating channel_reestablish message(s). + * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). * * May return an `Err(())` if the features the peer supports are not sufficient to communicate * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init msg) { - long ret = bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); + public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init msg, boolean inbound) { + long ret = bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr, inbound); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); Reference.reachabilityFence(msg); + Reference.reachabilityFence(inbound); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(msg); }; @@ -475,7 +464,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming channel_reestablish message from the given peer. + * Handle an incoming `channel_reestablish` message from the given peer. */ public void handle_channel_reestablish(byte[] their_node_id, org.ldk.structs.ChannelReestablish msg) { bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -486,7 +475,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming channel update from the given peer. + * Handle an incoming `channel_update` message from the given peer. */ public void handle_channel_update(byte[] their_node_id, org.ldk.structs.ChannelUpdate msg) { bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -497,7 +486,7 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Handle an incoming error message from the given peer. + * Handle an incoming `error` message from the given peer. */ public void handle_error(byte[] their_node_id, org.ldk.structs.ErrorMessage msg) { bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); diff --git a/src/main/java/org/ldk/structs/ChannelReady.java b/src/main/java/org/ldk/structs/ChannelReady.java index c3eb0ca2..7ed5ab34 100644 --- a/src/main/java/org/ldk/structs/ChannelReady.java +++ b/src/main/java/org/ldk/structs/ChannelReady.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A channel_ready message to be sent or received from a peer + * A [`channel_ready`] message to be sent to or received from a peer. + * + * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChannelReady extends CommonBase { @@ -57,8 +59,10 @@ public class ChannelReady extends CommonBase { } /** - * If set, provides a short_channel_id alias for this channel. The sender will accept payments - * to be forwarded over this SCID and forward them to this messages' recipient. + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ public Option_u64Z get_short_channel_id_alias() { long ret = bindings.ChannelReady_get_short_channel_id_alias(this.ptr); @@ -70,13 +74,16 @@ public class ChannelReady extends CommonBase { } /** - * If set, provides a short_channel_id alias for this channel. The sender will accept payments - * to be forwarded over this SCID and forward them to this messages' recipient. + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ public void set_short_channel_id_alias(org.ldk.structs.Option_u64Z val) { bindings.ChannelReady_set_short_channel_id_alias(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -90,6 +97,7 @@ public class ChannelReady extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id_alias_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ChannelReestablish.java b/src/main/java/org/ldk/structs/ChannelReestablish.java index a60f3fbe..458bbcd8 100644 --- a/src/main/java/org/ldk/structs/ChannelReestablish.java +++ b/src/main/java/org/ldk/structs/ChannelReestablish.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A channel_reestablish message to be sent or received from a peer + * A [`channel_reestablish`] message to be sent to or received from a peer. + * + * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChannelReestablish extends CommonBase { diff --git a/src/main/java/org/ldk/structs/ChannelSigner.java b/src/main/java/org/ldk/structs/ChannelSigner.java new file mode 100644 index 00000000..ca3c5e31 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelSigner.java @@ -0,0 +1,227 @@ +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 trait to handle Lightning channel key material without concretizing the channel type or + * the signature mechanism. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ChannelSigner extends CommonBase { + final bindings.LDKChannelSigner bindings_instance; + ChannelSigner(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private ChannelSigner(bindings.LDKChannelSigner arg, ChannelPublicKeys pubkeys) { + super(bindings.LDKChannelSigner_new(arg, pubkeys == null ? 0 : pubkeys.clone_ptr())); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.ChannelSigner_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.ChannelSigner_free(ptr); } + ptr = 0; + } + public static interface ChannelSignerInterface { + /** + * Gets the per-commitment point for a specific commitment number + * + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + */ + byte[] get_per_commitment_point(long idx); + /** + * Gets the commitment secret for a specific commitment number as part of the revocation process + * + * An external signer implementation should error here if the commitment was already signed + * and should refuse to sign it in the future. + * + * May be called more than once for the same index. + * + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + */ + byte[] release_commitment_secret(long idx); + /** + * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. + * + * This is required in order for the signer to make sure that releasing a commitment + * secret won't leave us without a broadcastable holder transaction. + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * Note that all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. + */ + Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages); + /** + * Returns an arbitrary identifier describing the set of keys which are provided back to you in + * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this + * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. + */ + byte[] channel_keys_id(); + /** + * Set the counterparty static channel data, including basepoints, + * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. + * + * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] + * instance, LDK will call this method exactly once - either immediately after construction + * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding + * information has been generated. + * + * channel_parameters.is_populated() MUST be true. + */ + void provide_channel_parameters(ChannelTransactionParameters channel_parameters); + } + private static class LDKChannelSignerHolder { ChannelSigner held; } + public static ChannelSigner new_impl(ChannelSignerInterface arg, ChannelPublicKeys pubkeys) { + final LDKChannelSignerHolder impl_holder = new LDKChannelSignerHolder(); + impl_holder.held = new ChannelSigner(new bindings.LDKChannelSigner() { + @Override public byte[] get_per_commitment_point(long idx) { + byte[] ret = arg.get_per_commitment_point(idx); + Reference.reachabilityFence(arg); + byte[] result = InternalUtils.check_arr_len(ret, 33); + return result; + } + @Override public byte[] release_commitment_secret(long idx) { + byte[] ret = arg.release_commitment_secret(idx); + Reference.reachabilityFence(arg); + byte[] result = InternalUtils.check_arr_len(ret, 32); + return result; + } + @Override public long validate_holder_commitment(long holder_tx, byte[][] preimages) { + org.ldk.structs.HolderCommitmentTransaction holder_tx_hu_conv = null; if (holder_tx < 0 || holder_tx > 4096) { holder_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, holder_tx); } + Result_NoneNoneZ ret = arg.validate_holder_commitment(holder_tx_hu_conv, preimages); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public byte[] channel_keys_id() { + byte[] ret = arg.channel_keys_id(); + Reference.reachabilityFence(arg); + byte[] result = InternalUtils.check_arr_len(ret, 32); + return result; + } + @Override public void provide_channel_parameters(long channel_parameters) { + org.ldk.structs.ChannelTransactionParameters channel_parameters_hu_conv = null; if (channel_parameters < 0 || channel_parameters > 4096) { channel_parameters_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, channel_parameters); } + arg.provide_channel_parameters(channel_parameters_hu_conv); + Reference.reachabilityFence(arg); + } + }, pubkeys); + return impl_holder.held; + } + /** + * Gets the per-commitment point for a specific commitment number + * + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + */ + public byte[] get_per_commitment_point(long idx) { + byte[] ret = bindings.ChannelSigner_get_per_commitment_point(this.ptr, idx); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); + return ret; + } + + /** + * Gets the commitment secret for a specific commitment number as part of the revocation process + * + * An external signer implementation should error here if the commitment was already signed + * and should refuse to sign it in the future. + * + * May be called more than once for the same index. + * + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + */ + public byte[] release_commitment_secret(long idx) { + byte[] ret = bindings.ChannelSigner_release_commitment_secret(this.ptr, idx); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); + return ret; + } + + /** + * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. + * + * This is required in order for the signer to make sure that releasing a commitment + * secret won't leave us without a broadcastable holder transaction. + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * Note that all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. + */ + public Result_NoneNoneZ validate_holder_commitment(org.ldk.structs.HolderCommitmentTransaction holder_tx, byte[][] preimages) { + long ret = bindings.ChannelSigner_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr, preimages != null ? Arrays.stream(preimages).map(preimages_conv_8 -> InternalUtils.check_arr_len(preimages_conv_8, 32)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(holder_tx); + Reference.reachabilityFence(preimages); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(holder_tx); }; + return ret_hu_conv; + } + + /** + * Returns an arbitrary identifier describing the set of keys which are provided back to you in + * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this + * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. + */ + public byte[] channel_keys_id() { + byte[] ret = bindings.ChannelSigner_channel_keys_id(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Set the counterparty static channel data, including basepoints, + * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. + * + * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] + * instance, LDK will call this method exactly once - either immediately after construction + * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding + * information has been generated. + * + * channel_parameters.is_populated() MUST be true. + */ + public void provide_channel_parameters(org.ldk.structs.ChannelTransactionParameters channel_parameters) { + bindings.ChannelSigner_provide_channel_parameters(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_parameters); + if (this != null) { this.ptrs_to.add(channel_parameters); }; + } + + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + public ChannelPublicKeys get_pubkeys() { + long ret = bindings.ChannelSigner_get_pubkeys(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelTypeFeatures.java b/src/main/java/org/ldk/structs/ChannelTypeFeatures.java index 54b7de0b..13f69bc8 100644 --- a/src/main/java/org/ldk/structs/ChannelTypeFeatures.java +++ b/src/main/java/org/ldk/structs/ChannelTypeFeatures.java @@ -139,6 +139,40 @@ public class ChannelTypeFeatures extends CommonBase { return ret; } + /** + * Set this feature as optional. + */ + public void set_anchors_zero_fee_htlc_tx_optional() { + bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Set this feature as required. + */ + public void set_anchors_zero_fee_htlc_tx_required() { + bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Checks if this feature is supported. + */ + public boolean supports_anchors_zero_fee_htlc_tx() { + boolean ret = bindings.ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Checks if this feature is required. + */ + public boolean requires_anchors_zero_fee_htlc_tx() { + boolean ret = bindings.ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Set this feature as optional. */ diff --git a/src/main/java/org/ldk/structs/ChannelUpdate.java b/src/main/java/org/ldk/structs/ChannelUpdate.java index 2063afc4..97d0f60b 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdate.java +++ b/src/main/java/org/ldk/structs/ChannelUpdate.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A channel_update message to be sent or received from a peer + * A [`channel_update`] message to be sent to or received from a peer. + * + * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChannelUpdate extends CommonBase { diff --git a/src/main/java/org/ldk/structs/ChannelUsage.java b/src/main/java/org/ldk/structs/ChannelUsage.java index 7795c2fe..6dcec4a6 100644 --- a/src/main/java/org/ldk/structs/ChannelUsage.java +++ b/src/main/java/org/ldk/structs/ChannelUsage.java @@ -77,6 +77,7 @@ public class ChannelUsage extends CommonBase { bindings.ChannelUsage_set_effective_capacity(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -90,6 +91,7 @@ public class ChannelUsage extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ChannelUsage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUsage(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(effective_capacity_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ClosingSigned.java b/src/main/java/org/ldk/structs/ClosingSigned.java index 55a537bf..cfb4968d 100644 --- a/src/main/java/org/ldk/structs/ClosingSigned.java +++ b/src/main/java/org/ldk/structs/ClosingSigned.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A closing_signed message to be sent or received from a peer + * A [`closing_signed`] message to be sent to or received from a peer. + * + * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ClosingSigned extends CommonBase { diff --git a/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java b/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java index e576e3a7..5f6ed3f5 100644 --- a/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java +++ b/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java @@ -10,6 +10,7 @@ import javax.annotation.Nullable; /** * The minimum and maximum fees which the sender is willing to place on the closing transaction. + * * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing * to use. */ diff --git a/src/main/java/org/ldk/structs/CommitmentSigned.java b/src/main/java/org/ldk/structs/CommitmentSigned.java index 4e336240..e6c73061 100644 --- a/src/main/java/org/ldk/structs/CommitmentSigned.java +++ b/src/main/java/org/ldk/structs/CommitmentSigned.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A commitment_signed message to be sent or received from a peer + * A [`commitment_signed`] message to be sent to or received from a peer. + * + * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class CommitmentSigned extends CommonBase { diff --git a/src/main/java/org/ldk/structs/CommitmentUpdate.java b/src/main/java/org/ldk/structs/CommitmentUpdate.java index a2b8ff0c..1797cfbf 100644 --- a/src/main/java/org/ldk/structs/CommitmentUpdate.java +++ b/src/main/java/org/ldk/structs/CommitmentUpdate.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment + * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment * transaction updates if they were pending. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays @@ -22,7 +22,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_add_htlc messages which should be sent + * `update_add_htlc` messages which should be sent */ public UpdateAddHTLC[] get_update_add_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_add_htlcs(this.ptr); @@ -39,7 +39,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_add_htlc messages which should be sent + * `update_add_htlc` messages which should be sent */ public void set_update_add_htlcs(UpdateAddHTLC[] val) { bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr).toArray() : null); @@ -49,7 +49,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_fulfill_htlc messages which should be sent + * `update_fulfill_htlc` messages which should be sent */ public UpdateFulfillHTLC[] get_update_fulfill_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_fulfill_htlcs(this.ptr); @@ -66,7 +66,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_fulfill_htlc messages which should be sent + * `update_fulfill_htlc` messages which should be sent */ public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) { bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr).toArray() : null); @@ -76,7 +76,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_fail_htlc messages which should be sent + * `update_fail_htlc` messages which should be sent */ public UpdateFailHTLC[] get_update_fail_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_fail_htlcs(this.ptr); @@ -93,7 +93,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_fail_htlc messages which should be sent + * `update_fail_htlc` messages which should be sent */ public void set_update_fail_htlcs(UpdateFailHTLC[] val) { bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr).toArray() : null); @@ -103,7 +103,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_fail_malformed_htlc messages which should be sent + * `update_fail_malformed_htlc` messages which should be sent */ public UpdateFailMalformedHTLC[] get_update_fail_malformed_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_fail_malformed_htlcs(this.ptr); @@ -120,7 +120,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * update_fail_malformed_htlc messages which should be sent + * `update_fail_malformed_htlc` messages which should be sent */ public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) { bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr).toArray() : null); @@ -130,7 +130,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * An update_fee message which should be sent + * An `update_fee` message which should be sent * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -145,7 +145,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * An update_fee message which should be sent + * An `update_fee` message which should be sent * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -157,7 +157,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * Finally, the commitment_signed message which should be sent + * A `commitment_signed` message which should be sent */ public CommitmentSigned get_commitment_signed() { long ret = bindings.CommitmentUpdate_get_commitment_signed(this.ptr); @@ -169,7 +169,7 @@ public class CommitmentUpdate extends CommonBase { } /** - * Finally, the commitment_signed message which should be sent + * A `commitment_signed` message which should be sent */ public void set_commitment_signed(org.ldk.structs.CommitmentSigned val) { bindings.CommitmentUpdate_set_commitment_signed(this.ptr, val == null ? 0 : val.ptr); diff --git a/src/main/java/org/ldk/structs/Confirm.java b/src/main/java/org/ldk/structs/Confirm.java index 8894da4e..077eb95c 100644 --- a/src/main/java/org/ldk/structs/Confirm.java +++ b/src/main/java/org/ldk/structs/Confirm.java @@ -58,7 +58,19 @@ public class Confirm extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Confirm_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Confirm_free(ptr); } + ptr = 0; + } public static interface ConfirmInterface { /** * Notifies LDK of transactions confirmed in a block with a given header and height. @@ -99,6 +111,9 @@ public class Confirm extends CommonBase { * Returns transactions that must be monitored for reorganization out of the chain along * with the hash of the block as part of which it had been previously confirmed. * + * Note that the returned `Option` might be `None` for channels created with LDK + * 0.0.112 and prior, in which case you need to manually track previous confirmations. + * * Will include any transactions passed to [`transactions_confirmed`] that have insufficient * confirmations to be safe from a chain reorganization. Will not include any transactions * passed to [`transaction_unconfirmed`], unless later reconfirmed. @@ -207,6 +222,9 @@ public class Confirm extends CommonBase { * Returns transactions that must be monitored for reorganization out of the chain along * with the hash of the block as part of which it had been previously confirmed. * + * Note that the returned `Option` might be `None` for channels created with LDK + * 0.0.112 and prior, in which case you need to manually track previous confirmations. + * * Will include any transactions passed to [`transactions_confirmed`] that have insufficient * confirmations to be safe from a chain reorganization. Will not include any transactions * passed to [`transaction_unconfirmed`], unless later reconfirmed. diff --git a/src/main/java/org/ldk/structs/CustomMessageHandler.java b/src/main/java/org/ldk/structs/CustomMessageHandler.java index 5d1586b6..7425c2eb 100644 --- a/src/main/java/org/ldk/structs/CustomMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomMessageHandler.java @@ -8,7 +8,14 @@ import java.lang.ref.Reference; import javax.annotation.Nullable; /** - * Handler for BOLT1-compliant messages. + * A handler provided to [`PeerManager`] for reading and handling custom messages. + * + * [BOLT 1] specifies a custom message type range for use with experimental or application-specific + * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the + * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler. + * + * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md + * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class CustomMessageHandler extends CommonBase { @@ -24,18 +31,30 @@ public class CustomMessageHandler extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.CustomMessageHandler_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.CustomMessageHandler_free(ptr); } + ptr = 0; + } public static interface CustomMessageHandlerInterface { /** - * Called with the message type that was received and the buffer to be read. - * Can return a `MessageHandlingError` if the message could not be handled. + * Handles the given message sent from `sender_node_id`, possibly producing messages for + * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`] + * to send. */ Result_NoneLightningErrorZ handle_custom_message(Type msg, byte[] sender_node_id); /** - * Gets the list of pending messages which were generated by the custom message - * handler, clearing the list in the process. The first tuple element must - * correspond to the intended recipients node ids. If no connection to one of the - * specified node does not exist, the message is simply not sent to it. + * Returns the list of pending messages that were generated by the handler, clearing the list + * in the process. Each message is paired with the node id of the intended recipient. If no + * connection to the node exists, then the message is simply not sent. */ TwoTuple_PublicKeyTypeZ[] get_and_clear_pending_msg(); } @@ -66,13 +85,14 @@ public class CustomMessageHandler extends CommonBase { */ public CustomMessageReader get_custom_message_reader() { CustomMessageReader res = new CustomMessageReader(null, bindings.LDKCustomMessageHandler_get_CustomMessageReader(this.ptr)); - this.ptrs_to.add(res); + res.ptrs_to.add(this); return res; } /** - * Called with the message type that was received and the buffer to be read. - * Can return a `MessageHandlingError` if the message could not be handled. + * Handles the given message sent from `sender_node_id`, possibly producing messages for + * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`] + * to send. */ public Result_NoneLightningErrorZ handle_custom_message(org.ldk.structs.Type msg, byte[] sender_node_id) { long ret = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg == null ? 0 : msg.ptr, InternalUtils.check_arr_len(sender_node_id, 33)); @@ -86,10 +106,9 @@ public class CustomMessageHandler extends CommonBase { } /** - * Gets the list of pending messages which were generated by the custom message - * handler, clearing the list in the process. The first tuple element must - * correspond to the intended recipients node ids. If no connection to one of the - * specified node does not exist, the message is simply not sent to it. + * Returns the list of pending messages that were generated by the handler, clearing the list + * in the process. Each message is paired with the node id of the intended recipient. If no + * connection to the node exists, then the message is simply not sent. */ public TwoTuple_PublicKeyTypeZ[] get_and_clear_pending_msg() { long[] ret = bindings.CustomMessageHandler_get_and_clear_pending_msg(this.ptr); diff --git a/src/main/java/org/ldk/structs/CustomMessageReader.java b/src/main/java/org/ldk/structs/CustomMessageReader.java index 954c92b7..fa2720f1 100644 --- a/src/main/java/org/ldk/structs/CustomMessageReader.java +++ b/src/main/java/org/ldk/structs/CustomMessageReader.java @@ -24,7 +24,19 @@ public class CustomMessageReader extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.CustomMessageReader_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.CustomMessageReader_free(ptr); } + ptr = 0; + } public static interface CustomMessageReaderInterface { /** * Decodes a custom message to `CustomMessageType`. If the given message type is known to the diff --git a/src/main/java/org/ldk/structs/CustomOnionMessageContents.java b/src/main/java/org/ldk/structs/CustomOnionMessageContents.java index 79edade6..de9e7ae0 100644 --- a/src/main/java/org/ldk/structs/CustomOnionMessageContents.java +++ b/src/main/java/org/ldk/structs/CustomOnionMessageContents.java @@ -23,7 +23,19 @@ public class CustomOnionMessageContents extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.CustomOnionMessageContents_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.CustomOnionMessageContents_free(ptr); } + ptr = 0; + } public static interface CustomOnionMessageContentsInterface { /** * Returns the TLV type identifying the message contents. MUST be >= 64. diff --git a/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java b/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java index ae8f6044..33d21a30 100644 --- a/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java @@ -32,7 +32,19 @@ public class CustomOnionMessageHandler extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.CustomOnionMessageHandler_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.CustomOnionMessageHandler_free(ptr); } + ptr = 0; + } public static interface CustomOnionMessageHandlerInterface { /** * Called with the custom message that was received. diff --git a/src/main/java/org/ldk/structs/DataLossProtect.java b/src/main/java/org/ldk/structs/DataLossProtect.java index d094c5dc..e8f2aea7 100644 --- a/src/main/java/org/ldk/structs/DataLossProtect.java +++ b/src/main/java/org/ldk/structs/DataLossProtect.java @@ -10,8 +10,9 @@ import javax.annotation.Nullable; /** * Proof that the sender knows the per-commitment secret of the previous commitment transaction. + * * This is used to convince the recipient that the channel is at a certain commitment - * number even if they lost that data due to a local failure. Of course, the peer may lie + * number even if they lost that data due to a local failure. Of course, the peer may lie * and even later commitments may have been revoked. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays diff --git a/src/main/java/org/ldk/structs/DecodeError.java b/src/main/java/org/ldk/structs/DecodeError.java index 0dc34a05..d0937077 100644 --- a/src/main/java/org/ldk/structs/DecodeError.java +++ b/src/main/java/org/ldk/structs/DecodeError.java @@ -47,7 +47,8 @@ public class DecodeError extends CommonBase { /** * A version byte specified something we don't know how to handle. - * Includes unknown realm byte in an OnionHopData packet + * + * Includes unknown realm byte in an onion hop data packet. */ public final static class UnknownVersion extends DecodeError { private UnknownVersion(long ptr, bindings.LDKDecodeError.UnknownVersion obj) { @@ -55,7 +56,7 @@ public class DecodeError extends CommonBase { } } /** - * Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type) + * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) */ public final static class UnknownRequiredFeature extends DecodeError { private UnknownRequiredFeature(long ptr, bindings.LDKDecodeError.UnknownRequiredFeature obj) { @@ -63,9 +64,11 @@ public class DecodeError extends CommonBase { } } /** - * Value was invalid, eg a byte which was supposed to be a bool was something other than a 0 + * Value was invalid. + * + * For example, a byte which was supposed to be a bool was something other than a 0 * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was - * syntactically incorrect, etc + * syntactically incorrect, etc. */ public final static class InvalidValue extends DecodeError { private InvalidValue(long ptr, bindings.LDKDecodeError.InvalidValue obj) { @@ -73,7 +76,7 @@ public class DecodeError extends CommonBase { } } /** - * Buffer too short + * The buffer to be read was too short. */ public final static class ShortRead extends DecodeError { private ShortRead(long ptr, bindings.LDKDecodeError.ShortRead obj) { @@ -81,7 +84,7 @@ public class DecodeError extends CommonBase { } } /** - * A length descriptor in the packet didn't describe the later data correctly + * A length descriptor in the packet didn't describe the later data correctly. */ public final static class BadLengthDescriptor extends DecodeError { private BadLengthDescriptor(long ptr, bindings.LDKDecodeError.BadLengthDescriptor obj) { @@ -89,7 +92,7 @@ public class DecodeError extends CommonBase { } } /** - * Error from std::io + * Error from [`std::io`]. */ public final static class Io extends DecodeError { public final org.ldk.enums.IOError io; diff --git a/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java b/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java index 57710427..7f9f7692 100644 --- a/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java @@ -125,7 +125,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { } /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. * This may be useful in re-deriving keys used in the channel to spend the output. */ public byte[] get_channel_keys_id() { @@ -135,7 +135,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { } /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. * This may be useful in re-deriving keys used in the channel to spend the output. */ public void set_channel_keys_id(byte[] val) { diff --git a/src/main/java/org/ldk/structs/EcdsaChannelSigner.java b/src/main/java/org/ldk/structs/EcdsaChannelSigner.java new file mode 100644 index 00000000..a19e255c --- /dev/null +++ b/src/main/java/org/ldk/structs/EcdsaChannelSigner.java @@ -0,0 +1,463 @@ +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 trait to sign Lightning channel transactions as described in + * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). + * + * Signing services could be implemented on a hardware wallet and should implement signing + * policies in order to be secure. Please refer to the [VLS Policy + * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) + * for an example of such policies. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class EcdsaChannelSigner extends CommonBase { + final bindings.LDKEcdsaChannelSigner bindings_instance; + EcdsaChannelSigner(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private EcdsaChannelSigner(bindings.LDKEcdsaChannelSigner arg, bindings.LDKChannelSigner ChannelSigner, ChannelPublicKeys pubkeys) { + super(bindings.LDKEcdsaChannelSigner_new(arg, ChannelSigner, pubkeys == null ? 0 : pubkeys.clone_ptr())); + this.ptrs_to.add(arg); + this.ptrs_to.add(ChannelSigner); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); } + ptr = 0; + } + public static interface EcdsaChannelSignerInterface { + /** + * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. + * + * Note that if signing fails or is rejected, the channel will be force-closed. + * + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * Note that all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. + */ + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] preimages); + /** + * Validate the counterparty's revocation. + * + * This is required in order for the signer to make sure that the state has moved + * forward and it is safe to sign the next counterparty commitment. + */ + Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret); + /** + * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * + * This will be called + * - with a non-revoked `commitment_tx`. + * - with the latest `commitment_tx` when we initiate a force-close. + * - with the previous `commitment_tx`, just to get claiming HTLC + * signatures, if we are reacting to a [`ChannelMonitor`] + * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * that decided to broadcast before it had been updated to the latest `commitment_tx`. + * + * This may be called multiple times for the same transaction. + * + * An external signer implementation should check that the commitment has not been revoked. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx); + /** + * Create a signature for the given input in a transaction spending an HTLC transaction output + * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * `per_commitment_key` is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do + * so). + */ + Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key); + /** + * Create a signature for the given input in a transaction spending a commitment transaction + * HTLC output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * `amount` is the value of the output spent by this input, committed to in the BIP 143 + * signature. + * + * `per_commitment_key` is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). + * + * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script + * (which is committed to in the BIP 143 signatures). + */ + Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc); + /** + * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment + * transaction, either offered or received. + * + * Such a transaction may claim multiples offered outputs at same time if we know the + * preimage for each when we create it, but only the input at index `input` should be + * signed for here. It may be called multiple times for same output(s) if a fee-bump is + * needed with regards to an upcoming timelock expiration. + * + * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC + * outputs. + * + * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. + * + * `per_commitment_point` is the dynamic point corresponding to the channel state + * detected onchain. It has been generated by our counterparty and is used to derive + * channel state keys, which are then included in the witness script and committed to in the + * BIP 143 signature. + */ + Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc); + /** + * Create a signature for a (proposed) closing transaction. + * + * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have + * chosen to forgo their output as dust. + */ + Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx); + /** + * Computes the signature for a commitment transaction's anchor output used as an + * input within `anchor_tx`, which spends the commitment transaction, at index `input`. + */ + Result_SignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input); + /** + * Signs a channel announcement message with our funding key proving it comes from one of the + * channel participants. + * + * Channel announcements also require a signature from each node's network key. Our node + * signature is computed through [`NodeSigner::sign_gossip_message`]. + * + * Note that if this fails or is rejected, the channel will not be publicly announced and + * our counterparty may (though likely will not) close the channel on us for violating the + * protocol. + */ + Result_SignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg); + } + private static class LDKEcdsaChannelSignerHolder { EcdsaChannelSigner held; } + public static EcdsaChannelSigner new_impl(EcdsaChannelSignerInterface arg, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) { + final LDKEcdsaChannelSignerHolder impl_holder = new LDKEcdsaChannelSignerHolder(); + impl_holder.held = new EcdsaChannelSigner(new bindings.LDKEcdsaChannelSigner() { + @Override public long sign_counterparty_commitment(long commitment_tx, byte[][] preimages) { + org.ldk.structs.CommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new org.ldk.structs.CommitmentTransaction(null, commitment_tx); } + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv, preimages); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long validate_counterparty_revocation(long idx, byte[] secret) { + Result_NoneNoneZ ret = arg.validate_counterparty_revocation(idx, secret); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_holder_commitment_and_htlcs(long commitment_tx) { + org.ldk.structs.HolderCommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, commitment_tx); } + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) { + Result_SignatureNoneZ ret = arg.sign_justice_revoked_output(justice_tx, input, amount, per_commitment_key); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) { + org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); } + Result_SignatureNoneZ ret = arg.sign_justice_revoked_htlc(justice_tx, input, amount, per_commitment_key, htlc_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) { + org.ldk.structs.HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, htlc); } + Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_closing_transaction(long closing_tx) { + org.ldk.structs.ClosingTransaction closing_tx_hu_conv = null; if (closing_tx < 0 || closing_tx > 4096) { closing_tx_hu_conv = new org.ldk.structs.ClosingTransaction(null, closing_tx); } + Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_holder_anchor_input(byte[] anchor_tx, long input) { + Result_SignatureNoneZ ret = arg.sign_holder_anchor_input(anchor_tx, input); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_channel_announcement_with_funding_key(long msg) { + org.ldk.structs.UnsignedChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, msg); } + Result_SignatureNoneZ ret = arg.sign_channel_announcement_with_funding_key(msg_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + }, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys); + return impl_holder.held; + } + + /** + * Gets the underlying ChannelSigner. + */ + public ChannelSigner get_channel_signer() { + ChannelSigner res = new ChannelSigner(null, bindings.LDKEcdsaChannelSigner_get_ChannelSigner(this.ptr)); + res.ptrs_to.add(this); + return res; + } + + /** + * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. + * + * Note that if signing fails or is rejected, the channel will be force-closed. + * + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * Note that all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. + */ + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] preimages) { + long ret = bindings.EcdsaChannelSigner_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr, preimages != null ? Arrays.stream(preimages).map(preimages_conv_8 -> InternalUtils.check_arr_len(preimages_conv_8, 32)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(commitment_tx); + Reference.reachabilityFence(preimages); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(commitment_tx); }; + return ret_hu_conv; + } + + /** + * Validate the counterparty's revocation. + * + * This is required in order for the signer to make sure that the state has moved + * forward and it is safe to sign the next counterparty commitment. + */ + public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) { + long ret = bindings.EcdsaChannelSigner_validate_counterparty_revocation(this.ptr, idx, InternalUtils.check_arr_len(secret, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); + Reference.reachabilityFence(secret); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * + * This will be called + * - with a non-revoked `commitment_tx`. + * - with the latest `commitment_tx` when we initiate a force-close. + * - with the previous `commitment_tx`, just to get claiming HTLC + * signatures, if we are reacting to a [`ChannelMonitor`] + * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * that decided to broadcast before it had been updated to the latest `commitment_tx`. + * + * This may be called multiple times for the same transaction. + * + * An external signer implementation should check that the commitment has not been revoked. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(org.ldk.structs.HolderCommitmentTransaction commitment_tx) { + long ret = bindings.EcdsaChannelSigner_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(commitment_tx); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(commitment_tx); }; + return ret_hu_conv; + } + + /** + * Create a signature for the given input in a transaction spending an HTLC transaction output + * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * `per_commitment_key` is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do + * so). + */ + public Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) { + long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(justice_tx); + Reference.reachabilityFence(input); + Reference.reachabilityFence(amount); + Reference.reachabilityFence(per_commitment_key); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Create a signature for the given input in a transaction spending a commitment transaction + * HTLC output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * `amount` is the value of the output spent by this input, committed to in the BIP 143 + * signature. + * + * `per_commitment_key` is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). + * + * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script + * (which is committed to in the BIP 143 signatures). + */ + public Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) { + long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_htlc(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32), htlc == null ? 0 : htlc.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(justice_tx); + Reference.reachabilityFence(input); + Reference.reachabilityFence(amount); + Reference.reachabilityFence(per_commitment_key); + Reference.reachabilityFence(htlc); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(htlc); }; + return ret_hu_conv; + } + + /** + * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment + * transaction, either offered or received. + * + * Such a transaction may claim multiples offered outputs at same time if we know the + * preimage for each when we create it, but only the input at index `input` should be + * signed for here. It may be called multiple times for same output(s) if a fee-bump is + * needed with regards to an upcoming timelock expiration. + * + * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC + * outputs. + * + * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. + * + * `per_commitment_point` is the dynamic point corresponding to the channel state + * detected onchain. It has been generated by our counterparty and is used to derive + * channel state keys, which are then included in the witness script and committed to in the + * BIP 143 signature. + */ + public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) { + long ret = bindings.EcdsaChannelSigner_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, InternalUtils.check_arr_len(per_commitment_point, 33), htlc == null ? 0 : htlc.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(htlc_tx); + Reference.reachabilityFence(input); + Reference.reachabilityFence(amount); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(htlc); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(htlc); }; + return ret_hu_conv; + } + + /** + * Create a signature for a (proposed) closing transaction. + * + * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have + * chosen to forgo their output as dust. + */ + public Result_SignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) { + long ret = bindings.EcdsaChannelSigner_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(closing_tx); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(closing_tx); }; + return ret_hu_conv; + } + + /** + * Computes the signature for a commitment transaction's anchor output used as an + * input within `anchor_tx`, which spends the commitment transaction, at index `input`. + */ + public Result_SignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) { + long ret = bindings.EcdsaChannelSigner_sign_holder_anchor_input(this.ptr, anchor_tx, input); + Reference.reachabilityFence(this); + Reference.reachabilityFence(anchor_tx); + Reference.reachabilityFence(input); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Signs a channel announcement message with our funding key proving it comes from one of the + * channel participants. + * + * Channel announcements also require a signature from each node's network key. Our node + * signature is computed through [`NodeSigner::sign_gossip_message`]. + * + * Note that if this fails or is rejected, the channel will not be publicly announced and + * our counterparty may (though likely will not) close the channel on us for violating the + * protocol. + */ + public Result_SignatureNoneZ sign_channel_announcement_with_funding_key(org.ldk.structs.UnsignedChannelAnnouncement msg) { + long ret = bindings.EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this.ptr, msg == null ? 0 : msg.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(msg); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/EntropySource.java b/src/main/java/org/ldk/structs/EntropySource.java new file mode 100644 index 00000000..95f00655 --- /dev/null +++ b/src/main/java/org/ldk/structs/EntropySource.java @@ -0,0 +1,69 @@ +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 trait that describes a source of entropy. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class EntropySource extends CommonBase { + final bindings.LDKEntropySource bindings_instance; + EntropySource(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private EntropySource(bindings.LDKEntropySource arg) { + super(bindings.LDKEntropySource_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.EntropySource_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.EntropySource_free(ptr); } + ptr = 0; + } + public static interface EntropySourceInterface { + /** + * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a + * different value each time it is called. + */ + byte[] get_secure_random_bytes(); + } + private static class LDKEntropySourceHolder { EntropySource held; } + public static EntropySource new_impl(EntropySourceInterface arg) { + final LDKEntropySourceHolder impl_holder = new LDKEntropySourceHolder(); + impl_holder.held = new EntropySource(new bindings.LDKEntropySource() { + @Override public byte[] get_secure_random_bytes() { + byte[] ret = arg.get_secure_random_bytes(); + Reference.reachabilityFence(arg); + byte[] result = InternalUtils.check_arr_len(ret, 32); + return result; + } + }); + return impl_holder.held; + } + /** + * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a + * different value each time it is called. + */ + public byte[] get_secure_random_bytes() { + byte[] ret = bindings.EntropySource_get_secure_random_bytes(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/ErrorAction.java b/src/main/java/org/ldk/structs/ErrorAction.java index 167dbdc4..da9ce629 100644 --- a/src/main/java/org/ldk/structs/ErrorAction.java +++ b/src/main/java/org/ldk/structs/ErrorAction.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * Used to put an error message in a LightningError + * Used to put an error message in a [`LightningError`]. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ErrorAction extends CommonBase { diff --git a/src/main/java/org/ldk/structs/ErrorMessage.java b/src/main/java/org/ldk/structs/ErrorMessage.java index 84dcc822..6bcc9e22 100644 --- a/src/main/java/org/ldk/structs/ErrorMessage.java +++ b/src/main/java/org/ldk/structs/ErrorMessage.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An error message to be sent or received from a peer + * An [`error`] message to be sent to or received from a peer. + * + * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ErrorMessage extends CommonBase { @@ -46,8 +48,9 @@ public class ErrorMessage extends CommonBase { /** * A possibly human-readable error description. - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. */ public String get_data() { @@ -58,8 +61,9 @@ public class ErrorMessage extends CommonBase { /** * A possibly human-readable error description. - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. */ public void set_data(java.lang.String val) { diff --git a/src/main/java/org/ldk/structs/Event.java b/src/main/java/org/ldk/structs/Event.java index 26e3333a..858e95bc 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -139,10 +139,10 @@ public class Event extends CommonBase { * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`]. * * Note that if the preimage is not known, you should call - * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid - * network congestion. - * If you fail to call either [`ChannelManager::claim_funds`] or - * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be + * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`] + * to free up resources for this HTLC and avoid network congestion. + * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`], + * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be * automatically failed. * * # Note @@ -154,6 +154,7 @@ public class Event extends CommonBase { * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards + * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason */ public final static class PaymentClaimable extends Event { /** @@ -269,11 +270,9 @@ public class Event extends CommonBase { */ public final static class PaymentSent extends Event { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. + * The id returned by [`ChannelManager::send_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -315,21 +314,21 @@ public class Event extends CommonBase { } /** * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events - * provide failure information for each MPP part in the payment. + * provide failure information for each path attempt in the payment, including retries. * * This event is provided once there are no further pending HTLCs for the payment and the - * payment is no longer retryable due to [`ChannelManager::abandon_payment`] having been - * called for the corresponding payment. + * payment is no longer retryable, due either to the [`Retry`] provided or + * [`ChannelManager::abandon_payment`] having been called for the corresponding payment. * + * [`Retry`]: crate::ln::channelmanager::Retry * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ public final static class PaymentFailed extends Event { /** * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * [`ChannelManager::abandon_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ public final byte[] payment_id; @@ -353,11 +352,9 @@ public class Event extends CommonBase { */ public final static class PaymentPathSuccessful extends Event { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. + * The id returned by [`ChannelManager::send_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment */ public final byte[] payment_id; /** @@ -391,26 +388,23 @@ public class Event extends CommonBase { } } /** - * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. - * - * If you have given up retrying this payment and wish to fail it, you MUST call - * [`ChannelManager::abandon_payment`] at least once for a given [`PaymentId`] or memory - * related to payment tracking will leak. + * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to + * handle the HTLC. * * Note that this does *not* indicate that all paths for an MPP payment have failed, see - * [`Event::PaymentFailed`] and [`all_paths_failed`]. + * [`Event::PaymentFailed`]. + * + * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have + * been exhausted. * * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed */ public final static class PaymentPathFailed extends Event { /** * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * [`ChannelManager::abandon_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -424,40 +418,17 @@ public class Event extends CommonBase { public final byte[] payment_hash; /** * Indicates the payment was rejected for some reason by the recipient. This implies that - * the payment has failed, not just the route in question. If this is not set, you may - * retry the payment via a different route. + * the payment has failed, not just the route in question. If this is not set, the payment may + * be retried via a different route. */ public final boolean payment_failed_permanently; /** - * Any failure information conveyed via the Onion return packet by a node along the failed - * payment route. - * - * Should be applied to the [`NetworkGraph`] so that routing decisions can take into - * account the update. + * Extra error details based on the failure type. May contain an update that needs to be + * applied to the [`NetworkGraph`]. * * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph */ - public final org.ldk.structs.Option_NetworkUpdateZ network_update; - /** - * For both single-path and multi-path payments, this is set if all paths of the payment have - * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the - * larger MPP payment were still in flight when this event was generated. - * - * Note that if you are retrying individual MPP parts, using this value to determine if a - * payment has fully failed is race-y. Because multiple failures can happen prior to events - * being processed, you may retry in response to a first failure, with a second failure - * (with `all_paths_failed` set) still pending. Then, when the second failure is processed - * you will see `all_paths_failed` set even though the retry of the first failure still - * has an associated in-flight HTLC. See (1) for an example of such a failure. - * - * If you wish to retry individual MPP parts and learn when a payment has failed, you must - * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event. - * - * (1) - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - */ - public final boolean all_paths_failed; + public final org.ldk.structs.PathFailure failure; /** * The payment path that failed. */ @@ -474,12 +445,9 @@ public class Event extends CommonBase { */ public final org.ldk.structs.Option_u64Z short_channel_id; /** - * Parameters needed to compute a new [`Route`] when retrying the failed payment path. - * - * See [`find_route`] for details. + * Parameters used by LDK to compute a new [`Route`] when retrying the failed payment path. * * [`Route`]: crate::routing::router::Route - * [`find_route`]: crate::routing::router::find_route * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -489,11 +457,10 @@ public class Event extends CommonBase { this.payment_id = obj.payment_id; this.payment_hash = obj.payment_hash; this.payment_failed_permanently = obj.payment_failed_permanently; - long network_update = obj.network_update; - org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update); - if (network_update_hu_conv != null) { network_update_hu_conv.ptrs_to.add(this); }; - this.network_update = network_update_hu_conv; - this.all_paths_failed = obj.all_paths_failed; + long failure = obj.failure; + org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure); + if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.add(this); }; + this.failure = failure_hu_conv; long[] path = obj.path; int path_conv_10_len = path.length; RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len]; @@ -1002,6 +969,8 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_user_channel_id); }; return ret_hu_conv; } @@ -1017,6 +986,7 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); }; return ret_hu_conv; } @@ -1032,6 +1002,7 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); }; return ret_hu_conv; } @@ -1066,20 +1037,21 @@ public class Event extends CommonBase { /** * Utility method to constructs a new PaymentPathFailed-variant Event */ - public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, org.ldk.structs.Option_u64Z short_channel_id, org.ldk.structs.RouteParameters retry) { - long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr); + public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.PathFailure failure, RouteHop[] path, org.ldk.structs.Option_u64Z short_channel_id, org.ldk.structs.RouteParameters retry) { + long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr); Reference.reachabilityFence(payment_id); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(payment_failed_permanently); - Reference.reachabilityFence(network_update); - Reference.reachabilityFence(all_paths_failed); + Reference.reachabilityFence(failure); Reference.reachabilityFence(path); Reference.reachabilityFence(short_channel_id); Reference.reachabilityFence(retry); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); }; for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry); }; return ret_hu_conv; } @@ -1112,6 +1084,7 @@ public class Event extends CommonBase { org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; for (RouteHop path_conv_10: path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path_conv_10); }; }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); }; return ret_hu_conv; } @@ -1152,6 +1125,7 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; }; return ret_hu_conv; } @@ -1167,6 +1141,7 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_earned_msat); }; return ret_hu_conv; } @@ -1197,6 +1172,7 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); }; return ret_hu_conv; } @@ -1240,9 +1216,25 @@ public class Event extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); }; return ret_hu_conv; } + /** + * Checks if two Events contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ + public boolean eq(org.ldk.structs.Event b) { + boolean ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof Event)) return false; + return this.eq((Event)o); + } /** * Serialize the Event object into a byte array which can be read by Event_read */ diff --git a/src/main/java/org/ldk/structs/EventHandler.java b/src/main/java/org/ldk/structs/EventHandler.java index 6dfd4512..648ac755 100644 --- a/src/main/java/org/ldk/structs/EventHandler.java +++ b/src/main/java/org/ldk/structs/EventHandler.java @@ -27,7 +27,19 @@ public class EventHandler extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.EventHandler_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.EventHandler_free(ptr); } + ptr = 0; + } public static interface EventHandlerInterface { /** * Handles the given [`Event`]. @@ -58,6 +70,7 @@ public class EventHandler extends CommonBase { bindings.EventHandler_handle_event(this.ptr, event.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(event); + if (this != null) { this.ptrs_to.add(event); }; } } diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java index 8c34829c..db707f51 100644 --- a/src/main/java/org/ldk/structs/EventsProvider.java +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -58,7 +58,19 @@ public class EventsProvider extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.EventsProvider_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.EventsProvider_free(ptr); } + ptr = 0; + } public static interface EventsProviderInterface { /** * Processes any events generated since the last call using the given event handler. diff --git a/src/main/java/org/ldk/structs/ExpandedKey.java b/src/main/java/org/ldk/structs/ExpandedKey.java index 72e49811..8b22292c 100644 --- a/src/main/java/org/ldk/structs/ExpandedKey.java +++ b/src/main/java/org/ldk/structs/ExpandedKey.java @@ -10,9 +10,9 @@ import javax.annotation.Nullable; /** * A set of keys that were HKDF-expanded from an initial call to - * [`KeysInterface::get_inbound_payment_key_material`]. + * [`NodeSigner::get_inbound_payment_key_material`]. * - * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material + * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ExpandedKey extends CommonBase { diff --git a/src/main/java/org/ldk/structs/FeeEstimator.java b/src/main/java/org/ldk/structs/FeeEstimator.java index 1dea94b1..3aa73da4 100644 --- a/src/main/java/org/ldk/structs/FeeEstimator.java +++ b/src/main/java/org/ldk/structs/FeeEstimator.java @@ -27,7 +27,19 @@ public class FeeEstimator extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.FeeEstimator_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.FeeEstimator_free(ptr); } + ptr = 0; + } public static interface FeeEstimatorInterface { /** * Gets estimated satoshis of fee required per 1000 Weight-Units. diff --git a/src/main/java/org/ldk/structs/FilesystemPersister.java b/src/main/java/org/ldk/structs/FilesystemPersister.java index c6235e61..118a806b 100644 --- a/src/main/java/org/ldk/structs/FilesystemPersister.java +++ b/src/main/java/org/ldk/structs/FilesystemPersister.java @@ -56,13 +56,15 @@ public class FilesystemPersister extends CommonBase { /** * Read `ChannelMonitor`s from disk. */ - public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(org.ldk.structs.KeysInterface keys_manager) { - long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, keys_manager == null ? 0 : keys_manager.ptr); + public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.SignerProvider signer_provider) { + long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, entropy_source == null ? 0 : entropy_source.ptr, signer_provider == null ? 0 : signer_provider.ptr); Reference.reachabilityFence(this); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(signer_provider); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(keys_manager); }; + if (this != null) { this.ptrs_to.add(entropy_source); }; + if (this != null) { this.ptrs_to.add(signer_provider); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index f35fa9dc..0070014f 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -42,7 +42,19 @@ public class Filter extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Filter_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Filter_free(ptr); } + ptr = 0; + } public static interface FilterInterface { /** * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as diff --git a/src/main/java/org/ldk/structs/FundingCreated.java b/src/main/java/org/ldk/structs/FundingCreated.java index d0ec746a..bd4f3601 100644 --- a/src/main/java/org/ldk/structs/FundingCreated.java +++ b/src/main/java/org/ldk/structs/FundingCreated.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A funding_created message to be sent or received from a peer + * A [`funding_created`] message to be sent to or received from a peer. + * + * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class FundingCreated extends CommonBase { diff --git a/src/main/java/org/ldk/structs/FundingSigned.java b/src/main/java/org/ldk/structs/FundingSigned.java index 24658fe2..db7a73f4 100644 --- a/src/main/java/org/ldk/structs/FundingSigned.java +++ b/src/main/java/org/ldk/structs/FundingSigned.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A funding_signed message to be sent or received from a peer + * A [`funding_signed`] message to be sent to or received from a peer. + * + * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class FundingSigned extends CommonBase { diff --git a/src/main/java/org/ldk/structs/FutureCallback.java b/src/main/java/org/ldk/structs/FutureCallback.java index b21cea97..fc5e6796 100644 --- a/src/main/java/org/ldk/structs/FutureCallback.java +++ b/src/main/java/org/ldk/structs/FutureCallback.java @@ -30,7 +30,19 @@ public class FutureCallback extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.FutureCallback_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.FutureCallback_free(ptr); } + ptr = 0; + } public static interface FutureCallbackInterface { /** * The method which is called. diff --git a/src/main/java/org/ldk/structs/GossipTimestampFilter.java b/src/main/java/org/ldk/structs/GossipTimestampFilter.java index ddb158f6..61b78681 100644 --- a/src/main/java/org/ldk/structs/GossipTimestampFilter.java +++ b/src/main/java/org/ldk/structs/GossipTimestampFilter.java @@ -9,9 +9,11 @@ import javax.annotation.Nullable; /** - * A gossip_timestamp_filter message is used by a node to request + * A [`gossip_timestamp_filter`] message is used by a node to request * gossip relay for messages in the requested time range when the - * gossip_queries feature has been negotiated. + * `gossip_queries` feature has been negotiated. + * + * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class GossipTimestampFilter extends CommonBase { diff --git a/src/main/java/org/ldk/structs/GraphSyncError.java b/src/main/java/org/ldk/structs/GraphSyncError.java index 0febba31..cdc40d5e 100644 --- a/src/main/java/org/ldk/structs/GraphSyncError.java +++ b/src/main/java/org/ldk/structs/GraphSyncError.java @@ -85,6 +85,7 @@ public class GraphSyncError extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java index a69d0373..66a6de80 100644 --- a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java +++ b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java @@ -123,6 +123,7 @@ public class HTLCOutputInCommitment extends CommonBase { bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -138,6 +139,7 @@ public class HTLCOutputInCommitment extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(transaction_output_index_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Hostname.java b/src/main/java/org/ldk/structs/Hostname.java index fdf18a3a..1b49b170 100644 --- a/src/main/java/org/ldk/structs/Hostname.java +++ b/src/main/java/org/ldk/structs/Hostname.java @@ -13,7 +13,9 @@ import javax.annotation.Nullable; * 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. + * This serialization is used by [`BOLT 7`] hostnames. + * + * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Hostname extends CommonBase { diff --git a/src/main/java/org/ldk/structs/InMemorySigner.java b/src/main/java/org/ldk/structs/InMemorySigner.java index af36de28..71dbedfc 100644 --- a/src/main/java/org/ldk/structs/InMemorySigner.java +++ b/src/main/java/org/ldk/structs/InMemorySigner.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * A simple implementation of [`Sign`] that just keeps the private keys in memory. + * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory. * * This implementation performs no policy checks and is insufficient by itself as * a secure external signer. @@ -154,9 +154,8 @@ public class InMemorySigner extends CommonBase { /** * Creates a new [`InMemorySigner`]. */ - public static InMemorySigner of(byte[] node_secret, byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id) { - long ret = bindings.InMemorySigner_new(InternalUtils.check_arr_len(node_secret, 32), InternalUtils.check_arr_len(funding_key, 32), InternalUtils.check_arr_len(revocation_base_key, 32), InternalUtils.check_arr_len(payment_key, 32), InternalUtils.check_arr_len(delayed_payment_base_key, 32), InternalUtils.check_arr_len(htlc_base_key, 32), InternalUtils.check_arr_len(commitment_seed, 32), channel_value_satoshis, InternalUtils.check_arr_len(channel_keys_id, 32)); - Reference.reachabilityFence(node_secret); + public static InMemorySigner of(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id) { + long ret = bindings.InMemorySigner_new(InternalUtils.check_arr_len(funding_key, 32), InternalUtils.check_arr_len(revocation_base_key, 32), InternalUtils.check_arr_len(payment_key, 32), InternalUtils.check_arr_len(delayed_payment_base_key, 32), InternalUtils.check_arr_len(htlc_base_key, 32), InternalUtils.check_arr_len(commitment_seed, 32), channel_value_satoshis, InternalUtils.check_arr_len(channel_keys_id, 32)); Reference.reachabilityFence(funding_key); Reference.reachabilityFence(revocation_base_key); Reference.reachabilityFence(payment_key); @@ -174,7 +173,7 @@ public class InMemorySigner extends CommonBase { /** * Returns the counterparty's pubkeys. * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public ChannelPublicKeys counterparty_pubkeys() { long ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr); @@ -190,7 +189,7 @@ public class InMemorySigner extends CommonBase { * transactions, i.e., the amount of time that we have to wait to recover our funds if we * broadcast a transaction. * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public short counterparty_selected_contest_delay() { short ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr); @@ -203,7 +202,7 @@ public class InMemorySigner extends CommonBase { * by our counterparty, i.e., the amount of time that they have to wait to recover their funds * if they broadcast a transaction. * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public short holder_selected_contest_delay() { short ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr); @@ -214,7 +213,7 @@ public class InMemorySigner extends CommonBase { /** * Returns whether the holder is the initiator. * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public boolean is_outbound() { boolean ret = bindings.InMemorySigner_is_outbound(this.ptr); @@ -225,7 +224,7 @@ public class InMemorySigner extends CommonBase { /** * Funding outpoint * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public OutPoint funding_outpoint() { long ret = bindings.InMemorySigner_funding_outpoint(this.ptr); @@ -240,7 +239,7 @@ public class InMemorySigner extends CommonBase { * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or * building transactions. * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public ChannelTransactionParameters get_channel_parameters() { long ret = bindings.InMemorySigner_get_channel_parameters(this.ptr); @@ -254,7 +253,7 @@ public class InMemorySigner extends CommonBase { /** * Returns whether anchors should be used. * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ public boolean opt_anchors() { boolean ret = bindings.InMemorySigner_opt_anchors(this.ptr); @@ -309,27 +308,40 @@ public class InMemorySigner extends CommonBase { } /** - * Constructs a new BaseSign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is + * Constructs a new ChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is */ - public BaseSign as_BaseSign() { - long ret = bindings.InMemorySigner_as_BaseSign(this.ptr); + public ChannelSigner as_ChannelSigner() { + long ret = bindings.InMemorySigner_as_ChannelSigner(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - BaseSign ret_hu_conv = new BaseSign(null, ret); + ChannelSigner ret_hu_conv = new ChannelSigner(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** - * Constructs a new Sign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is + * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is */ - public Sign as_Sign() { - long ret = bindings.InMemorySigner_as_Sign(this.ptr); + public EcdsaChannelSigner as_EcdsaChannelSigner() { + long ret = bindings.InMemorySigner_as_EcdsaChannelSigner(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Sign ret_hu_conv = new Sign(null, ret); + EcdsaChannelSigner ret_hu_conv = new EcdsaChannelSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is + */ + public WriteableEcdsaChannelSigner as_WriteableEcdsaChannelSigner() { + long ret = bindings.InMemorySigner_as_WriteableEcdsaChannelSigner(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -346,10 +358,9 @@ public class InMemorySigner extends CommonBase { /** * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ - public static Result_InMemorySignerDecodeErrorZ read(byte[] ser, byte[] arg) { - long ret = bindings.InMemorySigner_read(ser, InternalUtils.check_arr_len(arg, 32)); + public static Result_InMemorySignerDecodeErrorZ read(byte[] ser) { + long ret = bindings.InMemorySigner_read(ser); Reference.reachabilityFence(ser); - Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; } Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index 7015c4d2..8b012239 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An init message to be sent or received from a peer + * An [`init`] message to be sent to or received from a peer. + * + * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Init extends CommonBase { @@ -21,7 +23,7 @@ public class Init extends CommonBase { } /** - * The relevant features which the sender supports + * The relevant features which the sender supports. */ public InitFeatures get_features() { long ret = bindings.Init_get_features(this.ptr); @@ -33,7 +35,7 @@ public class Init extends CommonBase { } /** - * The relevant features which the sender supports + * The relevant features which the sender supports. */ public void set_features(org.ldk.structs.InitFeatures val) { bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr); @@ -43,10 +45,12 @@ public class Init extends CommonBase { } /** - * The receipient's network address. This adds the option to report a remote IP address - * back to a connecting peer using the init message. A node can decide to use that information - * to discover a potential update to its public IPv4 address (NAT) and use - * that for a node_announcement update message containing the new address. + * The receipient's network address. + * + * This adds the option to report a remote IP address back to a connecting peer using the init + * message. A node can decide to use that information to discover a potential update to its + * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing + * the new address. */ public Option_NetAddressZ get_remote_network_address() { long ret = bindings.Init_get_remote_network_address(this.ptr); @@ -58,15 +62,18 @@ public class Init extends CommonBase { } /** - * The receipient's network address. This adds the option to report a remote IP address - * back to a connecting peer using the init message. A node can decide to use that information - * to discover a potential update to its public IPv4 address (NAT) and use - * that for a node_announcement update message containing the new address. + * The receipient's network address. + * + * This adds the option to report a remote IP address back to a connecting peer using the init + * message. A node can decide to use that information to discover a potential update to its + * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing + * the new address. */ public void set_remote_network_address(org.ldk.structs.Option_NetAddressZ val) { bindings.Init_set_remote_network_address(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -80,6 +87,7 @@ public class Init extends CommonBase { org.ldk.structs.Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Init(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(features_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(remote_network_address_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/InitFeatures.java b/src/main/java/org/ldk/structs/InitFeatures.java index 820f0d2b..b44077af 100644 --- a/src/main/java/org/ldk/structs/InitFeatures.java +++ b/src/main/java/org/ldk/structs/InitFeatures.java @@ -393,6 +393,40 @@ public class InitFeatures extends CommonBase { return ret; } + /** + * Set this feature as optional. + */ + public void set_anchors_zero_fee_htlc_tx_optional() { + bindings.InitFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Set this feature as required. + */ + public void set_anchors_zero_fee_htlc_tx_required() { + bindings.InitFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Checks if this feature is supported. + */ + public boolean supports_anchors_zero_fee_htlc_tx() { + boolean ret = bindings.InitFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Checks if this feature is required. + */ + public boolean requires_anchors_zero_fee_htlc_tx() { + boolean ret = bindings.InitFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Set this feature as optional. */ diff --git a/src/main/java/org/ldk/structs/Invoice.java b/src/main/java/org/ldk/structs/Invoice.java index 596982ab..f3cfa94d 100644 --- a/src/main/java/org/ldk/structs/Invoice.java +++ b/src/main/java/org/ldk/structs/Invoice.java @@ -229,11 +229,11 @@ public class Invoice extends CommonBase { } /** - * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise - * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`]. + * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise + * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`]. */ - public long min_final_cltv_expiry() { - long ret = bindings.Invoice_min_final_cltv_expiry(this.ptr); + public long min_final_cltv_expiry_delta() { + long ret = bindings.Invoice_min_final_cltv_expiry_delta(this.ptr); Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/InvoicePayer.java b/src/main/java/org/ldk/structs/InvoicePayer.java deleted file mode 100644 index 67e0d213..00000000 --- a/src/main/java/org/ldk/structs/InvoicePayer.java +++ /dev/null @@ -1,209 +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 utility for paying [`Invoice`]s and sending spontaneous payments. - * - * See [module-level documentation] for details. - * - * [module-level documentation]: crate::payment - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class InvoicePayer extends CommonBase { - InvoicePayer(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.InvoicePayer_free(ptr); } - } - - /** - * Creates an invoice payer that retries failed payment paths. - * - * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once - * `retry` has been exceeded for a given [`Invoice`]. - */ - public static InvoicePayer of(org.ldk.structs.Payer payer, org.ldk.structs.Router router, org.ldk.structs.Logger logger, org.ldk.structs.EventHandler event_handler, org.ldk.structs.Retry retry) { - long ret = bindings.InvoicePayer_new(payer == null ? 0 : payer.ptr, router == null ? 0 : router.ptr, logger == null ? 0 : logger.ptr, event_handler == null ? 0 : event_handler.ptr, retry.ptr); - Reference.reachabilityFence(payer); - Reference.reachabilityFence(router); - Reference.reachabilityFence(logger); - Reference.reachabilityFence(event_handler); - Reference.reachabilityFence(retry); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.InvoicePayer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoicePayer(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payer); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(router); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(event_handler); }; - return ret_hu_conv; - } - - /** - * Pays the given [`Invoice`], caching it for later use in case a retry is needed. - * - * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. Once the payment completes or fails, you must ensure that - * a second payment with the same [`PaymentHash`] is never sent. - * - * If you wish to use a different payment idempotency token, see - * [`Self::pay_invoice_with_id`]. - */ - public Result_PaymentIdPaymentErrorZ pay_invoice(org.ldk.structs.Invoice invoice) { - long ret = bindings.InvoicePayer_pay_invoice(this.ptr, invoice == null ? 0 : invoice.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(invoice); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(invoice); }; - return ret_hu_conv; - } - - /** - * Pays the given [`Invoice`] with a custom idempotency key, caching the invoice for later use - * in case a retry is needed. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. - * - * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] - * has never been paid before. - * - * See [`Self::pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency - * token. - */ - public Result_NonePaymentErrorZ pay_invoice_with_id(org.ldk.structs.Invoice invoice, byte[] payment_id) { - long ret = bindings.InvoicePayer_pay_invoice_with_id(this.ptr, invoice == null ? 0 : invoice.ptr, InternalUtils.check_arr_len(payment_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(payment_id); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(invoice); }; - return ret_hu_conv; - } - - /** - * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in - * case a retry is needed. - * - * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. Once the payment completes or fails, you must ensure that - * a second payment with the same [`PaymentHash`] is never sent. - * - * If you wish to use a different payment idempotency token, see - * [`Self::pay_zero_value_invoice_with_id`]. - */ - public Result_PaymentIdPaymentErrorZ pay_zero_value_invoice(org.ldk.structs.Invoice invoice, long amount_msats) { - long ret = bindings.InvoicePayer_pay_zero_value_invoice(this.ptr, invoice == null ? 0 : invoice.ptr, amount_msats); - Reference.reachabilityFence(this); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(amount_msats); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(invoice); }; - return ret_hu_conv; - } - - /** - * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key, - * caching the invoice for later use in case a retry is needed. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. - * - * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] - * has never been paid before. - * - * See [`Self::pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the - * idempotency token. - */ - public Result_NonePaymentErrorZ pay_zero_value_invoice_with_id(org.ldk.structs.Invoice invoice, long amount_msats, byte[] payment_id) { - long ret = bindings.InvoicePayer_pay_zero_value_invoice_with_id(this.ptr, invoice == null ? 0 : invoice.ptr, amount_msats, InternalUtils.check_arr_len(payment_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(invoice); - Reference.reachabilityFence(amount_msats); - Reference.reachabilityFence(payment_id); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(invoice); }; - return ret_hu_conv; - } - - /** - * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in - * case a retry is needed. - * - * The hash of the [`PaymentPreimage`] is used as the [`PaymentId`], which ensures idempotency - * as long as the payment is still pending. Once the payment completes or fails, you must - * ensure that a second payment with the same [`PaymentPreimage`] is never sent. - */ - public Result_PaymentIdPaymentErrorZ pay_pubkey(byte[] pubkey, byte[] payment_preimage, long amount_msats, int final_cltv_expiry_delta) { - long ret = bindings.InvoicePayer_pay_pubkey(this.ptr, InternalUtils.check_arr_len(pubkey, 33), InternalUtils.check_arr_len(payment_preimage, 32), amount_msats, final_cltv_expiry_delta); - Reference.reachabilityFence(this); - Reference.reachabilityFence(pubkey); - Reference.reachabilityFence(payment_preimage); - Reference.reachabilityFence(amount_msats); - Reference.reachabilityFence(final_cltv_expiry_delta); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Pays `pubkey` an amount using the hash of the given preimage and a custom idempotency key, - * caching the invoice for later use in case a retry is needed. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. - * - * You should ensure that the [`PaymentPreimage`] is unique and the corresponding - * [`PaymentHash`] has never been paid before. - */ - public Result_NonePaymentErrorZ pay_pubkey_with_id(byte[] pubkey, byte[] payment_preimage, byte[] payment_id, long amount_msats, int final_cltv_expiry_delta) { - long ret = bindings.InvoicePayer_pay_pubkey_with_id(this.ptr, InternalUtils.check_arr_len(pubkey, 33), InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_id, 32), amount_msats, final_cltv_expiry_delta); - Reference.reachabilityFence(this); - Reference.reachabilityFence(pubkey); - Reference.reachabilityFence(payment_preimage); - Reference.reachabilityFence(payment_id); - Reference.reachabilityFence(amount_msats); - Reference.reachabilityFence(final_cltv_expiry_delta); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Removes the payment cached by the given payment hash. - * - * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an - * [`EventHandler`]. Otherwise, calling this method is unnecessary. - */ - public void remove_cached_payment(byte[] payment_hash) { - bindings.InvoicePayer_remove_cached_payment(this.ptr, InternalUtils.check_arr_len(payment_hash, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(payment_hash); - } - - /** - * Constructs a new EventHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is - */ - public EventHandler as_EventHandler() { - long ret = bindings.InvoicePayer_as_EventHandler(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - EventHandler ret_hu_conv = new EventHandler(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/InvoiceRequestFeatures.java b/src/main/java/org/ldk/structs/InvoiceRequestFeatures.java index a36cd855..165f8022 100644 --- a/src/main/java/org/ldk/structs/InvoiceRequestFeatures.java +++ b/src/main/java/org/ldk/structs/InvoiceRequestFeatures.java @@ -76,24 +76,4 @@ public class InvoiceRequestFeatures extends CommonBase { return ret; } - /** - * Serialize the InvoiceRequestFeatures object into a byte array which can be read by InvoiceRequestFeatures_read - */ - public byte[] write() { - byte[] ret = bindings.InvoiceRequestFeatures_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Read a InvoiceRequestFeatures from a byte array, created by InvoiceRequestFeatures_write - */ - public static Result_InvoiceRequestFeaturesDecodeErrorZ read(byte[] ser) { - long ret = bindings.InvoiceRequestFeatures_read(ser); - Reference.reachabilityFence(ser); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceRequestFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceRequestFeaturesDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - } diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java deleted file mode 100644 index 08bc1ac5..00000000 --- a/src/main/java/org/ldk/structs/KeysInterface.java +++ /dev/null @@ -1,419 +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 trait to describe an object which can get user secrets and key material. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class KeysInterface extends CommonBase { - final bindings.LDKKeysInterface bindings_instance; - KeysInterface(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private KeysInterface(bindings.LDKKeysInterface arg) { - super(bindings.LDKKeysInterface_new(arg)); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.KeysInterface_free(ptr); } super.finalize(); - } - - public static interface KeysInterfaceInterface { - /** - * Get node secret key based on the provided [`Recipient`]. - * - * The `node_id`/`network_key` is the public key that corresponds to this secret key. - * - * This method must return the same value each time it is called with a given [`Recipient`] - * parameter. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - */ - Result_SecretKeyNoneZ get_node_secret(Recipient recipient); - /** - * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in - * [`get_node_secret`]. - * - * This method must return the same value each time it is called with a given [`Recipient`] - * parameter. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - * - * [`get_node_secret`]: Self::get_node_secret - */ - Result_PublicKeyNoneZ get_node_id(Recipient recipient); - /** - * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if - * one is provided. Note that this tweak can be applied to `other_key` instead of our node - * secret, though this is less efficient. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - * - * [`node secret`]: Self::get_node_secret - */ - Result_SharedSecretNoneZ ecdh(Recipient recipient, byte[] other_key, Option_ScalarZ tweak); - /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. - */ - byte[] get_destination_script(); - /** - * Get a script pubkey which we will send funds to when closing a channel. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. - */ - ShutdownScript get_shutdown_scriptpubkey(); - /** - * Get a new set of [`Sign`] for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! - * - * This method must return a different value each time it is called. - */ - byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, UInt128 user_channel_id); - /** - * Derives the private key material backing a `Signer`. - * - * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through - * [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be - * re-derived from its `channel_keys_id`, which can be obtained through its trait method - * [`BaseSign::channel_keys_id`]. - */ - Sign derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id); - /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. - * - * This method must return a different value each time it is called. - */ - byte[] get_secure_random_bytes(); - /** - * Reads a [`Signer`] for this [`KeysInterface`] from the given input stream. - * This is only called during deserialization of other objects which contain - * [`Sign`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. - * - * This method is slowly being phased out -- it will only be called when reading objects - * written by LDK versions prior to 0.0.113. - * - * [`Signer`]: Self::Signer - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - Result_SignDecodeErrorZ read_chan_signer(byte[] reader); - /** - * Sign an invoice. - * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of - * this trait to parse the invoice and make sure they're signing what they expect, rather than - * blindly signing the hash. - * The `hrp` is ASCII bytes, while the invoice data is base32-encoded. - * - * The secret key used to sign the invoice is dependent on the [`Recipient`]. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - */ - Result_RecoverableSignatureNoneZ sign_invoice(byte[] hrp_bytes, UInt5[] invoice_data, Recipient receipient); - /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. - * - * If the implementor of this trait supports [phantom node payments], then every node that is - * intended to be included in the phantom invoice route hints must return the same value from - * this method. - * - * This method must return the same value each time it is called. - * - * [phantom node payments]: PhantomKeysManager - */ - byte[] get_inbound_payment_key_material(); - } - private static class LDKKeysInterfaceHolder { KeysInterface held; } - public static KeysInterface new_impl(KeysInterfaceInterface arg) { - final LDKKeysInterfaceHolder impl_holder = new LDKKeysInterfaceHolder(); - impl_holder.held = new KeysInterface(new bindings.LDKKeysInterface() { - @Override public long get_node_secret(Recipient recipient) { - Result_SecretKeyNoneZ ret = arg.get_node_secret(recipient); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long get_node_id(Recipient recipient) { - Result_PublicKeyNoneZ ret = arg.get_node_id(recipient); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long ecdh(Recipient recipient, byte[] other_key, long tweak) { - org.ldk.structs.Option_ScalarZ tweak_hu_conv = org.ldk.structs.Option_ScalarZ.constr_from_ptr(tweak); - if (tweak_hu_conv != null) { tweak_hu_conv.ptrs_to.add(this); }; - Result_SharedSecretNoneZ ret = arg.ecdh(recipient, other_key, tweak_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public byte[] get_destination_script() { - byte[] ret = arg.get_destination_script(); - Reference.reachabilityFence(arg); - return ret; - } - @Override public long get_shutdown_scriptpubkey() { - ShutdownScript ret = arg.get_shutdown_scriptpubkey(); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, byte[] user_channel_id) { - org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id); - byte[] ret = arg.generate_channel_keys_id(inbound, channel_value_satoshis, user_channel_id_conv); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 32); - return result; - } - @Override public long derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id) { - Sign ret = arg.derive_channel_signer(channel_value_satoshis, channel_keys_id); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; - return result; - } - @Override public byte[] get_secure_random_bytes() { - byte[] ret = arg.get_secure_random_bytes(); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 32); - return result; - } - @Override public long read_chan_signer(byte[] reader) { - Result_SignDecodeErrorZ ret = arg.read_chan_signer(reader); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long sign_invoice(byte[] hrp_bytes, byte[] invoice_data, Recipient receipient) { - int invoice_data_conv_7_len = invoice_data.length; - UInt5[] invoice_data_conv_7_arr = new UInt5[invoice_data_conv_7_len]; - for (int h = 0; h < invoice_data_conv_7_len; h++) { - byte invoice_data_conv_7 = invoice_data[h]; - UInt5 invoice_data_conv_7_conv = new UInt5(invoice_data_conv_7); - invoice_data_conv_7_arr[h] = invoice_data_conv_7_conv; - } - Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(hrp_bytes, invoice_data_conv_7_arr, receipient); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public byte[] get_inbound_payment_key_material() { - byte[] ret = arg.get_inbound_payment_key_material(); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 32); - return result; - } - }); - return impl_holder.held; - } - /** - * Get node secret key based on the provided [`Recipient`]. - * - * The `node_id`/`network_key` is the public key that corresponds to this secret key. - * - * This method must return the same value each time it is called with a given [`Recipient`] - * parameter. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - */ - public Result_SecretKeyNoneZ get_node_secret(org.ldk.enums.Recipient recipient) { - long ret = bindings.KeysInterface_get_node_secret(this.ptr, recipient); - Reference.reachabilityFence(this); - Reference.reachabilityFence(recipient); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SecretKeyNoneZ ret_hu_conv = Result_SecretKeyNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in - * [`get_node_secret`]. - * - * This method must return the same value each time it is called with a given [`Recipient`] - * parameter. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - * - * [`get_node_secret`]: Self::get_node_secret - */ - public Result_PublicKeyNoneZ get_node_id(org.ldk.enums.Recipient recipient) { - long ret = bindings.KeysInterface_get_node_id(this.ptr, recipient); - Reference.reachabilityFence(this); - Reference.reachabilityFence(recipient); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PublicKeyNoneZ ret_hu_conv = Result_PublicKeyNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if - * one is provided. Note that this tweak can be applied to `other_key` instead of our node - * secret, though this is less efficient. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - * - * [`node secret`]: Self::get_node_secret - */ - public Result_SharedSecretNoneZ ecdh(org.ldk.enums.Recipient recipient, byte[] other_key, org.ldk.structs.Option_ScalarZ tweak) { - long ret = bindings.KeysInterface_ecdh(this.ptr, recipient, InternalUtils.check_arr_len(other_key, 33), tweak.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(recipient); - Reference.reachabilityFence(other_key); - Reference.reachabilityFence(tweak); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SharedSecretNoneZ ret_hu_conv = Result_SharedSecretNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. - */ - public byte[] get_destination_script() { - byte[] ret = bindings.KeysInterface_get_destination_script(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Get a script pubkey which we will send funds to when closing a channel. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. - */ - public ShutdownScript get_shutdown_scriptpubkey() { - long ret = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.ShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ShutdownScript(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - - /** - * Get a new set of [`Sign`] for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! - * - * This method must return a different value each time it is called. - */ - public byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, org.ldk.util.UInt128 user_channel_id) { - byte[] ret = bindings.KeysInterface_generate_channel_keys_id(this.ptr, inbound, channel_value_satoshis, user_channel_id.getLEBytes()); - Reference.reachabilityFence(this); - Reference.reachabilityFence(inbound); - Reference.reachabilityFence(channel_value_satoshis); - Reference.reachabilityFence(user_channel_id); - return ret; - } - - /** - * Derives the private key material backing a `Signer`. - * - * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through - * [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be - * re-derived from its `channel_keys_id`, which can be obtained through its trait method - * [`BaseSign::channel_keys_id`]. - */ - public Sign derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id) { - long ret = bindings.KeysInterface_derive_channel_signer(this.ptr, channel_value_satoshis, InternalUtils.check_arr_len(channel_keys_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(channel_value_satoshis); - Reference.reachabilityFence(channel_keys_id); - if (ret >= 0 && ret <= 4096) { return null; } - Sign ret_hu_conv = new Sign(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - - /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. - * - * This method must return a different value each time it is called. - */ - public byte[] get_secure_random_bytes() { - byte[] ret = bindings.KeysInterface_get_secure_random_bytes(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Reads a [`Signer`] for this [`KeysInterface`] from the given input stream. - * This is only called during deserialization of other objects which contain - * [`Sign`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. - * - * This method is slowly being phased out -- it will only be called when reading objects - * written by LDK versions prior to 0.0.113. - * - * [`Signer`]: Self::Signer - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - public Result_SignDecodeErrorZ read_chan_signer(byte[] reader) { - long ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader); - Reference.reachabilityFence(this); - Reference.reachabilityFence(reader); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Sign an invoice. - * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of - * this trait to parse the invoice and make sure they're signing what they expect, rather than - * blindly signing the hash. - * The `hrp` is ASCII bytes, while the invoice data is base32-encoded. - * - * The secret key used to sign the invoice is dependent on the [`Recipient`]. - * - * Errors if the [`Recipient`] variant is not supported by the implementation. - */ - public Result_RecoverableSignatureNoneZ sign_invoice(byte[] hrp_bytes, UInt5[] invoice_data, org.ldk.enums.Recipient receipient) { - long ret = bindings.KeysInterface_sign_invoice(this.ptr, hrp_bytes, invoice_data != null ? InternalUtils.convUInt5Array(invoice_data) : null, receipient); - Reference.reachabilityFence(this); - Reference.reachabilityFence(hrp_bytes); - Reference.reachabilityFence(invoice_data); - Reference.reachabilityFence(receipient); - if (ret >= 0 && ret <= 4096) { return null; } - Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. - * - * If the implementor of this trait supports [phantom node payments], then every node that is - * intended to be included in the phantom invoice route hints must return the same value from - * this method. - * - * This method must return the same value each time it is called. - * - * [phantom node payments]: PhantomKeysManager - */ - public byte[] get_inbound_payment_key_material() { - byte[] ret = bindings.KeysInterface_get_inbound_payment_key_material(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - -} diff --git a/src/main/java/org/ldk/structs/KeysManager.java b/src/main/java/org/ldk/structs/KeysManager.java index 840f8a63..ca6d0258 100644 --- a/src/main/java/org/ldk/structs/KeysManager.java +++ b/src/main/java/org/ldk/structs/KeysManager.java @@ -9,8 +9,8 @@ import javax.annotation.Nullable; /** - * Simple [`KeysInterface`] implementation that takes a 32-byte seed for use as a BIP 32 extended - * key and derives keys from that. + * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a + * 32-byte seed for use as a BIP 32 extended key and derives keys from that. * * Your `node_id` is seed/0'. * Unilateral closes may use seed/1'. @@ -63,7 +63,16 @@ public class KeysManager extends CommonBase { } /** - * Derive an old [`Sign`] containing per-channel secrets based on a key derivation parameters. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + */ + public byte[] get_node_secret_key() { + byte[] ret = bindings.KeysManager_get_node_secret_key(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. */ public InMemorySigner derive_channel_keys(long channel_value_satoshis, byte[] params) { long ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, InternalUtils.check_arr_len(params, 32)); @@ -99,18 +108,45 @@ public class KeysManager extends CommonBase { Reference.reachabilityFence(feerate_sat_per_1000_weight); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); + for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (this != null) { this.ptrs_to.add(descriptors_conv_27); }; }; + return ret_hu_conv; + } + + /** + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + */ + public EntropySource as_EntropySource() { + long ret = bindings.KeysManager_as_EntropySource(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + EntropySource ret_hu_conv = new EntropySource(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + */ + public NodeSigner as_NodeSigner() { + long ret = bindings.KeysManager_as_NodeSigner(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + NodeSigner ret_hu_conv = new NodeSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** - * Constructs a new KeysInterface which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is */ - public KeysInterface as_KeysInterface() { - long ret = bindings.KeysManager_as_KeysInterface(this.ptr); + public SignerProvider as_SignerProvider() { + long ret = bindings.KeysManager_as_SignerProvider(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - KeysInterface ret_hu_conv = new KeysInterface(null, ret); + SignerProvider ret_hu_conv = new SignerProvider(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index 08beb58d..b05371ff 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -57,6 +57,7 @@ public class LightningError extends CommonBase { bindings.LightningError_set_action(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -69,6 +70,7 @@ public class LightningError extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.LightningError(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(action_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Listen.java b/src/main/java/org/ldk/structs/Listen.java index eda94364..80794622 100644 --- a/src/main/java/org/ldk/structs/Listen.java +++ b/src/main/java/org/ldk/structs/Listen.java @@ -33,7 +33,19 @@ public class Listen extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Listen_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Listen_free(ptr); } + ptr = 0; + } public static interface ListenInterface { /** * Notifies the listener that a block was added at the given height, with the transaction data diff --git a/src/main/java/org/ldk/structs/LockableScore.java b/src/main/java/org/ldk/structs/LockableScore.java index 96617a1e..206b6e54 100644 --- a/src/main/java/org/ldk/structs/LockableScore.java +++ b/src/main/java/org/ldk/structs/LockableScore.java @@ -30,7 +30,19 @@ public class LockableScore extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.LockableScore_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.LockableScore_free(ptr); } + ptr = 0; + } public static interface LockableScoreInterface { /** * Returns the locked scorer. diff --git a/src/main/java/org/ldk/structs/Logger.java b/src/main/java/org/ldk/structs/Logger.java index 0dc55222..229a0477 100644 --- a/src/main/java/org/ldk/structs/Logger.java +++ b/src/main/java/org/ldk/structs/Logger.java @@ -23,7 +23,19 @@ public class Logger extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Logger_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Logger_free(ptr); } + ptr = 0; + } public static interface LoggerInterface { /** * Logs the `Record` diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 28ba63a5..86d9490d 100644 --- a/src/main/java/org/ldk/structs/MessageSendEvent.java +++ b/src/main/java/org/ldk/structs/MessageSendEvent.java @@ -65,6 +65,9 @@ public class MessageSendEvent extends CommonBase { if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastChannelUpdate.class) { return new BroadcastChannelUpdate(ptr, (bindings.LDKMessageSendEvent.BroadcastChannelUpdate)raw_val); } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement.class) { + return new BroadcastNodeAnnouncement(ptr, (bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement)raw_val); + } if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelUpdate.class) { return new SendChannelUpdate(ptr, (bindings.LDKMessageSendEvent.SendChannelUpdate)raw_val); } @@ -369,8 +372,10 @@ public class MessageSendEvent extends CommonBase { public final org.ldk.structs.ChannelAnnouncement msg; /** * The followup channel_update which should be sent. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public final org.ldk.structs.ChannelUpdate update_msg; + @Nullable public final org.ldk.structs.ChannelUpdate update_msg; private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) { super(null, ptr); long msg = obj.msg; @@ -399,6 +404,22 @@ public class MessageSendEvent extends CommonBase { this.msg = msg_hu_conv; } } + /** + * Used to indicate that a node_announcement should be broadcast to all peers. + */ + public final static class BroadcastNodeAnnouncement extends MessageSendEvent { + /** + * The node_announcement which should be sent. + */ + public final org.ldk.structs.NodeAnnouncement msg; + private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) { + super(null, ptr); + long msg = obj.msg; + org.ldk.structs.NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new org.ldk.structs.NodeAnnouncement(null, msg); } + if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); }; + this.msg = msg_hu_conv; + } + } /** * Used to indicate that a channel_update should be sent to a single peer. * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a @@ -746,6 +767,19 @@ public class MessageSendEvent extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + */ + public static MessageSendEvent broadcast_node_announcement(org.ldk.structs.NodeAnnouncement msg) { + long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr); + Reference.reachabilityFence(msg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); }; + return ret_hu_conv; + } + /** * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent */ @@ -770,6 +804,7 @@ public class MessageSendEvent extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(action); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java index 7f4adfbe..85194aea 100644 --- a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -23,7 +23,19 @@ public class MessageSendEventsProvider extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.MessageSendEventsProvider_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.MessageSendEventsProvider_free(ptr); } + ptr = 0; + } public static interface MessageSendEventsProviderInterface { /** * Gets the list of pending events which were generated by previous actions, clearing the list @@ -39,6 +51,7 @@ public class MessageSendEventsProvider extends CommonBase { MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events(); Reference.reachabilityFence(arg); long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.clone_ptr()).toArray() : null; + for (MessageSendEvent ret_conv_18: ret) { if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret_conv_18); }; }; return result; } }); diff --git a/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java b/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java deleted file mode 100644 index fcd10f9d..00000000 --- a/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java +++ /dev/null @@ -1,94 +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; - - -/** - * `min_final_cltv_expiry` to use for the last HTLC in the route - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class MinFinalCltvExpiry extends CommonBase { - MinFinalCltvExpiry(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.MinFinalCltvExpiry_free(ptr); } - } - - public long get_a() { - long ret = bindings.MinFinalCltvExpiry_get_a(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - public void set_a(long val) { - bindings.MinFinalCltvExpiry_set_a(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Constructs a new MinFinalCltvExpiry given each field - */ - public static MinFinalCltvExpiry of(long a_arg) { - long ret = bindings.MinFinalCltvExpiry_new(a_arg); - Reference.reachabilityFence(a_arg); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiry(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - return ret_hu_conv; - } - - long clone_ptr() { - long ret = bindings.MinFinalCltvExpiry_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a copy of the MinFinalCltvExpiry - */ - public MinFinalCltvExpiry clone() { - long ret = bindings.MinFinalCltvExpiry_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiry(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - - /** - * Checks if two MinFinalCltvExpirys contain equal inner contents. - */ - public long hash() { - long ret = bindings.MinFinalCltvExpiry_hash(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - @Override public int hashCode() { - return (int)this.hash(); - } - /** - * Checks if two MinFinalCltvExpirys contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. - */ - public boolean eq(org.ldk.structs.MinFinalCltvExpiry b) { - boolean ret = bindings.MinFinalCltvExpiry_eq(this.ptr, b == null ? 0 : b.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(b); - if (this != null) { this.ptrs_to.add(b); }; - return ret; - } - - @Override public boolean equals(Object o) { - if (!(o instanceof MinFinalCltvExpiry)) return false; - return this.eq((MinFinalCltvExpiry)o); - } -} diff --git a/src/main/java/org/ldk/structs/MinFinalCltvExpiryDelta.java b/src/main/java/org/ldk/structs/MinFinalCltvExpiryDelta.java new file mode 100644 index 00000000..bfd53780 --- /dev/null +++ b/src/main/java/org/ldk/structs/MinFinalCltvExpiryDelta.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; + + +/** + * `min_final_cltv_expiry_delta` to use for the last HTLC in the route + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class MinFinalCltvExpiryDelta extends CommonBase { + MinFinalCltvExpiryDelta(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.MinFinalCltvExpiryDelta_free(ptr); } + } + + public long get_a() { + long ret = bindings.MinFinalCltvExpiryDelta_get_a(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + public void set_a(long val) { + bindings.MinFinalCltvExpiryDelta_set_a(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Constructs a new MinFinalCltvExpiryDelta given each field + */ + public static MinFinalCltvExpiryDelta of(long a_arg) { + long ret = bindings.MinFinalCltvExpiryDelta_new(a_arg); + Reference.reachabilityFence(a_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.MinFinalCltvExpiryDelta ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiryDelta(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.MinFinalCltvExpiryDelta_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the MinFinalCltvExpiryDelta + */ + public MinFinalCltvExpiryDelta clone() { + long ret = bindings.MinFinalCltvExpiryDelta_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.MinFinalCltvExpiryDelta ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiryDelta(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents. + */ + public long hash() { + long ret = bindings.MinFinalCltvExpiryDelta_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } + /** + * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(org.ldk.structs.MinFinalCltvExpiryDelta b) { + boolean ret = bindings.MinFinalCltvExpiryDelta_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + if (this != null) { this.ptrs_to.add(b); }; + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof MinFinalCltvExpiryDelta)) return false; + return this.eq((MinFinalCltvExpiryDelta)o); + } +} diff --git a/src/main/java/org/ldk/structs/NetAddress.java b/src/main/java/org/ldk/structs/NetAddress.java index 47f94b85..9714ec7c 100644 --- a/src/main/java/org/ldk/structs/NetAddress.java +++ b/src/main/java/org/ldk/structs/NetAddress.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * An address which can be used to connect to a remote peer + * An address which can be used to connect to a remote peer. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class NetAddress extends CommonBase { @@ -90,7 +90,8 @@ public class NetAddress extends CommonBase { } /** * A new-style Tor onion address/port on which the peer is listening. - * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, + * + * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version, * wrap as base32 and append \".onion\". */ public final static class OnionV3 extends NetAddress { diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index ed4027d3..38c58dd3 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -56,9 +56,9 @@ public class NetworkGraph extends CommonBase { /** * Creates a new, empty, network graph. */ - public static NetworkGraph of(byte[] genesis_hash, org.ldk.structs.Logger logger) { - long ret = bindings.NetworkGraph_new(InternalUtils.check_arr_len(genesis_hash, 32), logger == null ? 0 : logger.ptr); - Reference.reachabilityFence(genesis_hash); + public static NetworkGraph of(org.ldk.enums.Network network, org.ldk.structs.Logger logger) { + long ret = bindings.NetworkGraph_new(network, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(network); Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.NetworkGraph ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NetworkGraph(null, ret); } @@ -143,18 +143,18 @@ public class NetworkGraph extends CommonBase { * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ - public Result_NoneLightningErrorZ update_channel_from_announcement(org.ldk.structs.ChannelAnnouncement msg, org.ldk.structs.Option_AccessZ chain_access) { - long ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr, chain_access.ptr); + public Result_NoneLightningErrorZ update_channel_from_announcement(org.ldk.structs.ChannelAnnouncement msg, org.ldk.structs.Option_UtxoLookupZ utxo_lookup) { + long ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr, utxo_lookup.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(msg); - Reference.reachabilityFence(chain_access); + Reference.reachabilityFence(utxo_lookup); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(msg); }; - if (this != null) { this.ptrs_to.add(chain_access); }; + if (this != null) { this.ptrs_to.add(utxo_lookup); }; return ret_hu_conv; } @@ -163,18 +163,18 @@ public class NetworkGraph extends CommonBase { * signatures. Because we aren't given the associated signatures here we cannot relay the * channel announcement to any of our peers. * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ - public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(org.ldk.structs.UnsignedChannelAnnouncement msg, org.ldk.structs.Option_AccessZ chain_access) { - long ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr, chain_access.ptr); + public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(org.ldk.structs.UnsignedChannelAnnouncement msg, org.ldk.structs.Option_UtxoLookupZ utxo_lookup) { + long ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr, utxo_lookup.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(msg); - Reference.reachabilityFence(chain_access); + Reference.reachabilityFence(utxo_lookup); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(msg); }; - if (this != null) { this.ptrs_to.add(chain_access); }; + if (this != null) { this.ptrs_to.add(utxo_lookup); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/NodeAnnouncement.java b/src/main/java/org/ldk/structs/NodeAnnouncement.java index e4ed9012..10e05998 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncement.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A node_announcement message to be sent or received from a peer + * A [`node_announcement`] message to be sent to or received from a peer. + * + * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class NodeAnnouncement extends CommonBase { diff --git a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java index c9765feb..1b9e1fae 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java @@ -132,6 +132,7 @@ public class NodeAnnouncementInfo extends CommonBase { bindings.NodeAnnouncementInfo_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + for (NetAddress val_conv_12: val) { if (this != null) { this.ptrs_to.add(val_conv_12); }; }; } /** @@ -183,6 +184,7 @@ public class NodeAnnouncementInfo extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(features_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(alias_arg); }; + for (NetAddress addresses_arg_conv_12: addresses_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(addresses_arg_conv_12); }; }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(announcement_message_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/NodeFeatures.java b/src/main/java/org/ldk/structs/NodeFeatures.java index b13f837b..4eae00cb 100644 --- a/src/main/java/org/ldk/structs/NodeFeatures.java +++ b/src/main/java/org/ldk/structs/NodeFeatures.java @@ -368,6 +368,40 @@ public class NodeFeatures extends CommonBase { return ret; } + /** + * Set this feature as optional. + */ + public void set_anchors_zero_fee_htlc_tx_optional() { + bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Set this feature as required. + */ + public void set_anchors_zero_fee_htlc_tx_required() { + bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr); + Reference.reachabilityFence(this); + } + + /** + * Checks if this feature is supported. + */ + public boolean supports_anchors_zero_fee_htlc_tx() { + boolean ret = bindings.NodeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Checks if this feature is required. + */ + public boolean requires_anchors_zero_fee_htlc_tx() { + boolean ret = bindings.NodeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Set this feature as optional. */ diff --git a/src/main/java/org/ldk/structs/NodeInfo.java b/src/main/java/org/ldk/structs/NodeInfo.java index 69773f31..0b7e93fd 100644 --- a/src/main/java/org/ldk/structs/NodeInfo.java +++ b/src/main/java/org/ldk/structs/NodeInfo.java @@ -40,37 +40,6 @@ public class NodeInfo extends CommonBase { Reference.reachabilityFence(val); } - /** - * Lowest fees enabling routing via any of the enabled, known channels to a node. - * The two fields (flat and proportional fee) are independent, - * meaning they don't have to refer to the same channel. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - @Nullable - public RoutingFees get_lowest_inbound_channel_fees() { - long ret = bindings.NodeInfo_get_lowest_inbound_channel_fees(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - - /** - * Lowest fees enabling routing via any of the enabled, known channels to a node. - * The two fields (flat and proportional fee) are independent, - * meaning they don't have to refer to the same channel. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - public void set_lowest_inbound_channel_fees(@Nullable org.ldk.structs.RoutingFees val) { - bindings.NodeInfo_set_lowest_inbound_channel_fees(this.ptr, val == null ? 0 : val.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - if (this != null) { this.ptrs_to.add(val); }; - } - /** * More information about a node from node_announcement. * Optional because we store a Node entry after learning about it from @@ -105,15 +74,13 @@ public class NodeInfo extends CommonBase { /** * Constructs a new NodeInfo given each field */ - public static NodeInfo of(long[] channels_arg, org.ldk.structs.RoutingFees lowest_inbound_channel_fees_arg, org.ldk.structs.NodeAnnouncementInfo announcement_info_arg) { - long ret = bindings.NodeInfo_new(channels_arg, lowest_inbound_channel_fees_arg == null ? 0 : lowest_inbound_channel_fees_arg.ptr, announcement_info_arg == null ? 0 : announcement_info_arg.ptr); + public static NodeInfo of(long[] channels_arg, org.ldk.structs.NodeAnnouncementInfo announcement_info_arg) { + long ret = bindings.NodeInfo_new(channels_arg, announcement_info_arg == null ? 0 : announcement_info_arg.ptr); Reference.reachabilityFence(channels_arg); - Reference.reachabilityFence(lowest_inbound_channel_fees_arg); Reference.reachabilityFence(announcement_info_arg); 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); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(lowest_inbound_channel_fees_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(announcement_info_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/NodeSigner.java b/src/main/java/org/ldk/structs/NodeSigner.java new file mode 100644 index 00000000..4fa2f011 --- /dev/null +++ b/src/main/java/org/ldk/structs/NodeSigner.java @@ -0,0 +1,242 @@ +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 trait that can handle cryptographic operations at the scope level of a node. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class NodeSigner extends CommonBase { + final bindings.LDKNodeSigner bindings_instance; + NodeSigner(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private NodeSigner(bindings.LDKNodeSigner arg) { + super(bindings.LDKNodeSigner_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.NodeSigner_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.NodeSigner_free(ptr); } + ptr = 0; + } + public static interface NodeSignerInterface { + /** + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * + * If the implementor of this trait supports [phantom node payments], then every node that is + * intended to be included in the phantom invoice route hints must return the same value from + * this method. + * + * This method must return the same value each time it is called. + * + * [phantom node payments]: PhantomKeysManager + */ + byte[] get_inbound_payment_key_material(); + /** + * Get node id based on the provided [`Recipient`]. + * + * This method must return the same value each time it is called with a given [`Recipient`] + * parameter. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + Result_PublicKeyNoneZ get_node_id(Recipient recipient); + /** + * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if + * one is provided. Note that this tweak can be applied to `other_key` instead of our node + * secret, though this is less efficient. + * + * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error + * should be resolved to allow LDK to resume forwarding HTLCs. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + Result_SharedSecretNoneZ ecdh(Recipient recipient, byte[] other_key, Option_ScalarZ tweak); + /** + * Sign an invoice. + * + * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of + * this trait to parse the invoice and make sure they're signing what they expect, rather than + * blindly signing the hash. + * + * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32. + * + * The secret key used to sign the invoice is dependent on the [`Recipient`]. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + Result_RecoverableSignatureNoneZ sign_invoice(byte[] hrp_bytes, UInt5[] invoice_data, Recipient recipient); + /** + * Sign a gossip message. + * + * Note that if this fails, LDK may panic and the message will not be broadcast to the network + * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the + * message to be broadcast, as otherwise it may prevent one from receiving funds over the + * corresponding channel. + */ + Result_SignatureNoneZ sign_gossip_message(UnsignedGossipMessage msg); + } + private static class LDKNodeSignerHolder { NodeSigner held; } + public static NodeSigner new_impl(NodeSignerInterface arg) { + final LDKNodeSignerHolder impl_holder = new LDKNodeSignerHolder(); + impl_holder.held = new NodeSigner(new bindings.LDKNodeSigner() { + @Override public byte[] get_inbound_payment_key_material() { + byte[] ret = arg.get_inbound_payment_key_material(); + Reference.reachabilityFence(arg); + byte[] result = InternalUtils.check_arr_len(ret, 32); + return result; + } + @Override public long get_node_id(Recipient recipient) { + Result_PublicKeyNoneZ ret = arg.get_node_id(recipient); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long ecdh(Recipient recipient, byte[] other_key, long tweak) { + org.ldk.structs.Option_ScalarZ tweak_hu_conv = org.ldk.structs.Option_ScalarZ.constr_from_ptr(tweak); + if (tweak_hu_conv != null) { tweak_hu_conv.ptrs_to.add(this); }; + Result_SharedSecretNoneZ ret = arg.ecdh(recipient, other_key, tweak_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_invoice(byte[] hrp_bytes, byte[] invoice_data, Recipient recipient) { + int invoice_data_conv_7_len = invoice_data.length; + UInt5[] invoice_data_conv_7_arr = new UInt5[invoice_data_conv_7_len]; + for (int h = 0; h < invoice_data_conv_7_len; h++) { + byte invoice_data_conv_7 = invoice_data[h]; + UInt5 invoice_data_conv_7_conv = new UInt5(invoice_data_conv_7); + invoice_data_conv_7_arr[h] = invoice_data_conv_7_conv; + } + Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(hrp_bytes, invoice_data_conv_7_arr, recipient); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long sign_gossip_message(long msg) { + org.ldk.structs.UnsignedGossipMessage msg_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(msg); + if (msg_hu_conv != null) { msg_hu_conv.ptrs_to.add(this); }; + Result_SignatureNoneZ ret = arg.sign_gossip_message(msg_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + }); + return impl_holder.held; + } + /** + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * + * If the implementor of this trait supports [phantom node payments], then every node that is + * intended to be included in the phantom invoice route hints must return the same value from + * this method. + * + * This method must return the same value each time it is called. + * + * [phantom node payments]: PhantomKeysManager + */ + public byte[] get_inbound_payment_key_material() { + byte[] ret = bindings.NodeSigner_get_inbound_payment_key_material(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Get node id based on the provided [`Recipient`]. + * + * This method must return the same value each time it is called with a given [`Recipient`] + * parameter. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + public Result_PublicKeyNoneZ get_node_id(org.ldk.enums.Recipient recipient) { + long ret = bindings.NodeSigner_get_node_id(this.ptr, recipient); + Reference.reachabilityFence(this); + Reference.reachabilityFence(recipient); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PublicKeyNoneZ ret_hu_conv = Result_PublicKeyNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if + * one is provided. Note that this tweak can be applied to `other_key` instead of our node + * secret, though this is less efficient. + * + * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error + * should be resolved to allow LDK to resume forwarding HTLCs. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + public Result_SharedSecretNoneZ ecdh(org.ldk.enums.Recipient recipient, byte[] other_key, org.ldk.structs.Option_ScalarZ tweak) { + long ret = bindings.NodeSigner_ecdh(this.ptr, recipient, InternalUtils.check_arr_len(other_key, 33), tweak.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(recipient); + Reference.reachabilityFence(other_key); + Reference.reachabilityFence(tweak); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SharedSecretNoneZ ret_hu_conv = Result_SharedSecretNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(tweak); }; + return ret_hu_conv; + } + + /** + * Sign an invoice. + * + * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of + * this trait to parse the invoice and make sure they're signing what they expect, rather than + * blindly signing the hash. + * + * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32. + * + * The secret key used to sign the invoice is dependent on the [`Recipient`]. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + public Result_RecoverableSignatureNoneZ sign_invoice(byte[] hrp_bytes, UInt5[] invoice_data, org.ldk.enums.Recipient recipient) { + long ret = bindings.NodeSigner_sign_invoice(this.ptr, hrp_bytes, invoice_data != null ? InternalUtils.convUInt5Array(invoice_data) : null, recipient); + Reference.reachabilityFence(this); + Reference.reachabilityFence(hrp_bytes); + Reference.reachabilityFence(invoice_data); + Reference.reachabilityFence(recipient); + if (ret >= 0 && ret <= 4096) { return null; } + Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Sign a gossip message. + * + * Note that if this fails, LDK may panic and the message will not be broadcast to the network + * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the + * message to be broadcast, as otherwise it may prevent one from receiving funds over the + * corresponding channel. + */ + public Result_SignatureNoneZ sign_gossip_message(org.ldk.structs.UnsignedGossipMessage msg) { + long ret = bindings.NodeSigner_sign_gossip_message(this.ptr, msg.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(msg); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/OfferFeatures.java b/src/main/java/org/ldk/structs/OfferFeatures.java index 9ff632c9..1e1c8910 100644 --- a/src/main/java/org/ldk/structs/OfferFeatures.java +++ b/src/main/java/org/ldk/structs/OfferFeatures.java @@ -76,24 +76,4 @@ public class OfferFeatures extends CommonBase { return ret; } - /** - * Serialize the OfferFeatures object into a byte array which can be read by OfferFeatures_read - */ - public byte[] write() { - byte[] ret = bindings.OfferFeatures_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Read a OfferFeatures from a byte array, created by OfferFeatures_write - */ - public static Result_OfferFeaturesDecodeErrorZ read(byte[] ser) { - long ret = bindings.OfferFeatures_read(ser); - Reference.reachabilityFence(ser); - if (ret >= 0 && ret <= 4096) { return null; } - Result_OfferFeaturesDecodeErrorZ ret_hu_conv = Result_OfferFeaturesDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - } diff --git a/src/main/java/org/ldk/structs/OnionMessage.java b/src/main/java/org/ldk/structs/OnionMessage.java index be9ca77d..8b780bbe 100644 --- a/src/main/java/org/ldk/structs/OnionMessage.java +++ b/src/main/java/org/ldk/structs/OnionMessage.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * An onion message to be sent or received from a peer + * An onion message to be sent to or received from a peer. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OnionMessage extends CommonBase { diff --git a/src/main/java/org/ldk/structs/OnionMessageHandler.java b/src/main/java/org/ldk/structs/OnionMessageHandler.java index 0fdc68b6..46e5da4f 100644 --- a/src/main/java/org/ldk/structs/OnionMessageHandler.java +++ b/src/main/java/org/ldk/structs/OnionMessageHandler.java @@ -24,10 +24,22 @@ public class OnionMessageHandler extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.OnionMessageHandler_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.OnionMessageHandler_free(ptr); } + ptr = 0; + } public static interface OnionMessageHandlerInterface { /** - * Handle an incoming onion_message message from the given peer. + * Handle an incoming `onion_message` message from the given peer. */ void handle_onion_message(byte[] peer_node_id, OnionMessage msg); /** @@ -38,15 +50,12 @@ public class OnionMessageHandler extends CommonBase { * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - Result_NoneNoneZ peer_connected(byte[] their_node_id, Init init); + Result_NoneNoneZ peer_connected(byte[] their_node_id, Init init, boolean inbound); /** * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to * drop and refuse to forward onion messages to this peer. - * - * Note that in some rare cases this may be called without a corresponding - * [`Self::peer_connected`]. */ - void peer_disconnected(byte[] their_node_id, boolean no_connection_possible); + void peer_disconnected(byte[] their_node_id); /** * Gets the node feature flags which this handler itself supports. All available handlers are * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] @@ -71,15 +80,15 @@ public class OnionMessageHandler extends CommonBase { arg.handle_onion_message(peer_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } - @Override public long peer_connected(byte[] their_node_id, long init) { + @Override public long peer_connected(byte[] their_node_id, long init, boolean inbound) { org.ldk.structs.Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new org.ldk.structs.Init(null, init); } - Result_NoneNoneZ ret = arg.peer_connected(their_node_id, init_hu_conv); + Result_NoneNoneZ ret = arg.peer_connected(their_node_id, init_hu_conv, inbound); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } - @Override public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) { - arg.peer_disconnected(their_node_id, no_connection_possible); + @Override public void peer_disconnected(byte[] their_node_id) { + arg.peer_disconnected(their_node_id); Reference.reachabilityFence(arg); } @Override public long provided_node_features() { @@ -103,12 +112,12 @@ public class OnionMessageHandler extends CommonBase { */ public OnionMessageProvider get_onion_message_provider() { OnionMessageProvider res = new OnionMessageProvider(null, bindings.LDKOnionMessageHandler_get_OnionMessageProvider(this.ptr)); - this.ptrs_to.add(res); + res.ptrs_to.add(this); return res; } /** - * Handle an incoming onion_message message from the given peer. + * Handle an incoming `onion_message` message from the given peer. */ public void handle_onion_message(byte[] peer_node_id, org.ldk.structs.OnionMessage msg) { bindings.OnionMessageHandler_handle_onion_message(this.ptr, InternalUtils.check_arr_len(peer_node_id, 33), msg == null ? 0 : msg.ptr); @@ -126,11 +135,12 @@ public class OnionMessageHandler extends CommonBase { * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init init) { - long ret = bindings.OnionMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr); + public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init init, boolean inbound) { + long ret = bindings.OnionMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr, inbound); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); Reference.reachabilityFence(init); + Reference.reachabilityFence(inbound); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(init); }; @@ -140,15 +150,11 @@ public class OnionMessageHandler extends CommonBase { /** * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to * drop and refuse to forward onion messages to this peer. - * - * Note that in some rare cases this may be called without a corresponding - * [`Self::peer_connected`]. */ - public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) { - bindings.OnionMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), no_connection_possible); + public void peer_disconnected(byte[] their_node_id) { + bindings.OnionMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33)); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); - Reference.reachabilityFence(no_connection_possible); } /** diff --git a/src/main/java/org/ldk/structs/OnionMessageProvider.java b/src/main/java/org/ldk/structs/OnionMessageProvider.java index b04e64d1..6c87b44b 100644 --- a/src/main/java/org/ldk/structs/OnionMessageProvider.java +++ b/src/main/java/org/ldk/structs/OnionMessageProvider.java @@ -23,7 +23,19 @@ public class OnionMessageProvider extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.OnionMessageProvider_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.OnionMessageProvider_free(ptr); } + ptr = 0; + } public static interface OnionMessageProviderInterface { /** * Gets the next pending onion message for the peer with the given node id. diff --git a/src/main/java/org/ldk/structs/OnionMessenger.java b/src/main/java/org/ldk/structs/OnionMessenger.java index a0a81c4d..8883bde1 100644 --- a/src/main/java/org/ldk/structs/OnionMessenger.java +++ b/src/main/java/org/ldk/structs/OnionMessenger.java @@ -19,16 +19,16 @@ import javax.annotation.Nullable; * # extern crate bitcoin; * # use bitcoin::hashes::_export::_core::time::Duration; * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; - * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface}; - * # use lightning::ln::msgs::DecodeError; + * # use lightning::chain::keysinterface::KeysManager; * # use lightning::ln::peer_handler::IgnoringMessageHandler; * # use lightning::onion_message::blinded_path::BlindedPath; - * # use lightning::onion_message::messenger::{CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger}; + * # use lightning::onion_message::messenger::{Destination, OnionMessenger}; + * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents}; * # use lightning::util::logger::{Logger, Record}; * # use lightning::util::ser::{Writeable, Writer}; * # use lightning::io; * # use std::sync::Arc; - * # struct FakeLogger {}; + * # struct FakeLogger; * # impl Logger for FakeLogger { * # fn log(&self, record: &Record) { unimplemented!() } * # } @@ -44,7 +44,7 @@ import javax.annotation.Nullable; * # let your_custom_message_handler = IgnoringMessageHandler {}; * Create the onion messenger. This must use the same `keys_manager` as is passed to your * ChannelManager. - * let onion_messenger = OnionMessenger::new(&keys_manager, logger, your_custom_message_handler); + * let onion_messenger = OnionMessenger::new(&keys_manager, &keys_manager, logger, &your_custom_message_handler); * * # #[derive(Clone)] * # struct YourCustomMessage {} @@ -96,15 +96,17 @@ public class OnionMessenger extends CommonBase { * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to * their respective handlers. */ - public static OnionMessenger of(org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.structs.CustomOnionMessageHandler custom_handler) { - long ret = bindings.OnionMessenger_new(keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, custom_handler == null ? 0 : custom_handler.ptr); - Reference.reachabilityFence(keys_manager); + public static OnionMessenger of(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.structs.CustomOnionMessageHandler custom_handler) { + long ret = bindings.OnionMessenger_new(entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, custom_handler == null ? 0 : custom_handler.ptr); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(custom_handler); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.OnionMessenger ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessenger(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(custom_handler); }; return ret_hu_conv; @@ -125,6 +127,8 @@ public class OnionMessenger extends CommonBase { Reference.reachabilityFence(reply_path); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneSendErrorZ ret_hu_conv = Result_NoneSendErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(destination); }; + if (this != null) { this.ptrs_to.add(message); }; if (this != null) { this.ptrs_to.add(reply_path); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/OpenChannel.java b/src/main/java/org/ldk/structs/OpenChannel.java index cf1289c8..c63f1927 100644 --- a/src/main/java/org/ldk/structs/OpenChannel.java +++ b/src/main/java/org/ldk/structs/OpenChannel.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An open_channel message to be sent or received from a peer + * An [`open_channel`] message to be sent to or received from a peer. + * + * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OpenChannel extends CommonBase { @@ -165,7 +167,8 @@ public class OpenChannel extends CommonBase { } /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * The feerate per 1000-weight of sender generated transactions, until updated by + * [`UpdateFee`] */ public int get_feerate_per_kw() { int ret = bindings.OpenChannel_get_feerate_per_kw(this.ptr); @@ -174,7 +177,8 @@ public class OpenChannel extends CommonBase { } /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * The feerate per 1000-weight of sender generated transactions, until updated by + * [`UpdateFee`] */ public void set_feerate_per_kw(int val) { bindings.OpenChannel_set_feerate_per_kw(this.ptr, val); @@ -183,7 +187,8 @@ public class OpenChannel extends CommonBase { } /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The number of blocks which the counterparty will have to wait to claim on-chain funds if + * they broadcast a commitment transaction */ public short get_to_self_delay() { short ret = bindings.OpenChannel_get_to_self_delay(this.ptr); @@ -192,7 +197,8 @@ public class OpenChannel extends CommonBase { } /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The number of blocks which the counterparty will have to wait to claim on-chain funds if + * they broadcast a commitment transaction */ public void set_to_self_delay(short val) { bindings.OpenChannel_set_to_self_delay(this.ptr, val); @@ -327,7 +333,7 @@ public class OpenChannel extends CommonBase { } /** - * Channel flags + * The channel flags to be used */ public byte get_channel_flags() { byte ret = bindings.OpenChannel_get_channel_flags(this.ptr); @@ -336,7 +342,7 @@ public class OpenChannel extends CommonBase { } /** - * Channel flags + * The channel flags to be used */ public void set_channel_flags(byte val) { bindings.OpenChannel_set_channel_flags(this.ptr, val); @@ -345,9 +351,10 @@ public class OpenChannel extends CommonBase { } /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent + * + * If this is `None`, we derive the channel type from the intersection of our + * feature bits with our counterparty's feature bits from the [`Init`] message. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -362,9 +369,10 @@ public class OpenChannel extends CommonBase { } /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent + * + * If this is `None`, we derive the channel type from the intersection of our + * feature bits with our counterparty's feature bits from the [`Init`] message. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ diff --git a/src/main/java/org/ldk/structs/Option_APIErrorZ.java b/src/main/java/org/ldk/structs/Option_APIErrorZ.java new file mode 100644 index 00000000..5fad89c3 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_APIErrorZ.java @@ -0,0 +1,97 @@ +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::errors::APIError or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_APIErrorZ extends CommonBase { + private Option_APIErrorZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_APIErrorZ_free(ptr); } + } + static Option_APIErrorZ constr_from_ptr(long ptr) { + bindings.LDKCOption_APIErrorZ raw_val = bindings.LDKCOption_APIErrorZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_APIErrorZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_APIErrorZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_APIErrorZ.None.class) { + return new None(ptr, (bindings.LDKCOption_APIErrorZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError + */ + public final static class Some extends Option_APIErrorZ { + public final org.ldk.structs.APIError some; + private Some(long ptr, bindings.LDKCOption_APIErrorZ.Some obj) { + super(null, ptr); + long some = obj.some; + org.ldk.structs.APIError some_hu_conv = org.ldk.structs.APIError.constr_from_ptr(some); + if (some_hu_conv != null) { some_hu_conv.ptrs_to.add(this); }; + this.some = some_hu_conv; + } + } + /** + * When we're in this state, this COption_APIErrorZ contains nothing + */ + public final static class None extends Option_APIErrorZ { + private None(long ptr, bindings.LDKCOption_APIErrorZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError + */ + public static Option_APIErrorZ some(org.ldk.structs.APIError o) { + long ret = bindings.COption_APIErrorZ_some(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_APIErrorZ ret_hu_conv = org.ldk.structs.Option_APIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_APIErrorZ containing nothing + */ + public static Option_APIErrorZ none() { + long ret = bindings.COption_APIErrorZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_APIErrorZ ret_hu_conv = org.ldk.structs.Option_APIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_APIErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_APIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_APIErrorZ clone() { + long ret = bindings.COption_APIErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_APIErrorZ ret_hu_conv = org.ldk.structs.Option_APIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Option_AccessZ.java b/src/main/java/org/ldk/structs/Option_AccessZ.java deleted file mode 100644 index e19784ac..00000000 --- a/src/main/java/org/ldk/structs/Option_AccessZ.java +++ /dev/null @@ -1,78 +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; - - -/** - * An enum which can either contain a crate::lightning::chain::Access or not - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Option_AccessZ extends CommonBase { - private Option_AccessZ(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.COption_AccessZ_free(ptr); } - } - static Option_AccessZ constr_from_ptr(long ptr) { - bindings.LDKCOption_AccessZ raw_val = bindings.LDKCOption_AccessZ_ref_from_ptr(ptr); - if (raw_val.getClass() == bindings.LDKCOption_AccessZ.Some.class) { - return new Some(ptr, (bindings.LDKCOption_AccessZ.Some)raw_val); - } - if (raw_val.getClass() == bindings.LDKCOption_AccessZ.None.class) { - return new None(ptr, (bindings.LDKCOption_AccessZ.None)raw_val); - } - assert false; return null; // Unreachable without extending the (internal) bindings interface - } - - /** - * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access - */ - public final static class Some extends Option_AccessZ { - public final org.ldk.structs.Access some; - private Some(long ptr, bindings.LDKCOption_AccessZ.Some obj) { - super(null, ptr); - long some = obj.some; - Access ret_hu_conv = new Access(null, some); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - this.some = ret_hu_conv; - } - } - /** - * When we're in this state, this COption_AccessZ contains nothing - */ - public final static class None extends Option_AccessZ { - private None(long ptr, bindings.LDKCOption_AccessZ.None obj) { - super(null, ptr); - } - } - /** - * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access - */ - public static Option_AccessZ some(org.ldk.structs.Access o) { - long ret = bindings.COption_AccessZ_some(o == null ? 0 : o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_AccessZ ret_hu_conv = org.ldk.structs.Option_AccessZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - return ret_hu_conv; - } - - /** - * Constructs a new COption_AccessZ containing nothing - */ - public static Option_AccessZ none() { - long ret = bindings.COption_AccessZ_none(); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_AccessZ ret_hu_conv = org.ldk.structs.Option_AccessZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Option_C2Tuple_EightU16sEightU16sZZ.java b/src/main/java/org/ldk/structs/Option_C2Tuple_EightU16sEightU16sZZ.java new file mode 100644 index 00000000..bcc8af0c --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_C2Tuple_EightU16sEightU16sZZ.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::c_types::derived::C2Tuple__u168_u168Z or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_C2Tuple_EightU16sEightU16sZZ extends CommonBase { + private Option_C2Tuple_EightU16sEightU16sZZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_C2Tuple_EightU16sEightU16sZZ_free(ptr); } + } + static Option_C2Tuple_EightU16sEightU16sZZ constr_from_ptr(long ptr) { + bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ raw_val = bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ.None.class) { + return new None(ptr, (bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z + */ + public final static class Some extends Option_C2Tuple_EightU16sEightU16sZZ { + public final org.ldk.structs.TwoTuple__u168_u168Z some; + private Some(long ptr, bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ.Some obj) { + super(null, ptr); + long some = obj.some; + TwoTuple__u168_u168Z some_hu_conv = new TwoTuple__u168_u168Z(null, some); + if (some_hu_conv != null) { some_hu_conv.ptrs_to.add(this); }; + this.some = some_hu_conv; + } + } + /** + * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing + */ + public final static class None extends Option_C2Tuple_EightU16sEightU16sZZ { + private None(long ptr, bindings.LDKCOption_C2Tuple_EightU16sEightU16sZZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z + */ + public static Option_C2Tuple_EightU16sEightU16sZZ some(org.ldk.structs.TwoTuple__u168_u168Z o) { + long ret = bindings.COption_C2Tuple_EightU16sEightU16sZZ_some(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing + */ + public static Option_C2Tuple_EightU16sEightU16sZZ none() { + long ret = bindings.COption_C2Tuple_EightU16sEightU16sZZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_C2Tuple_EightU16sEightU16sZZ clone() { + long ret = bindings.COption_C2Tuple_EightU16sEightU16sZZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java index 2213c461..09c22d9b 100644 --- a/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java +++ b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java @@ -66,6 +66,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + for (NetAddress o_conv_12: o) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_conv_12); }; }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java b/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java index ffd496ec..ee6bc5e7 100644 --- a/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java +++ b/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java @@ -60,6 +60,7 @@ public class Option_ClosureReasonZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_ClosureReasonZ ret_hu_conv = org.ldk.structs.Option_ClosureReasonZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_EventZ.java b/src/main/java/org/ldk/structs/Option_EventZ.java index 450406b4..3c989b99 100644 --- a/src/main/java/org/ldk/structs/Option_EventZ.java +++ b/src/main/java/org/ldk/structs/Option_EventZ.java @@ -60,6 +60,7 @@ public class Option_EventZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_EventZ ret_hu_conv = org.ldk.structs.Option_EventZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java b/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java index 30567637..20e888b7 100644 --- a/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java +++ b/src/main/java/org/ldk/structs/Option_HTLCDestinationZ.java @@ -60,6 +60,7 @@ public class Option_HTLCDestinationZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_MonitorEventZ.java b/src/main/java/org/ldk/structs/Option_MonitorEventZ.java index b2fa91a8..317c7f55 100644 --- a/src/main/java/org/ldk/structs/Option_MonitorEventZ.java +++ b/src/main/java/org/ldk/structs/Option_MonitorEventZ.java @@ -60,6 +60,7 @@ public class Option_MonitorEventZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_MonitorEventZ ret_hu_conv = org.ldk.structs.Option_MonitorEventZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_NetAddressZ.java b/src/main/java/org/ldk/structs/Option_NetAddressZ.java index e1bca693..27eeb47b 100644 --- a/src/main/java/org/ldk/structs/Option_NetAddressZ.java +++ b/src/main/java/org/ldk/structs/Option_NetAddressZ.java @@ -60,6 +60,7 @@ public class Option_NetAddressZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java b/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java index fbee2dc3..c2621537 100644 --- a/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java +++ b/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java @@ -60,6 +60,7 @@ public class Option_NetworkUpdateZ extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_NetworkUpdateZ ret_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_PathFailureZ.java b/src/main/java/org/ldk/structs/Option_PathFailureZ.java new file mode 100644 index 00000000..032c32bc --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_PathFailureZ.java @@ -0,0 +1,97 @@ +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::PathFailure or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_PathFailureZ extends CommonBase { + private Option_PathFailureZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_PathFailureZ_free(ptr); } + } + static Option_PathFailureZ constr_from_ptr(long ptr) { + bindings.LDKCOption_PathFailureZ raw_val = bindings.LDKCOption_PathFailureZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_PathFailureZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_PathFailureZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_PathFailureZ.None.class) { + return new None(ptr, (bindings.LDKCOption_PathFailureZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure + */ + public final static class Some extends Option_PathFailureZ { + public final org.ldk.structs.PathFailure some; + private Some(long ptr, bindings.LDKCOption_PathFailureZ.Some obj) { + super(null, ptr); + long some = obj.some; + org.ldk.structs.PathFailure some_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(some); + if (some_hu_conv != null) { some_hu_conv.ptrs_to.add(this); }; + this.some = some_hu_conv; + } + } + /** + * When we're in this state, this COption_PathFailureZ contains nothing + */ + public final static class None extends Option_PathFailureZ { + private None(long ptr, bindings.LDKCOption_PathFailureZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_PathFailureZ containing a crate::lightning::util::events::PathFailure + */ + public static Option_PathFailureZ some(org.ldk.structs.PathFailure o) { + long ret = bindings.COption_PathFailureZ_some(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_PathFailureZ ret_hu_conv = org.ldk.structs.Option_PathFailureZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_PathFailureZ containing nothing + */ + public static Option_PathFailureZ none() { + long ret = bindings.COption_PathFailureZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_PathFailureZ ret_hu_conv = org.ldk.structs.Option_PathFailureZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_PathFailureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_PathFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_PathFailureZ clone() { + long ret = bindings.COption_PathFailureZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_PathFailureZ ret_hu_conv = org.ldk.structs.Option_PathFailureZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java b/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java new file mode 100644 index 00000000..9326de47 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java @@ -0,0 +1,78 @@ +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::routing::utxo::UtxoLookup or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_UtxoLookupZ extends CommonBase { + private Option_UtxoLookupZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_UtxoLookupZ_free(ptr); } + } + static Option_UtxoLookupZ constr_from_ptr(long ptr) { + bindings.LDKCOption_UtxoLookupZ raw_val = bindings.LDKCOption_UtxoLookupZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_UtxoLookupZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_UtxoLookupZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_UtxoLookupZ.None.class) { + return new None(ptr, (bindings.LDKCOption_UtxoLookupZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup + */ + public final static class Some extends Option_UtxoLookupZ { + public final org.ldk.structs.UtxoLookup some; + private Some(long ptr, bindings.LDKCOption_UtxoLookupZ.Some obj) { + super(null, ptr); + long some = obj.some; + UtxoLookup ret_hu_conv = new UtxoLookup(null, some); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + this.some = ret_hu_conv; + } + } + /** + * When we're in this state, this COption_UtxoLookupZ contains nothing + */ + public final static class None extends Option_UtxoLookupZ { + private None(long ptr, bindings.LDKCOption_UtxoLookupZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup + */ + public static Option_UtxoLookupZ some(org.ldk.structs.UtxoLookup o) { + long ret = bindings.COption_UtxoLookupZ_some(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_UtxoLookupZ ret_hu_conv = org.ldk.structs.Option_UtxoLookupZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_UtxoLookupZ containing nothing + */ + public static Option_UtxoLookupZ none() { + long ret = bindings.COption_UtxoLookupZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_UtxoLookupZ ret_hu_conv = org.ldk.structs.Option_UtxoLookupZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/P2PGossipSync.java b/src/main/java/org/ldk/structs/P2PGossipSync.java index 0e4f8ed2..0a8242e8 100644 --- a/src/main/java/org/ldk/structs/P2PGossipSync.java +++ b/src/main/java/org/ldk/structs/P2PGossipSync.java @@ -27,20 +27,19 @@ public class P2PGossipSync extends CommonBase { /** * Creates a new tracker of the actual state of the network of channels and nodes, * assuming an existing Network Graph. - * Chain monitor is used to make sure announced channels exist on-chain, - * channel data is correct, and that the announcement is signed with - * channel owners' keys. + * UTXO lookup is used to make sure announced channels exist on-chain, channel data is + * correct, and the announcement is signed with channel owners' keys. */ - public static P2PGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Option_AccessZ chain_access, org.ldk.structs.Logger logger) { - long ret = bindings.P2PGossipSync_new(network_graph == null ? 0 : network_graph.ptr, chain_access.ptr, logger == null ? 0 : logger.ptr); + public static P2PGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Option_UtxoLookupZ utxo_lookup, org.ldk.structs.Logger logger) { + long ret = bindings.P2PGossipSync_new(network_graph == null ? 0 : network_graph.ptr, utxo_lookup.ptr, logger == null ? 0 : logger.ptr); Reference.reachabilityFence(network_graph); - Reference.reachabilityFence(chain_access); + Reference.reachabilityFence(utxo_lookup); Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.P2PGossipSync ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.P2PGossipSync(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(chain_access); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(utxo_lookup); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; return ret_hu_conv; } @@ -50,11 +49,11 @@ public class P2PGossipSync extends CommonBase { * existing announcements unless they are updated. * Add, update or remove the provider would replace the current one. */ - public void add_chain_access(org.ldk.structs.Option_AccessZ chain_access) { - bindings.P2PGossipSync_add_chain_access(this.ptr, chain_access.ptr); + public void add_utxo_lookup(org.ldk.structs.Option_UtxoLookupZ utxo_lookup) { + bindings.P2PGossipSync_add_utxo_lookup(this.ptr, utxo_lookup.ptr); Reference.reachabilityFence(this); - Reference.reachabilityFence(chain_access); - if (this != null) { this.ptrs_to.add(chain_access); }; + Reference.reachabilityFence(utxo_lookup); + if (this != null) { this.ptrs_to.add(utxo_lookup); }; } /** diff --git a/src/main/java/org/ldk/structs/ParseError.java b/src/main/java/org/ldk/structs/ParseError.java index 17ac2417..36802c08 100644 --- a/src/main/java/org/ldk/structs/ParseError.java +++ b/src/main/java/org/ldk/structs/ParseError.java @@ -217,6 +217,7 @@ public class ParseError extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ParseOrSemanticError.java b/src/main/java/org/ldk/structs/ParseOrSemanticError.java index 65155cae..2873c46a 100644 --- a/src/main/java/org/ldk/structs/ParseOrSemanticError.java +++ b/src/main/java/org/ldk/structs/ParseOrSemanticError.java @@ -82,6 +82,7 @@ public class ParseOrSemanticError extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/PathFailure.java b/src/main/java/org/ldk/structs/PathFailure.java new file mode 100644 index 00000000..67266244 --- /dev/null +++ b/src/main/java/org/ldk/structs/PathFailure.java @@ -0,0 +1,142 @@ +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; + + +/** + * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may + * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`]. + * + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PathFailure extends CommonBase { + private PathFailure(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PathFailure_free(ptr); } + } + static PathFailure constr_from_ptr(long ptr) { + bindings.LDKPathFailure raw_val = bindings.LDKPathFailure_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKPathFailure.InitialSend.class) { + return new InitialSend(ptr, (bindings.LDKPathFailure.InitialSend)raw_val); + } + if (raw_val.getClass() == bindings.LDKPathFailure.OnPath.class) { + return new OnPath(ptr, (bindings.LDKPathFailure.OnPath)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * We failed to initially send the payment and no HTLC was committed to. Contains the relevant + * error. + */ + public final static class InitialSend extends PathFailure { + /** + * The error surfaced from initial send. + */ + public final org.ldk.structs.APIError err; + private InitialSend(long ptr, bindings.LDKPathFailure.InitialSend obj) { + super(null, ptr); + long err = obj.err; + org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; + this.err = err_hu_conv; + } + } + /** + * A hop on the path failed to forward our payment. + */ + public final static class OnPath extends PathFailure { + /** + * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing + * decisions can take into account the update. + * + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + */ + public final org.ldk.structs.Option_NetworkUpdateZ network_update; + private OnPath(long ptr, bindings.LDKPathFailure.OnPath obj) { + super(null, ptr); + long network_update = obj.network_update; + org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update); + if (network_update_hu_conv != null) { network_update_hu_conv.ptrs_to.add(this); }; + this.network_update = network_update_hu_conv; + } + } + long clone_ptr() { + long ret = bindings.PathFailure_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the PathFailure + */ + public PathFailure clone() { + long ret = bindings.PathFailure_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PathFailure ret_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new InitialSend-variant PathFailure + */ + public static PathFailure initial_send(org.ldk.structs.APIError err) { + long ret = bindings.PathFailure_initial_send(err.ptr); + Reference.reachabilityFence(err); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PathFailure ret_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(err); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new OnPath-variant PathFailure + */ + public static PathFailure on_path(org.ldk.structs.Option_NetworkUpdateZ network_update) { + long ret = bindings.PathFailure_on_path(network_update.ptr); + Reference.reachabilityFence(network_update); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PathFailure ret_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_update); }; + return ret_hu_conv; + } + + /** + * Checks if two PathFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ + public boolean eq(org.ldk.structs.PathFailure b) { + boolean ret = bindings.PathFailure_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof PathFailure)) return false; + return this.eq((PathFailure)o); + } + /** + * Serialize the PathFailure object into a byte array which can be read by PathFailure_read + */ + public byte[] write() { + byte[] ret = bindings.PathFailure_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/Payer.java b/src/main/java/org/ldk/structs/Payer.java deleted file mode 100644 index 206d184d..00000000 --- a/src/main/java/org/ldk/structs/Payer.java +++ /dev/null @@ -1,217 +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 trait defining behavior of an [`Invoice`] payer. - * - * While the behavior of [`InvoicePayer`] provides idempotency of duplicate `send_*payment` calls - * with the same [`PaymentHash`], it is up to the `Payer` to provide idempotency across restarts. - * - * [`ChannelManager`] provides idempotency for duplicate payments with the same [`PaymentId`]. - * - * In order to trivially ensure idempotency for payments, the default `Payer` implementation - * reuses the [`PaymentHash`] bytes as the [`PaymentId`]. Custom implementations wishing to - * provide payment idempotency with a different idempotency key (i.e. [`PaymentId`]) should map - * the [`Invoice`] or spontaneous payment target pubkey to their own idempotency key. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Payer extends CommonBase { - final bindings.LDKPayer bindings_instance; - Payer(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private Payer(bindings.LDKPayer arg) { - super(bindings.LDKPayer_new(arg)); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.Payer_free(ptr); } super.finalize(); - } - - public static interface PayerInterface { - /** - * Returns the payer's node id. - */ - byte[] node_id(); - /** - * Returns the payer's channels. - */ - ChannelDetails[] first_hops(); - /** - * Sends a payment over the Lightning Network using the given [`Route`]. - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - Result_NonePaymentSendFailureZ send_payment(Route route, byte[] payment_hash, byte[] payment_secret, byte[] payment_id); - /** - * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. - */ - Result_NonePaymentSendFailureZ send_spontaneous_payment(Route route, byte[] payment_preimage, byte[] payment_id); - /** - * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. - */ - Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id); - /** - * Signals that no further retries for the given payment will occur. - */ - void abandon_payment(byte[] payment_id); - /** - * Construct an [`InFlightHtlcs`] containing information about currently used up liquidity - * across payments. - */ - InFlightHtlcs inflight_htlcs(); - } - private static class LDKPayerHolder { Payer held; } - public static Payer new_impl(PayerInterface arg) { - final LDKPayerHolder impl_holder = new LDKPayerHolder(); - impl_holder.held = new Payer(new bindings.LDKPayer() { - @Override public byte[] node_id() { - byte[] ret = arg.node_id(); - Reference.reachabilityFence(arg); - byte[] result = InternalUtils.check_arr_len(ret, 33); - return result; - } - @Override public long[] first_hops() { - ChannelDetails[] ret = arg.first_hops(); - Reference.reachabilityFence(arg); - long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_16 -> ret_conv_16 == null ? 0 : ret_conv_16.clone_ptr()).toArray() : null; - return result; - } - @Override public long send_payment(long route, byte[] payment_hash, byte[] payment_secret, byte[] payment_id) { - org.ldk.structs.Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new org.ldk.structs.Route(null, route); } - Result_NonePaymentSendFailureZ ret = arg.send_payment(route_hu_conv, payment_hash, payment_secret, payment_id); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long send_spontaneous_payment(long route, byte[] payment_preimage, byte[] payment_id) { - org.ldk.structs.Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new org.ldk.structs.Route(null, route); } - Result_NonePaymentSendFailureZ ret = arg.send_spontaneous_payment(route_hu_conv, payment_preimage, payment_id); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public long retry_payment(long route, byte[] payment_id) { - org.ldk.structs.Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new org.ldk.structs.Route(null, route); } - Result_NonePaymentSendFailureZ ret = arg.retry_payment(route_hu_conv, payment_id); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - @Override public void abandon_payment(byte[] payment_id) { - arg.abandon_payment(payment_id); - Reference.reachabilityFence(arg); - } - @Override public long inflight_htlcs() { - InFlightHtlcs ret = arg.inflight_htlcs(); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - }); - return impl_holder.held; - } - /** - * Returns the payer's node id. - */ - public byte[] node_id() { - byte[] ret = bindings.Payer_node_id(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Returns the payer's channels. - */ - public ChannelDetails[] first_hops() { - long[] ret = bindings.Payer_first_hops(this.ptr); - Reference.reachabilityFence(this); - int ret_conv_16_len = ret.length; - ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret_conv_16_len]; - for (int q = 0; q < ret_conv_16_len; q++) { - long ret_conv_16 = ret[q]; - org.ldk.structs.ChannelDetails ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new org.ldk.structs.ChannelDetails(null, ret_conv_16); } - if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.add(this); }; - ret_conv_16_arr[q] = ret_conv_16_hu_conv; - } - return ret_conv_16_arr; - } - - /** - * Sends a payment over the Lightning Network using the given [`Route`]. - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - public Result_NonePaymentSendFailureZ send_payment(org.ldk.structs.Route route, byte[] payment_hash, @Nullable byte[] payment_secret, byte[] payment_id) { - long ret = bindings.Payer_send_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32), InternalUtils.check_arr_len(payment_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(route); - Reference.reachabilityFence(payment_hash); - Reference.reachabilityFence(payment_secret); - Reference.reachabilityFence(payment_id); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(route); }; - return ret_hu_conv; - } - - /** - * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. - */ - public Result_NonePaymentSendFailureZ send_spontaneous_payment(org.ldk.structs.Route route, byte[] payment_preimage, byte[] payment_id) { - long ret = bindings.Payer_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(route); - Reference.reachabilityFence(payment_preimage); - Reference.reachabilityFence(payment_id); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(route); }; - return ret_hu_conv; - } - - /** - * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. - */ - public Result_NonePaymentSendFailureZ retry_payment(org.ldk.structs.Route route, byte[] payment_id) { - long ret = bindings.Payer_retry_payment(this.ptr, route == null ? 0 : route.ptr, InternalUtils.check_arr_len(payment_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(route); - Reference.reachabilityFence(payment_id); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); - if (this != null) { this.ptrs_to.add(route); }; - return ret_hu_conv; - } - - /** - * Signals that no further retries for the given payment will occur. - */ - public void abandon_payment(byte[] payment_id) { - bindings.Payer_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(payment_id); - } - - /** - * Construct an [`InFlightHtlcs`] containing information about currently used up liquidity - * across payments. - */ - public InFlightHtlcs inflight_htlcs() { - long ret = bindings.Payer_inflight_htlcs(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.InFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InFlightHtlcs(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/PaymentError.java b/src/main/java/org/ldk/structs/PaymentError.java index e4bc100a..a6c2abce 100644 --- a/src/main/java/org/ldk/structs/PaymentError.java +++ b/src/main/java/org/ldk/structs/PaymentError.java @@ -24,9 +24,6 @@ public class PaymentError extends CommonBase { if (raw_val.getClass() == bindings.LDKPaymentError.Invoice.class) { return new Invoice(ptr, (bindings.LDKPaymentError.Invoice)raw_val); } - if (raw_val.getClass() == bindings.LDKPaymentError.Routing.class) { - return new Routing(ptr, (bindings.LDKPaymentError.Routing)raw_val); - } if (raw_val.getClass() == bindings.LDKPaymentError.Sending.class) { return new Sending(ptr, (bindings.LDKPaymentError.Sending)raw_val); } @@ -43,30 +40,14 @@ public class PaymentError extends CommonBase { this.invoice = obj.invoice; } } - /** - * An error occurring when finding a route. - */ - public final static class Routing extends PaymentError { - public final org.ldk.structs.LightningError routing; - private Routing(long ptr, bindings.LDKPaymentError.Routing obj) { - super(null, ptr); - long routing = obj.routing; - org.ldk.structs.LightningError routing_hu_conv = null; if (routing < 0 || routing > 4096) { routing_hu_conv = new org.ldk.structs.LightningError(null, routing); } - if (routing_hu_conv != null) { routing_hu_conv.ptrs_to.add(this); }; - this.routing = routing_hu_conv; - } - } /** * An error occurring when sending a payment. */ public final static class Sending extends PaymentError { - public final org.ldk.structs.PaymentSendFailure sending; + public final org.ldk.enums.RetryableSendFailure sending; private Sending(long ptr, bindings.LDKPaymentError.Sending obj) { super(null, ptr); - long sending = obj.sending; - org.ldk.structs.PaymentSendFailure sending_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(sending); - if (sending_hu_conv != null) { sending_hu_conv.ptrs_to.add(this); }; - this.sending = sending_hu_conv; + this.sending = obj.sending; } } long clone_ptr() { @@ -99,24 +80,11 @@ public class PaymentError extends CommonBase { return ret_hu_conv; } - /** - * Utility method to constructs a new Routing-variant PaymentError - */ - public static PaymentError routing(org.ldk.structs.LightningError a) { - long ret = bindings.PaymentError_routing(a == null ? 0 : a.ptr); - Reference.reachabilityFence(a); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; - return ret_hu_conv; - } - /** * Utility method to constructs a new Sending-variant PaymentError */ - public static PaymentError sending(org.ldk.structs.PaymentSendFailure a) { - long ret = bindings.PaymentError_sending(a.ptr); + public static PaymentError sending(org.ldk.enums.RetryableSendFailure a) { + long ret = bindings.PaymentError_sending(a); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/PaymentParameters.java b/src/main/java/org/ldk/structs/PaymentParameters.java index 600b9d6e..9adbd77e 100644 --- a/src/main/java/org/ldk/structs/PaymentParameters.java +++ b/src/main/java/org/ldk/structs/PaymentParameters.java @@ -121,6 +121,7 @@ public class PaymentParameters extends CommonBase { bindings.PaymentParameters_set_expiry_time(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -229,11 +230,29 @@ public class PaymentParameters extends CommonBase { Reference.reachabilityFence(val); } + /** + * The minimum CLTV delta at the end of the route. This value must not be zero. + */ + public int get_final_cltv_expiry_delta() { + int ret = bindings.PaymentParameters_get_final_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The minimum CLTV delta at the end of the route. This value must not be zero. + */ + public void set_final_cltv_expiry_delta(int val) { + bindings.PaymentParameters_set_final_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new PaymentParameters given each field */ - public static PaymentParameters of(byte[] payee_pubkey_arg, org.ldk.structs.InvoiceFeatures features_arg, RouteHint[] route_hints_arg, org.ldk.structs.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, 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).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); + public static PaymentParameters of(byte[] payee_pubkey_arg, org.ldk.structs.InvoiceFeatures features_arg, RouteHint[] route_hints_arg, org.ldk.structs.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, int final_cltv_expiry_delta_arg) { + long ret = bindings.PaymentParameters_new(InternalUtils.check_arr_len(payee_pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr, 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).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, final_cltv_expiry_delta_arg); Reference.reachabilityFence(payee_pubkey_arg); Reference.reachabilityFence(features_arg); Reference.reachabilityFence(route_hints_arg); @@ -242,11 +261,13 @@ public class PaymentParameters extends CommonBase { Reference.reachabilityFence(max_path_count_arg); Reference.reachabilityFence(max_channel_saturation_power_of_half_arg); Reference.reachabilityFence(previously_failed_channels_arg); + Reference.reachabilityFence(final_cltv_expiry_delta_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); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(features_arg); }; for (RouteHint route_hints_arg_conv_11: route_hints_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_hints_arg_conv_11); }; }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(expiry_time_arg); }; return ret_hu_conv; } @@ -309,9 +330,10 @@ public class PaymentParameters extends CommonBase { /** * Read a PaymentParameters from a byte array, created by PaymentParameters_write */ - public static Result_PaymentParametersDecodeErrorZ read(byte[] ser) { - long ret = bindings.PaymentParameters_read(ser); + public static Result_PaymentParametersDecodeErrorZ read(byte[] ser, int arg) { + long ret = bindings.PaymentParameters_read(ser, arg); Reference.reachabilityFence(ser); + Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentParametersDecodeErrorZ ret_hu_conv = Result_PaymentParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -319,10 +341,14 @@ public class PaymentParameters extends CommonBase { /** * Creates a payee with the node id of the given `pubkey`. + * + * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has + * provided. */ - public static PaymentParameters from_node_id(byte[] payee_pubkey) { - long ret = bindings.PaymentParameters_from_node_id(InternalUtils.check_arr_len(payee_pubkey, 33)); + public static PaymentParameters from_node_id(byte[] payee_pubkey, int final_cltv_expiry_delta) { + long ret = bindings.PaymentParameters_from_node_id(InternalUtils.check_arr_len(payee_pubkey, 33), final_cltv_expiry_delta); Reference.reachabilityFence(payee_pubkey); + Reference.reachabilityFence(final_cltv_expiry_delta); 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); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; @@ -331,10 +357,14 @@ public class PaymentParameters extends CommonBase { /** * Creates a payee with the node id of the given `pubkey` to use for keysend payments. + * + * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has + * provided. */ - public static PaymentParameters for_keysend(byte[] payee_pubkey) { - long ret = bindings.PaymentParameters_for_keysend(InternalUtils.check_arr_len(payee_pubkey, 33)); + public static PaymentParameters for_keysend(byte[] payee_pubkey, int final_cltv_expiry_delta) { + long ret = bindings.PaymentParameters_for_keysend(InternalUtils.check_arr_len(payee_pubkey, 33), final_cltv_expiry_delta); Reference.reachabilityFence(payee_pubkey); + Reference.reachabilityFence(final_cltv_expiry_delta); 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); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; diff --git a/src/main/java/org/ldk/structs/PaymentPurpose.java b/src/main/java/org/ldk/structs/PaymentPurpose.java index 636ffec5..7c83eec9 100644 --- a/src/main/java/org/ldk/structs/PaymentPurpose.java +++ b/src/main/java/org/ldk/structs/PaymentPurpose.java @@ -119,6 +119,21 @@ public class PaymentPurpose extends CommonBase { return ret_hu_conv; } + /** + * Checks if two PaymentPurposes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ + public boolean eq(org.ldk.structs.PaymentPurpose b) { + boolean ret = bindings.PaymentPurpose_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof PaymentPurpose)) return false; + return this.eq((PaymentPurpose)o); + } /** * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read */ diff --git a/src/main/java/org/ldk/structs/PaymentSendFailure.java b/src/main/java/org/ldk/structs/PaymentSendFailure.java index 7066e754..4eafa113 100644 --- a/src/main/java/org/ldk/structs/PaymentSendFailure.java +++ b/src/main/java/org/ldk/structs/PaymentSendFailure.java @@ -9,9 +9,11 @@ import javax.annotation.Nullable; /** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. + * If a payment fails to send with [`ChannelManager::send_payment`], it can be in one of several + * states. This enum is returned as the Err() type describing which state the payment is in, see + * the description of individual enum states for more. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class PaymentSendFailure extends CommonBase { @@ -47,9 +49,11 @@ public class PaymentSendFailure extends CommonBase { * * You can freely resend the payment in full (with the parameter error fixed). * - * Because the payment failed outright, no payment tracking is done, you do not need to call - * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work - * for this payment. + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ public final static class ParameterError extends PaymentSendFailure { public final org.ldk.structs.APIError parameter_error; @@ -67,12 +71,14 @@ public class PaymentSendFailure extends CommonBase { * * You can freely resend the payment in full (with the parameter error fixed). * + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * * The results here are ordered the same as the paths in the route object which was passed to * send_payment. * - * Because the payment failed outright, no payment tracking is done, you do not need to call - * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work - * for this payment. + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ public final static class PathParameterError extends PaymentSendFailure { public final Result_NoneAPIErrorZ[] path_parameter_error; @@ -94,9 +100,11 @@ public class PaymentSendFailure extends CommonBase { * You can freely resend the payment in full (though you probably want to do so over different * paths than the ones selected). * - * Because the payment failed outright, no payment tracking is done, you do not need to call - * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work - * for this payment. + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ public final static class AllFailedResendSafe extends PaymentSendFailure { public final APIError[] all_failed_resend_safe; @@ -116,10 +124,11 @@ public class PaymentSendFailure extends CommonBase { } /** * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not - * yet completed (i.e. generated an [`Event::PaymentSent`]) or been abandoned (via - * [`ChannelManager::abandon_payment`]). + * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]). * - * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`PaymentId`]: crate::ln::channelmanager::PaymentId + * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ public final static class DuplicatePayment extends PaymentSendFailure { private DuplicatePayment(long ptr, bindings.LDKPaymentSendFailure.DuplicatePayment obj) { @@ -127,28 +136,25 @@ public class PaymentSendFailure extends CommonBase { } } /** - * Some paths which were attempted failed to send, though possibly not all. At least some - * paths have irrevocably committed to the HTLC and retrying the payment in full would result - * in over-/re-payment. + * Some paths that were attempted failed to send, though some paths may have succeeded. At least + * some paths have irrevocably committed to the HTLC. * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be - * safely retried via [`ChannelManager::retry_payment`]. + * The results here are ordered the same as the paths in the route object that was passed to + * send_payment. + * + * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a + * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id. * - * Any entries which contain `Err(APIError::MonitorUpdateInprogress)` or `Ok(())` MUST NOT be - * retried as they will result in over-/re-payment. These HTLCs all either successfully sent - * (in the case of `Ok(())`) or will send once a [`MonitorEvent::Completed`] is provided for - * the next-hop channel with the latest update_id. + * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed */ public final static class PartialFailure extends PaymentSendFailure { /** - * The errors themselves, in the same order as the route hops. + * The errors themselves, in the same order as the paths from the route. */ public final Result_NoneAPIErrorZ[] results; /** * If some paths failed without irrevocably committing to the new HTLC(s), this will - * contain a [`RouteParameters`] object which can be used to calculate a new route that - * will pay all remaining unpaid balance. + * contain a [`RouteParameters`] object for the failing paths. * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -202,6 +208,7 @@ public class PaymentSendFailure extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; return ret_hu_conv; } @@ -226,6 +233,7 @@ public class PaymentSendFailure extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + for (APIError a_conv_10: a) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a_conv_10); }; }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/PeerHandleError.java b/src/main/java/org/ldk/structs/PeerHandleError.java index 5dded5ee..edaf48a1 100644 --- a/src/main/java/org/ldk/structs/PeerHandleError.java +++ b/src/main/java/org/ldk/structs/PeerHandleError.java @@ -22,42 +22,11 @@ public class PeerHandleError extends CommonBase { if (ptr != 0) { bindings.PeerHandleError_free(ptr); } } - /** - * Used to indicate that we probably can't make any future connections to this peer (e.g. - * because we required features that our peer was missing, or vice versa). - * - * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close - * any channels with this peer or check for new versions of LDK. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - public boolean get_no_connection_possible() { - boolean ret = bindings.PeerHandleError_get_no_connection_possible(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Used to indicate that we probably can't make any future connections to this peer (e.g. - * because we required features that our peer was missing, or vice versa). - * - * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close - * any channels with this peer or check for new versions of LDK. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - public void set_no_connection_possible(boolean val) { - bindings.PeerHandleError_set_no_connection_possible(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - /** * Constructs a new PeerHandleError given each field */ - public static PeerHandleError of(boolean no_connection_possible_arg) { - long ret = bindings.PeerHandleError_new(no_connection_possible_arg); - Reference.reachabilityFence(no_connection_possible_arg); + public static PeerHandleError of() { + long ret = bindings.PeerHandleError_new(); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PeerHandleError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PeerHandleError(null, ret); } if (ret_hu_conv != null) { 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 e44bc321..392cba6b 100644 --- a/src/main/java/org/ldk/structs/PeerManager.java +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -48,16 +48,16 @@ public class PeerManager extends CommonBase { * timestamp, however if it is not available a persistent counter that increases once per * minute should suffice. */ - public static PeerManager of(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, OnionMessageHandler message_handler_onion_message_handler_arg, byte[] our_node_secret, int current_time, byte[] ephemeral_random_data, org.ldk.structs.Logger logger, org.ldk.structs.CustomMessageHandler custom_message_handler) { - long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr, message_handler_onion_message_handler_arg == null ? 0 : message_handler_onion_message_handler_arg.ptr), InternalUtils.check_arr_len(our_node_secret, 32), current_time, InternalUtils.check_arr_len(ephemeral_random_data, 32), logger == null ? 0 : logger.ptr, custom_message_handler == null ? 0 : custom_message_handler.ptr); + public static PeerManager of(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, OnionMessageHandler message_handler_onion_message_handler_arg, int current_time, byte[] ephemeral_random_data, org.ldk.structs.Logger logger, org.ldk.structs.CustomMessageHandler custom_message_handler, org.ldk.structs.NodeSigner node_signer) { + long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr, message_handler_onion_message_handler_arg == null ? 0 : message_handler_onion_message_handler_arg.ptr), current_time, InternalUtils.check_arr_len(ephemeral_random_data, 32), logger == null ? 0 : logger.ptr, custom_message_handler == null ? 0 : custom_message_handler.ptr, node_signer == null ? 0 : node_signer.ptr); Reference.reachabilityFence(message_handler_chan_handler_arg); Reference.reachabilityFence(message_handler_route_handler_arg); Reference.reachabilityFence(message_handler_onion_message_handler_arg); - Reference.reachabilityFence(our_node_secret); Reference.reachabilityFence(current_time); Reference.reachabilityFence(ephemeral_random_data); Reference.reachabilityFence(logger); Reference.reachabilityFence(custom_message_handler); + Reference.reachabilityFence(node_signer); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.PeerManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PeerManager(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; @@ -66,24 +66,38 @@ public class PeerManager extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(message_handler_onion_message_handler_arg); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(custom_message_handler); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; return ret_hu_conv; } /** - * Get the list of node ids for peers which have completed the initial handshake. + * Get a list of tuples mapping from node id to network addresses for peers which have + * completed the initial handshake. * - * For outbound connections, this will be the same as the their_node_id parameter passed in to - * new_outbound_connection, however entries will only appear once the initial handshake has - * completed and we are sure the remote peer has the private key for the given node_id. + * For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter + * passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial + * handshake has completed and we are sure the remote peer has the private key for the given + * [`PublicKey`]. + * + * The returned `Option`s will only be `Some` if an address had been previously given via + * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`]. */ - public byte[][] get_peer_node_ids() { - byte[][] ret = bindings.PeerManager_get_peer_node_ids(this.ptr); + public TwoTuple_PublicKeyCOption_NetAddressZZ[] get_peer_node_ids() { + long[] ret = bindings.PeerManager_get_peer_node_ids(this.ptr); Reference.reachabilityFence(this); - return ret; + int ret_conv_40_len = ret.length; + TwoTuple_PublicKeyCOption_NetAddressZZ[] ret_conv_40_arr = new TwoTuple_PublicKeyCOption_NetAddressZZ[ret_conv_40_len]; + for (int o = 0; o < ret_conv_40_len; o++) { + long ret_conv_40 = ret[o]; + TwoTuple_PublicKeyCOption_NetAddressZZ ret_conv_40_hu_conv = new TwoTuple_PublicKeyCOption_NetAddressZZ(null, ret_conv_40); + if (ret_conv_40_hu_conv != null) { ret_conv_40_hu_conv.ptrs_to.add(this); }; + ret_conv_40_arr[o] = ret_conv_40_hu_conv; + } + return ret_conv_40_arr; } /** - * Indicates a new outbound connection has been established to a node with the given node_id + * Indicates a new outbound connection has been established to a node with the given `node_id` * and an optional remote network address. * * The remote network address adds the option to report a remote IP address back to a connecting @@ -108,6 +122,7 @@ public class PeerManager extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(descriptor); }; + if (this != null) { this.ptrs_to.add(remote_network_address); }; return ret_hu_conv; } @@ -136,6 +151,7 @@ public class PeerManager extends CommonBase { if (ret >= 0 && ret <= 4096) { return null; } Result_NonePeerHandleErrorZ ret_hu_conv = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(descriptor); }; + if (this != null) { this.ptrs_to.add(remote_network_address); }; return ret_hu_conv; } @@ -175,6 +191,9 @@ public class PeerManager extends CommonBase { * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the * send buffer). * + * In order to avoid processing too many messages at once per peer, `data` should be on the + * order of 4KiB. + * * [`send_data`]: SocketDescriptor::send_data * [`process_events`]: PeerManager::process_events */ @@ -224,19 +243,15 @@ public class PeerManager extends CommonBase { /** * Disconnect a peer given its node id. * - * Set `no_connection_possible` to true to prevent any further connection with this peer, - * force-closing any channels we have with it. - * * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the * peer. Thus, be very careful about reentrancy issues. * * [`disconnect_socket`]: SocketDescriptor::disconnect_socket */ - public void disconnect_by_node_id(byte[] node_id, boolean no_connection_possible) { - bindings.PeerManager_disconnect_by_node_id(this.ptr, InternalUtils.check_arr_len(node_id, 33), no_connection_possible); + public void disconnect_by_node_id(byte[] node_id) { + bindings.PeerManager_disconnect_by_node_id(this.ptr, InternalUtils.check_arr_len(node_id, 33)); Reference.reachabilityFence(this); Reference.reachabilityFence(node_id); - Reference.reachabilityFence(no_connection_possible); } /** @@ -290,6 +305,7 @@ public class PeerManager extends CommonBase { Reference.reachabilityFence(rgb); Reference.reachabilityFence(alias); Reference.reachabilityFence(addresses); + for (NetAddress addresses_conv_12: addresses) { if (this != null) { this.ptrs_to.add(addresses_conv_12); }; }; } } diff --git a/src/main/java/org/ldk/structs/Persist.java b/src/main/java/org/ldk/structs/Persist.java index 5ce6a580..9bd8bde4 100644 --- a/src/main/java/org/ldk/structs/Persist.java +++ b/src/main/java/org/ldk/structs/Persist.java @@ -42,7 +42,19 @@ public class Persist extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Persist_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Persist_free(ptr); } + ptr = 0; + } public static interface PersistInterface { /** * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is @@ -119,6 +131,7 @@ public class Persist extends CommonBase { org.ldk.structs.OutPoint channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.OutPoint(null, channel_id); } if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); }; org.ldk.structs.ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new org.ldk.structs.ChannelMonitorUpdate(null, update); } + if (update_hu_conv != null) { update_hu_conv.ptrs_to.add(this); }; org.ldk.structs.ChannelMonitor data_hu_conv = null; if (data < 0 || data > 4096) { data_hu_conv = new org.ldk.structs.ChannelMonitor(null, data); } org.ldk.structs.MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new org.ldk.structs.MonitorUpdateId(null, update_id); } if (update_id_hu_conv != null) { update_id_hu_conv.ptrs_to.add(this); }; diff --git a/src/main/java/org/ldk/structs/Persister.java b/src/main/java/org/ldk/structs/Persister.java index 63293035..3cdf7360 100644 --- a/src/main/java/org/ldk/structs/Persister.java +++ b/src/main/java/org/ldk/structs/Persister.java @@ -23,7 +23,19 @@ public class Persister extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Persister_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Persister_free(ptr); } + ptr = 0; + } public static interface PersisterInterface { /** * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. diff --git a/src/main/java/org/ldk/structs/PhantomKeysManager.java b/src/main/java/org/ldk/structs/PhantomKeysManager.java index 2a192680..6b4134bb 100644 --- a/src/main/java/org/ldk/structs/PhantomKeysManager.java +++ b/src/main/java/org/ldk/structs/PhantomKeysManager.java @@ -35,14 +35,40 @@ public class PhantomKeysManager extends CommonBase { } /** - * Constructs a new KeysInterface which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is */ - public KeysInterface as_KeysInterface() { - long ret = bindings.PhantomKeysManager_as_KeysInterface(this.ptr); + public EntropySource as_EntropySource() { + long ret = bindings.PhantomKeysManager_as_EntropySource(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - KeysInterface ret_hu_conv = new KeysInterface(null, ret); + EntropySource ret_hu_conv = new EntropySource(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + */ + public NodeSigner as_NodeSigner() { + long ret = bindings.PhantomKeysManager_as_NodeSigner(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + NodeSigner ret_hu_conv = new NodeSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is + */ + public SignerProvider as_SignerProvider() { + long ret = bindings.PhantomKeysManager_as_SignerProvider(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + SignerProvider ret_hu_conv = new SignerProvider(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -84,6 +110,7 @@ public class PhantomKeysManager extends CommonBase { Reference.reachabilityFence(feerate_sat_per_1000_weight); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); + for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (this != null) { this.ptrs_to.add(descriptors_conv_27); }; }; return ret_hu_conv; } @@ -101,4 +128,23 @@ public class PhantomKeysManager extends CommonBase { return ret_hu_conv; } + /** + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + */ + public byte[] get_node_secret_key() { + byte[] ret = bindings.PhantomKeysManager_get_node_secret_key(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the + * last-hop onion data, etc. + */ + public byte[] get_phantom_node_secret_key() { + byte[] ret = bindings.PhantomKeysManager_get_phantom_node_secret_key(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/Ping.java b/src/main/java/org/ldk/structs/Ping.java index 912f5f74..7ee1f980 100644 --- a/src/main/java/org/ldk/structs/Ping.java +++ b/src/main/java/org/ldk/structs/Ping.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A ping message to be sent or received from a peer + * A [`ping`] message to be sent to or received from a peer. + * + * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Ping extends CommonBase { @@ -21,7 +23,7 @@ public class Ping extends CommonBase { } /** - * The desired response length + * The desired response length. */ public short get_ponglen() { short ret = bindings.Ping_get_ponglen(this.ptr); @@ -30,7 +32,7 @@ public class Ping extends CommonBase { } /** - * The desired response length + * The desired response length. */ public void set_ponglen(short val) { bindings.Ping_set_ponglen(this.ptr, val); @@ -40,6 +42,7 @@ public class Ping extends CommonBase { /** * The ping packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ public short get_byteslen() { @@ -50,6 +53,7 @@ public class Ping extends CommonBase { /** * The ping packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ public void set_byteslen(short val) { diff --git a/src/main/java/org/ldk/structs/Pong.java b/src/main/java/org/ldk/structs/Pong.java index 536f0010..0a3b3953 100644 --- a/src/main/java/org/ldk/structs/Pong.java +++ b/src/main/java/org/ldk/structs/Pong.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A pong message to be sent or received from a peer + * A [`pong`] message to be sent to or received from a peer. + * + * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Pong extends CommonBase { @@ -22,6 +24,7 @@ public class Pong extends CommonBase { /** * The pong packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ public short get_byteslen() { @@ -32,6 +35,7 @@ public class Pong extends CommonBase { /** * The pong packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ public void set_byteslen(short val) { diff --git a/src/main/java/org/ldk/structs/ProbabilisticScorer.java b/src/main/java/org/ldk/structs/ProbabilisticScorer.java index 61048c57..ecd6aafb 100644 --- a/src/main/java/org/ldk/structs/ProbabilisticScorer.java +++ b/src/main/java/org/ldk/structs/ProbabilisticScorer.java @@ -100,6 +100,41 @@ public class ProbabilisticScorer extends CommonBase { return ret_hu_conv; } + /** + * Query the historical estimated minimum and maximum liquidity available for sending a + * payment over the channel with `scid` towards the given `target` node. + * + * Returns two sets of 8 buckets. The first set describes the octiles for lower-bound + * liquidity estimates, the second set describes the octiles for upper-bound liquidity + * estimates. Each bucket describes the relative frequency at which we've seen a liquidity + * bound in the octile relative to the channel's total capacity, on an arbitrary scale. + * Because the values are slowly decayed, more recent data points are weighted more heavily + * than older datapoints. + * + * When scoring, the estimated probability that an upper-/lower-bound lies in a given octile + * relative to the channel's total capacity is calculated by dividing that bucket's value with + * the total of all buckets for the given bound. + * + * For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability + * of a bound being in the top octile to be 100%, and have never (recently) seen it in any + * other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being + * both in the top and bottom octile, and roughly with similar (recent) frequency. + * + * Because the datapoints are decayed slowly over time, values will eventually return to + * `Some(([0; 8], [0; 8]))`. + */ + public Option_C2Tuple_EightU16sEightU16sZZ historical_estimated_channel_liquidity_probabilities(long scid, org.ldk.structs.NodeId target) { + long ret = bindings.ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(this.ptr, scid, target == null ? 0 : target.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(scid); + Reference.reachabilityFence(target); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_EightU16sEightU16sZZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + if (this != null) { this.ptrs_to.add(target); }; + return ret_hu_conv; + } + /** * Marks the node with the given `node_id` as banned, i.e., * it will be avoided during path finding. diff --git a/src/main/java/org/ldk/structs/QueryChannelRange.java b/src/main/java/org/ldk/structs/QueryChannelRange.java index a17db50e..1a83e29a 100644 --- a/src/main/java/org/ldk/structs/QueryChannelRange.java +++ b/src/main/java/org/ldk/structs/QueryChannelRange.java @@ -9,10 +9,12 @@ import javax.annotation.Nullable; /** - * A query_channel_range message is used to query a peer for channel + * A [`query_channel_range`] message is used to query a peer for channel * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range + * effort to reply to the query using one or more [`ReplyChannelRange`] * messages. + * + * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class QueryChannelRange extends CommonBase { @@ -127,7 +129,9 @@ public class QueryChannelRange extends CommonBase { return this.eq((QueryChannelRange)o); } /** - * \n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t + * Calculates the overflow safe ending block height for the query. + * + * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`. */ public int end_blocknum() { int ret = bindings.QueryChannelRange_end_blocknum(this.ptr); diff --git a/src/main/java/org/ldk/structs/QueryShortChannelIds.java b/src/main/java/org/ldk/structs/QueryShortChannelIds.java index 20a27f89..c556b71d 100644 --- a/src/main/java/org/ldk/structs/QueryShortChannelIds.java +++ b/src/main/java/org/ldk/structs/QueryShortChannelIds.java @@ -9,14 +9,17 @@ import javax.annotation.Nullable; /** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. + * A [`query_short_channel_ids`] message is used to query a peer for + * routing gossip messages related to one or more `short_channel_id`s. + * * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages + * it maintains for the requested `short_channel_id`s followed by a + * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in + * this query are encoded. We only support `encoding_type=0` uncompressed + * serialization and do not support `encoding_type=1` zlib serialization. + * + * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class QueryShortChannelIds extends CommonBase { diff --git a/src/main/java/org/ldk/structs/RapidGossipSync.java b/src/main/java/org/ldk/structs/RapidGossipSync.java index f9b22d31..f8964ffa 100644 --- a/src/main/java/org/ldk/structs/RapidGossipSync.java +++ b/src/main/java/org/ldk/structs/RapidGossipSync.java @@ -27,13 +27,15 @@ public class RapidGossipSync extends CommonBase { /** * Instantiate a new [`RapidGossipSync`] instance. */ - public static RapidGossipSync of(org.ldk.structs.NetworkGraph network_graph) { - long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr); + public static RapidGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger) { + long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr); Reference.reachabilityFence(network_graph); + Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.RapidGossipSync ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RapidGossipSync(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; return ret_hu_conv; } @@ -41,8 +43,6 @@ public class RapidGossipSync extends CommonBase { * Update network graph from binary data. * Returns the last sync timestamp to be used the next time rapid sync data is queried. * - * `network_graph`: network graph to be updated - * * `update_data`: `&[u8]` binary stream that comprises the update data */ public Result_u32GraphSyncErrorZ update_network_graph(byte[] update_data) { @@ -54,6 +54,24 @@ public class RapidGossipSync extends CommonBase { return ret_hu_conv; } + /** + * Update network graph from binary data. + * Returns the last sync timestamp to be used the next time rapid sync data is queried. + * + * `update_data`: `&[u8]` binary stream that comprises the update data + * `current_time_unix`: `Option` optional current timestamp to verify data age + */ + public Result_u32GraphSyncErrorZ update_network_graph_no_std(byte[] update_data, org.ldk.structs.Option_u64Z current_time_unix) { + long ret = bindings.RapidGossipSync_update_network_graph_no_std(this.ptr, update_data, current_time_unix.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(update_data); + Reference.reachabilityFence(current_time_unix); + if (ret >= 0 && ret <= 4096) { return null; } + Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(current_time_unix); }; + return ret_hu_conv; + } + /** * Returns whether a rapid gossip sync has completed at least once. */ diff --git a/src/main/java/org/ldk/structs/RawInvoice.java b/src/main/java/org/ldk/structs/RawInvoice.java index f65b3a40..10548908 100644 --- a/src/main/java/org/ldk/structs/RawInvoice.java +++ b/src/main/java/org/ldk/structs/RawInvoice.java @@ -171,11 +171,11 @@ public class RawInvoice extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public MinFinalCltvExpiry min_final_cltv_expiry() { - long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr); + public MinFinalCltvExpiryDelta min_final_cltv_expiry_delta() { + long ret = bindings.RawInvoice_min_final_cltv_expiry_delta(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiry(null, ret); } + org.ldk.structs.MinFinalCltvExpiryDelta ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiryDelta(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/RecentPaymentDetails.java b/src/main/java/org/ldk/structs/RecentPaymentDetails.java new file mode 100644 index 00000000..1ccd5996 --- /dev/null +++ b/src/main/java/org/ldk/structs/RecentPaymentDetails.java @@ -0,0 +1,145 @@ +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; + + +/** + * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments. + * These include payments that have yet to find a successful path, or have unresolved HTLCs. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class RecentPaymentDetails extends CommonBase { + private RecentPaymentDetails(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.RecentPaymentDetails_free(ptr); } + } + static RecentPaymentDetails constr_from_ptr(long ptr) { + bindings.LDKRecentPaymentDetails raw_val = bindings.LDKRecentPaymentDetails_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKRecentPaymentDetails.Pending.class) { + return new Pending(ptr, (bindings.LDKRecentPaymentDetails.Pending)raw_val); + } + if (raw_val.getClass() == bindings.LDKRecentPaymentDetails.Fulfilled.class) { + return new Fulfilled(ptr, (bindings.LDKRecentPaymentDetails.Fulfilled)raw_val); + } + if (raw_val.getClass() == bindings.LDKRecentPaymentDetails.Abandoned.class) { + return new Abandoned(ptr, (bindings.LDKRecentPaymentDetails.Abandoned)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When a payment is still being sent and awaiting successful delivery. + */ + public final static class Pending extends RecentPaymentDetails { + /** + * Hash of the payment that is currently being sent but has yet to be fulfilled or + * abandoned. + */ + public final byte[] payment_hash; + /** + * Total amount (in msat, excluding fees) across all paths for this payment, + * not just the amount currently inflight. + */ + public final long total_msat; + private Pending(long ptr, bindings.LDKRecentPaymentDetails.Pending obj) { + super(null, ptr); + this.payment_hash = obj.payment_hash; + this.total_msat = obj.total_msat; + } + } + /** + * When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have + * been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the + * payment is removed from tracking. + */ + public final static class Fulfilled extends RecentPaymentDetails { + /** + * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`] + * made before LDK version 0.0.104. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public final byte[] payment_hash; + private Fulfilled(long ptr, bindings.LDKRecentPaymentDetails.Fulfilled obj) { + super(null, ptr); + this.payment_hash = obj.payment_hash; + } + } + /** + * After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly + * abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all + * pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated. + */ + public final static class Abandoned extends RecentPaymentDetails { + /** + * Hash of the payment that we have given up trying to send. + */ + public final byte[] payment_hash; + private Abandoned(long ptr, bindings.LDKRecentPaymentDetails.Abandoned obj) { + super(null, ptr); + this.payment_hash = obj.payment_hash; + } + } + long clone_ptr() { + long ret = bindings.RecentPaymentDetails_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the RecentPaymentDetails + */ + public RecentPaymentDetails clone() { + long ret = bindings.RecentPaymentDetails_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Pending-variant RecentPaymentDetails + */ + public static RecentPaymentDetails pending(byte[] payment_hash, long total_msat) { + long ret = bindings.RecentPaymentDetails_pending(InternalUtils.check_arr_len(payment_hash, 32), total_msat); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(total_msat); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails + */ + public static RecentPaymentDetails fulfilled(byte[] payment_hash) { + long ret = bindings.RecentPaymentDetails_fulfilled(InternalUtils.check_arr_len(payment_hash, 32)); + Reference.reachabilityFence(payment_hash); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Abandoned-variant RecentPaymentDetails + */ + public static RecentPaymentDetails abandoned(byte[] payment_hash) { + long ret = bindings.RecentPaymentDetails_abandoned(InternalUtils.check_arr_len(payment_hash, 32)); + Reference.reachabilityFence(payment_hash); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ReplyChannelRange.java b/src/main/java/org/ldk/structs/ReplyChannelRange.java index 2799beda..74550475 100644 --- a/src/main/java/org/ldk/structs/ReplyChannelRange.java +++ b/src/main/java/org/ldk/structs/ReplyChannelRange.java @@ -9,13 +9,17 @@ import javax.annotation.Nullable; /** - * A reply_channel_range message is a reply to a query_channel_range - * message. Multiple reply_channel_range messages can be sent in reply - * to a single query_channel_range message. The query recipient makes a + * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`] + * message. + * + * Multiple `reply_channel_range` messages can be sent in reply + * to a single [`QueryChannelRange`] message. The query recipient makes a * best effort to respond based on their local network view which may - * not be a perfect view of the network. The short_channel_ids in the - * reply are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * not be a perfect view of the network. The `short_channel_id`s in the + * reply are encoded. We only support `encoding_type=0` uncompressed + * serialization and do not support `encoding_type=1` zlib serialization. + * + * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ReplyChannelRange extends CommonBase { @@ -99,7 +103,7 @@ public class ReplyChannelRange extends CommonBase { } /** - * The short_channel_ids in the channel range + * The `short_channel_id`s in the channel range * * Returns a copy of the field. */ @@ -110,7 +114,7 @@ public class ReplyChannelRange extends CommonBase { } /** - * The short_channel_ids in the channel range + * The `short_channel_id`s in the channel range */ public void set_short_channel_ids(long[] val) { bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java index 7bb3b65f..e6b5428e 100644 --- a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java +++ b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java @@ -9,10 +9,12 @@ import javax.annotation.Nullable; /** - * A reply_short_channel_ids_end message is sent as a reply to a - * query_short_channel_ids message. The query recipient makes a best + * A [`reply_short_channel_ids_end`] message is sent as a reply to a + * message. The query recipient makes a best * effort to respond based on their local network view which may not be * a perfect view of the network. + * + * [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ReplyShortChannelIdsEnd extends CommonBase { @@ -43,7 +45,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { /** * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * information for the `chain_hash` */ public boolean get_full_information() { boolean ret = bindings.ReplyShortChannelIdsEnd_get_full_information(this.ptr); @@ -53,7 +55,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { /** * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * information for the `chain_hash` */ public void set_full_information(boolean val) { bindings.ReplyShortChannelIdsEnd_set_full_information(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java index f6d58ac8..61100382 100644 --- a/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_AcceptChannelDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java index abbcab5f..c0021221 100644 --- a/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_AnnouncementSignaturesDecodeErrorZ ret_hu_conv = Result_AnnouncementSignaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_BlindedHopDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_BlindedHopDecodeErrorZ.java index dec3ce27..2d9d6021 100644 --- a/src/main/java/org/ldk/structs/Result_BlindedHopDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_BlindedHopDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_BlindedHopDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_BlindedHopDecodeErrorZ ret_hu_conv = Result_BlindedHopDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_BlindedHopFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_BlindedHopFeaturesDecodeErrorZ.java new file mode 100644 index 00000000..80ffa046 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_BlindedHopFeaturesDecodeErrorZ.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; + +public class Result_BlindedHopFeaturesDecodeErrorZ extends CommonBase { + private Result_BlindedHopFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_BlindedHopFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_BlindedHopFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(ptr)) { + return new Result_BlindedHopFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_BlindedHopFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_BlindedHopFeaturesDecodeErrorZ_OK extends Result_BlindedHopFeaturesDecodeErrorZ { + public final BlindedHopFeatures res; + private Result_BlindedHopFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(ptr); + org.ldk.structs.BlindedHopFeatures res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.BlindedHopFeatures(null, res); } + if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; + this.res = res_hu_conv; + } + } + + public static final class Result_BlindedHopFeaturesDecodeErrorZ_Err extends Result_BlindedHopFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_BlindedHopFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. + */ + public static Result_BlindedHopFeaturesDecodeErrorZ ok(org.ldk.structs.BlindedHopFeatures o) { + long ret = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_BlindedHopFeaturesDecodeErrorZ ret_hu_conv = Result_BlindedHopFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. + */ + public static Result_BlindedHopFeaturesDecodeErrorZ err(org.ldk.structs.DecodeError e) { + long ret = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_BlindedHopFeaturesDecodeErrorZ ret_hu_conv = Result_BlindedHopFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_BlindedHopFeaturesDecodeErrorZ clone() { + long ret = bindings.CResult_BlindedHopFeaturesDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_BlindedHopFeaturesDecodeErrorZ ret_hu_conv = Result_BlindedHopFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_BlindedPathDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_BlindedPathDecodeErrorZ.java index f9bdcd51..16c4efbb 100644 --- a/src/main/java/org/ldk/structs/Result_BlindedPathDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_BlindedPathDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_BlindedPathDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_BlindedPathDecodeErrorZ ret_hu_conv = Result_BlindedPathDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java index 97704aa5..950d36ea 100644 --- a/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java index 5ef2eb4c..c45dbb2d 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java @@ -61,6 +61,7 @@ public class Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ extends CommonB Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java index b08bd9ec..be8c2082 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java @@ -61,6 +61,7 @@ public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonB Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java index 3544733d..415766c7 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java @@ -61,6 +61,7 @@ public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends Com Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java index 28503d29..7a545bd3 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java @@ -61,6 +61,7 @@ public class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ extends CommonBas Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureSignatureZNoneZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureSignatureZNoneZ.java deleted file mode 100644 index 02fd1898..00000000 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureSignatureZNoneZ.java +++ /dev/null @@ -1,88 +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; - -public class Result_C2Tuple_SignatureSignatureZNoneZ extends CommonBase { - private Result_C2Tuple_SignatureSignatureZNoneZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_free(ptr); } super.finalize(); - } - - static Result_C2Tuple_SignatureSignatureZNoneZ constr_from_ptr(long ptr) { - if (bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(ptr)) { - return new Result_C2Tuple_SignatureSignatureZNoneZ_OK(null, ptr); - } else { - return new Result_C2Tuple_SignatureSignatureZNoneZ_Err(null, ptr); - } - } - public static final class Result_C2Tuple_SignatureSignatureZNoneZ_OK extends Result_C2Tuple_SignatureSignatureZNoneZ { - public final TwoTuple_SignatureSignatureZ res; - private Result_C2Tuple_SignatureSignatureZNoneZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(ptr); - TwoTuple_SignatureSignatureZ res_hu_conv = new TwoTuple_SignatureSignatureZ(null, res); - if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; - this.res = res_hu_conv; - } - } - - public static final class Result_C2Tuple_SignatureSignatureZNoneZ_Err extends Result_C2Tuple_SignatureSignatureZNoneZ { - private Result_C2Tuple_SignatureSignatureZNoneZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - /** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state. - */ - public static Result_C2Tuple_SignatureSignatureZNoneZ ok(org.ldk.structs.TwoTuple_SignatureSignatureZ o) { - long ret = bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o != null ? o.ptr : 0); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_SignatureSignatureZNoneZ ret_hu_conv = Result_C2Tuple_SignatureSignatureZNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state. - */ - public static Result_C2Tuple_SignatureSignatureZNoneZ err() { - long ret = bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_err(); - if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_SignatureSignatureZNoneZ ret_hu_conv = Result_C2Tuple_SignatureSignatureZNoneZ.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_C2Tuple_SignatureSignatureZNoneZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_C2Tuple_SignatureSignatureZNoneZ clone() { - long ret = bindings.CResult_C2Tuple_SignatureSignatureZNoneZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_SignatureSignatureZNoneZ ret_hu_conv = Result_C2Tuple_SignatureSignatureZNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_COption_APIErrorZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_APIErrorZDecodeErrorZ.java new file mode 100644 index 00000000..d549e507 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_COption_APIErrorZDecodeErrorZ.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; + +public class Result_COption_APIErrorZDecodeErrorZ extends CommonBase { + private Result_COption_APIErrorZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_COption_APIErrorZDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_COption_APIErrorZDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_COption_APIErrorZDecodeErrorZ_is_ok(ptr)) { + return new Result_COption_APIErrorZDecodeErrorZ_OK(null, ptr); + } else { + return new Result_COption_APIErrorZDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_COption_APIErrorZDecodeErrorZ_OK extends Result_COption_APIErrorZDecodeErrorZ { + public final Option_APIErrorZ res; + private Result_COption_APIErrorZDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_COption_APIErrorZDecodeErrorZ_get_ok(ptr); + org.ldk.structs.Option_APIErrorZ res_hu_conv = org.ldk.structs.Option_APIErrorZ.constr_from_ptr(res); + if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; + this.res = res_hu_conv; + } + } + + public static final class Result_COption_APIErrorZDecodeErrorZ_Err extends Result_COption_APIErrorZDecodeErrorZ { + public final DecodeError err; + private Result_COption_APIErrorZDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_COption_APIErrorZDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. + */ + public static Result_COption_APIErrorZDecodeErrorZ ok(org.ldk.structs.Option_APIErrorZ o) { + long ret = bindings.CResult_COption_APIErrorZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. + */ + public static Result_COption_APIErrorZDecodeErrorZ err(org.ldk.structs.DecodeError e) { + long ret = bindings.CResult_COption_APIErrorZDecodeErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_COption_APIErrorZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_COption_APIErrorZDecodeErrorZ clone() { + long ret = bindings.CResult_COption_APIErrorZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java index 683e3fff..01e399da 100644 --- a/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java index 860db7cb..9dc69021 100644 --- a/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_CustomOnionMessageContentsZDecodeErrorZ extends Comm Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_CustomOnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_CustomOnionMessageContentsZDecodeErrorZ extends Comm Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_CustomOnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java index 3ceca9cd..97941634 100644 --- a/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java index f9e5e50a..e147f1f0 100644 --- a/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_HTLCDestinationZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_HTLCDestinationZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_HTLCDestinationZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java index 5ebfcbe9..427e9fae 100644 --- a/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java index ed223cc0..b8e241e1 100644 --- a/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_PathFailureZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_PathFailureZDecodeErrorZ.java new file mode 100644 index 00000000..3c4d8f2e --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_COption_PathFailureZDecodeErrorZ.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; + +public class Result_COption_PathFailureZDecodeErrorZ extends CommonBase { + private Result_COption_PathFailureZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_COption_PathFailureZDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_COption_PathFailureZDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_COption_PathFailureZDecodeErrorZ_is_ok(ptr)) { + return new Result_COption_PathFailureZDecodeErrorZ_OK(null, ptr); + } else { + return new Result_COption_PathFailureZDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_COption_PathFailureZDecodeErrorZ_OK extends Result_COption_PathFailureZDecodeErrorZ { + public final Option_PathFailureZ res; + private Result_COption_PathFailureZDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_COption_PathFailureZDecodeErrorZ_get_ok(ptr); + org.ldk.structs.Option_PathFailureZ res_hu_conv = org.ldk.structs.Option_PathFailureZ.constr_from_ptr(res); + if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; + this.res = res_hu_conv; + } + } + + public static final class Result_COption_PathFailureZDecodeErrorZ_Err extends Result_COption_PathFailureZDecodeErrorZ { + public final DecodeError err; + private Result_COption_PathFailureZDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_COption_PathFailureZDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. + */ + public static Result_COption_PathFailureZDecodeErrorZ ok(org.ldk.structs.Option_PathFailureZ o) { + long ret = bindings.CResult_COption_PathFailureZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. + */ + public static Result_COption_PathFailureZDecodeErrorZ err(org.ldk.structs.DecodeError e) { + long ret = bindings.CResult_COption_PathFailureZDecodeErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_COption_PathFailureZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_COption_PathFailureZDecodeErrorZ clone() { + long ret = bindings.CResult_COption_PathFailureZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java index c549e436..210a7ef2 100644 --- a/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java index b710488a..0a658ef4 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java index c481a0e3..f11c6a46 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelConfigDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelCounterpartyDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelCounterpartyDecodeErrorZ.java index 5fa1e0ae..be39ca20 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelCounterpartyDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelCounterpartyDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelCounterpartyDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelCounterpartyDecodeErrorZ ret_hu_conv = Result_ChannelCounterpartyDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelDetailsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelDetailsDecodeErrorZ.java index f9cbb1ca..0ed7390d 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelDetailsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelDetailsDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelDetailsDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java index 6cc56347..dbe81743 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java index d36ac5a9..38da077b 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelInfoDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java index 40cb1740..cfd46659 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelMonitorUpdateDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java index 9115fac1..66e82f04 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelReadyDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelReadyDecodeErrorZ.java index 40f30b6f..c1e395f3 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelReadyDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelReadyDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelReadyDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelReadyDecodeErrorZ ret_hu_conv = Result_ChannelReadyDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java index 9079d7e8..0855b800 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelReestablishDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java index 5bfc9297..6a293d18 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java index f503e7cf..d72b8edb 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelTypeFeaturesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java index efe33a93..a9849cdd 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelUpdateDecodeErrorZ ret_hu_conv = Result_ChannelUpdateDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelUpdateInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelUpdateInfoDecodeErrorZ.java index 80dbf162..8648d4d9 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelUpdateInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelUpdateInfoDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ChannelUpdateInfoDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java index f87d0950..e1e3d217 100644 --- a/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ClosingSignedDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java index cb0fa799..b3f37dbe 100644 --- a/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java index 0b0148f5..c1ba1c82 100644 --- a/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java index 99e1d770..76678e81 100644 --- a/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java index 20a8f489..e9a67e08 100644 --- a/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_CounterpartyChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.java index bfd3bfc0..b4c513d3 100644 --- a/src/main/java/org/ldk/structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_CounterpartyCommitmentSecretsDecodeErrorZ extends CommonBase Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyCommitmentSecretsDecodeErrorZ ret_hu_conv = Result_CounterpartyCommitmentSecretsDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_CounterpartyForwardingInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CounterpartyForwardingInfoDecodeErrorZ.java index e48f0068..bb415a5e 100644 --- a/src/main/java/org/ldk/structs/Result_CounterpartyForwardingInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CounterpartyForwardingInfoDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_CounterpartyForwardingInfoDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyForwardingInfoDecodeErrorZ ret_hu_conv = Result_CounterpartyForwardingInfoDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java index d8cddc27..81f5d24f 100644 --- a/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_DelayedPaymentOutputDescriptorDecodeErrorZ extends CommonBas Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java index 80eae4b5..53bc8baf 100644 --- a/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ErrorMessageDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_FixedPenaltyScorerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FixedPenaltyScorerDecodeErrorZ.java index 9cae4c48..24ce57de 100644 --- a/src/main/java/org/ldk/structs/Result_FixedPenaltyScorerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_FixedPenaltyScorerDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_FixedPenaltyScorerDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java index a798503a..0625eb8b 100644 --- a/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_FundingCreatedDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java index 17d5464e..8037ac37 100644 --- a/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_FundingSignedDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java index ec6fcaa0..aa5bed90 100644 --- a/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_GossipTimestampFilterDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java index ccc39e76..bd76d557 100644 --- a/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java index 2280933c..b63eae8c 100644 --- a/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java index 34a55904..a91cae28 100644 --- a/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java index d40acacb..024cc29f 100644 --- a/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InFlightHtlcsDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_InFlightHtlcsDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InFlightHtlcsDecodeErrorZ ret_hu_conv = Result_InFlightHtlcsDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java index 4408c75b..8dff6858 100644 --- a/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_InMemorySignerDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java index a4168ada..35ddbb36 100644 --- a/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_InitDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java index b9bda8c1..b191a5db 100644 --- a/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_InitFeaturesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java index 3d87850b..da019190 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java index f0013147..33765576 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java @@ -62,6 +62,7 @@ public class Result_InvoiceParseOrSemanticErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InvoiceRequestFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceRequestFeaturesDecodeErrorZ.java deleted file mode 100644 index d5017d7c..00000000 --- a/src/main/java/org/ldk/structs/Result_InvoiceRequestFeaturesDecodeErrorZ.java +++ /dev/null @@ -1,95 +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; - -public class Result_InvoiceRequestFeaturesDecodeErrorZ extends CommonBase { - private Result_InvoiceRequestFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_InvoiceRequestFeaturesDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(ptr)) { - return new Result_InvoiceRequestFeaturesDecodeErrorZ_OK(null, ptr); - } else { - return new Result_InvoiceRequestFeaturesDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_InvoiceRequestFeaturesDecodeErrorZ_OK extends Result_InvoiceRequestFeaturesDecodeErrorZ { - public final InvoiceRequestFeatures res; - private Result_InvoiceRequestFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(ptr); - org.ldk.structs.InvoiceRequestFeatures res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, res); } - if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; - this.res = res_hu_conv; - } - } - - public static final class Result_InvoiceRequestFeaturesDecodeErrorZ_Err extends Result_InvoiceRequestFeaturesDecodeErrorZ { - public final DecodeError err; - private Result_InvoiceRequestFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(ptr); - org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); - if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state. - */ - public static Result_InvoiceRequestFeaturesDecodeErrorZ ok(org.ldk.structs.InvoiceRequestFeatures o) { - long ret = bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceRequestFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceRequestFeaturesDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - return ret_hu_conv; - } - - /** - * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state. - */ - public static Result_InvoiceRequestFeaturesDecodeErrorZ err(org.ldk.structs.DecodeError e) { - long ret = bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e.ptr); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceRequestFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceRequestFeaturesDecodeErrorZ.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_InvoiceRequestFeaturesDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_InvoiceRequestFeaturesDecodeErrorZ clone() { - long ret = bindings.CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceRequestFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceRequestFeaturesDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java index 73648043..5e563e9b 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java @@ -62,6 +62,7 @@ public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java index 6048c1fd..312de2c2 100644 --- a/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NetAddressDecodeErrorZ ret_hu_conv = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NetAddressDecodeErrorZ ret_hu_conv = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java index 87451a60..5bc5b473 100644 --- a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java @@ -45,13 +45,12 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { /** * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ - public static Result_NetworkGraphDecodeErrorZ ok(byte[] o_genesis_hash, Logger o_logger) { - long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(InternalUtils.check_arr_len(o_genesis_hash, 32), o_logger == null ? 0 : o_logger.ptr)); - Reference.reachabilityFence(o_genesis_hash); + public static Result_NetworkGraphDecodeErrorZ ok(Network o_network, Logger o_logger) { + long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_network, o_logger == null ? 0 : o_logger.ptr)); + Reference.reachabilityFence(o_network); Reference.reachabilityFence(o_logger); if (ret >= 0 && ret <= 4096) { return null; } Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); - ; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_logger); }; return ret_hu_conv; } @@ -64,6 +63,7 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NodeAliasDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeAliasDecodeErrorZ.java index a0052ef8..d4a481e7 100644 --- a/src/main/java/org/ldk/structs/Result_NodeAliasDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeAliasDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_NodeAliasDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAliasDecodeErrorZ ret_hu_conv = Result_NodeAliasDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java index acb7db62..1288434d 100644 --- a/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java index 7a35f67f..12c1309a 100644 --- a/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_NodeAnnouncementInfoDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java index c2ecc005..71ce2926 100644 --- a/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java index 16c17231..2701159b 100644 --- a/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_NodeIdDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java index cc03cf9f..da911db9 100644 --- a/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_NodeInfoDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java index dd7b843a..17b3a56e 100644 --- a/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java @@ -55,6 +55,7 @@ public class Result_NoneAPIErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NonePaymentErrorZ.java b/src/main/java/org/ldk/structs/Result_NonePaymentErrorZ.java index 7bccf9a3..87442082 100644 --- a/src/main/java/org/ldk/structs/Result_NonePaymentErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NonePaymentErrorZ.java @@ -55,6 +55,7 @@ public class Result_NonePaymentErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java index 712e4179..865b587d 100644 --- a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java @@ -55,6 +55,7 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NoneRetryableSendFailureZ.java b/src/main/java/org/ldk/structs/Result_NoneRetryableSendFailureZ.java new file mode 100644 index 00000000..4022f7b8 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_NoneRetryableSendFailureZ.java @@ -0,0 +1,85 @@ +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_NoneRetryableSendFailureZ extends CommonBase { + private Result_NoneRetryableSendFailureZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NoneRetryableSendFailureZ_free(ptr); } super.finalize(); + } + + static Result_NoneRetryableSendFailureZ constr_from_ptr(long ptr) { + if (bindings.CResult_NoneRetryableSendFailureZ_is_ok(ptr)) { + return new Result_NoneRetryableSendFailureZ_OK(null, ptr); + } else { + return new Result_NoneRetryableSendFailureZ_Err(null, ptr); + } + } + public static final class Result_NoneRetryableSendFailureZ_OK extends Result_NoneRetryableSendFailureZ { + private Result_NoneRetryableSendFailureZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + public static final class Result_NoneRetryableSendFailureZ_Err extends Result_NoneRetryableSendFailureZ { + public final RetryableSendFailure err; + private Result_NoneRetryableSendFailureZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.CResult_NoneRetryableSendFailureZ_get_err(ptr); + } + } + + /** + * Creates a new CResult_NoneRetryableSendFailureZ in the success state. + */ + public static Result_NoneRetryableSendFailureZ ok() { + long ret = bindings.CResult_NoneRetryableSendFailureZ_ok(); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneRetryableSendFailureZ ret_hu_conv = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_NoneRetryableSendFailureZ in the error state. + */ + public static Result_NoneRetryableSendFailureZ err(org.ldk.enums.RetryableSendFailure e) { + long ret = bindings.CResult_NoneRetryableSendFailureZ_err(e); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneRetryableSendFailureZ ret_hu_conv = Result_NoneRetryableSendFailureZ.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_NoneRetryableSendFailureZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_NoneRetryableSendFailureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_NoneRetryableSendFailureZ clone() { + long ret = bindings.CResult_NoneRetryableSendFailureZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneRetryableSendFailureZ ret_hu_conv = Result_NoneRetryableSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_NoneSendErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneSendErrorZ.java index b99691d8..fa693646 100644 --- a/src/main/java/org/ldk/structs/Result_NoneSendErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneSendErrorZ.java @@ -55,6 +55,7 @@ public class Result_NoneSendErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneSendErrorZ ret_hu_conv = Result_NoneSendErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_OfferFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OfferFeaturesDecodeErrorZ.java deleted file mode 100644 index 64f19c90..00000000 --- a/src/main/java/org/ldk/structs/Result_OfferFeaturesDecodeErrorZ.java +++ /dev/null @@ -1,95 +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; - -public class Result_OfferFeaturesDecodeErrorZ extends CommonBase { - private Result_OfferFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_OfferFeaturesDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_OfferFeaturesDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_OfferFeaturesDecodeErrorZ_is_ok(ptr)) { - return new Result_OfferFeaturesDecodeErrorZ_OK(null, ptr); - } else { - return new Result_OfferFeaturesDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_OfferFeaturesDecodeErrorZ_OK extends Result_OfferFeaturesDecodeErrorZ { - public final OfferFeatures res; - private Result_OfferFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_OfferFeaturesDecodeErrorZ_get_ok(ptr); - org.ldk.structs.OfferFeatures res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.OfferFeatures(null, res); } - if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; - this.res = res_hu_conv; - } - } - - public static final class Result_OfferFeaturesDecodeErrorZ_Err extends Result_OfferFeaturesDecodeErrorZ { - public final DecodeError err; - private Result_OfferFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_OfferFeaturesDecodeErrorZ_get_err(ptr); - org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); - if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state. - */ - public static Result_OfferFeaturesDecodeErrorZ ok(org.ldk.structs.OfferFeatures o) { - long ret = bindings.CResult_OfferFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_OfferFeaturesDecodeErrorZ ret_hu_conv = Result_OfferFeaturesDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - return ret_hu_conv; - } - - /** - * Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state. - */ - public static Result_OfferFeaturesDecodeErrorZ err(org.ldk.structs.DecodeError e) { - long ret = bindings.CResult_OfferFeaturesDecodeErrorZ_err(e.ptr); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_OfferFeaturesDecodeErrorZ ret_hu_conv = Result_OfferFeaturesDecodeErrorZ.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_OfferFeaturesDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_OfferFeaturesDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_OfferFeaturesDecodeErrorZ clone() { - long ret = bindings.CResult_OfferFeaturesDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_OfferFeaturesDecodeErrorZ ret_hu_conv = Result_OfferFeaturesDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_OnionMessageDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OnionMessageDecodeErrorZ.java index f4264902..c2279de0 100644 --- a/src/main/java/org/ldk/structs/Result_OnionMessageDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_OnionMessageDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_OnionMessageDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_OnionMessageDecodeErrorZ ret_hu_conv = Result_OnionMessageDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java index b0db16ef..bb32c17f 100644 --- a/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_OpenChannelDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java index 893188ef..23eb904f 100644 --- a/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_OutPointDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java index fa614c63..5861940e 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java @@ -58,6 +58,7 @@ public class Result_PaymentHashPaymentSendFailureZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentHashRetryableSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentHashRetryableSendFailureZ.java new file mode 100644 index 00000000..bf0967fc --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PaymentHashRetryableSendFailureZ.java @@ -0,0 +1,88 @@ +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_PaymentHashRetryableSendFailureZ extends CommonBase { + private Result_PaymentHashRetryableSendFailureZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentHashRetryableSendFailureZ_free(ptr); } super.finalize(); + } + + static Result_PaymentHashRetryableSendFailureZ constr_from_ptr(long ptr) { + if (bindings.CResult_PaymentHashRetryableSendFailureZ_is_ok(ptr)) { + return new Result_PaymentHashRetryableSendFailureZ_OK(null, ptr); + } else { + return new Result_PaymentHashRetryableSendFailureZ_Err(null, ptr); + } + } + public static final class Result_PaymentHashRetryableSendFailureZ_OK extends Result_PaymentHashRetryableSendFailureZ { + public final byte[] res; + private Result_PaymentHashRetryableSendFailureZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.CResult_PaymentHashRetryableSendFailureZ_get_ok(ptr); + } + } + + public static final class Result_PaymentHashRetryableSendFailureZ_Err extends Result_PaymentHashRetryableSendFailureZ { + public final RetryableSendFailure err; + private Result_PaymentHashRetryableSendFailureZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.CResult_PaymentHashRetryableSendFailureZ_get_err(ptr); + } + } + + /** + * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state. + */ + public static Result_PaymentHashRetryableSendFailureZ ok(byte[] o) { + long ret = bindings.CResult_PaymentHashRetryableSendFailureZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentHashRetryableSendFailureZ ret_hu_conv = Result_PaymentHashRetryableSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state. + */ + public static Result_PaymentHashRetryableSendFailureZ err(org.ldk.enums.RetryableSendFailure e) { + long ret = bindings.CResult_PaymentHashRetryableSendFailureZ_err(e); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentHashRetryableSendFailureZ ret_hu_conv = Result_PaymentHashRetryableSendFailureZ.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_PaymentHashRetryableSendFailureZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_PaymentHashRetryableSendFailureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PaymentHashRetryableSendFailureZ clone() { + long ret = bindings.CResult_PaymentHashRetryableSendFailureZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentHashRetryableSendFailureZ ret_hu_conv = Result_PaymentHashRetryableSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java index dcd3da06..c4a75db1 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java @@ -58,6 +58,7 @@ public class Result_PaymentIdPaymentErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentParametersDecodeErrorZ.java index 7b922870..83308530 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentParametersDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_PaymentParametersDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentParametersDecodeErrorZ ret_hu_conv = Result_PaymentParametersDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java index 4307ba65..26186b4a 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java @@ -58,6 +58,7 @@ public class Result_PaymentPreimageAPIErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentPurposeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentPurposeDecodeErrorZ.java index 7f1c2371..1507c258 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentPurposeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentPurposeDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_PaymentPurposeDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentPurposeDecodeErrorZ ret_hu_conv = Result_PaymentPurposeDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_PaymentPurposeDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentPurposeDecodeErrorZ ret_hu_conv = Result_PaymentPurposeDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java index 7d086cf6..d9919679 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java @@ -58,6 +58,7 @@ public class Result_PaymentSecretAPIErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PhantomRouteHintsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PhantomRouteHintsDecodeErrorZ.java index c49411b3..c4c3df71 100644 --- a/src/main/java/org/ldk/structs/Result_PhantomRouteHintsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PhantomRouteHintsDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_PhantomRouteHintsDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java index 3be8daad..bdda2c54 100644 --- a/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_PingDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java index dc5ee0c4..c9c5e096 100644 --- a/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_PongDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java index a7dc1c02..3f13fb8c 100644 --- a/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java @@ -66,6 +66,7 @@ public class Result_ProbabilisticScorerDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ProbabilisticScorerDecodeErrorZ ret_hu_conv = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java index d920183d..2c3b1f8b 100644 --- a/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_QueryChannelRangeDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java index 8b481bd8..2d0ad1ca 100644 --- a/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_QueryShortChannelIdsDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java index 9e00d6e5..54ce2771 100644 --- a/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ReplyChannelRangeDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java index dde7fb81..62cb3e03 100644 --- a/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ReplyShortChannelIdsEndDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java index b98baeb5..0db1a0af 100644 --- a/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java index a69dcf66..604f13f7 100644 --- a/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RouteDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java index f7d5fbb9..c98b7367 100644 --- a/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RouteHintDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintDecodeErrorZ ret_hu_conv = Result_RouteHintDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java index 0774f744..ed89d430 100644 --- a/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RouteHintHopDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java index adde55fd..67b0dcca 100644 --- a/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RouteHopDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java index 6b340b33..460fbc4d 100644 --- a/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RouteParametersDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteParametersDecodeErrorZ ret_hu_conv = Result_RouteParametersDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java index 0f957e65..5e34a8ab 100644 --- a/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_RoutingFeesDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_SecretKeyNoneZ.java b/src/main/java/org/ldk/structs/Result_SecretKeyNoneZ.java deleted file mode 100644 index 7c3cc1fb..00000000 --- a/src/main/java/org/ldk/structs/Result_SecretKeyNoneZ.java +++ /dev/null @@ -1,85 +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; - -public class Result_SecretKeyNoneZ extends CommonBase { - private Result_SecretKeyNoneZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_SecretKeyNoneZ_free(ptr); } super.finalize(); - } - - static Result_SecretKeyNoneZ constr_from_ptr(long ptr) { - if (bindings.CResult_SecretKeyNoneZ_is_ok(ptr)) { - return new Result_SecretKeyNoneZ_OK(null, ptr); - } else { - return new Result_SecretKeyNoneZ_Err(null, ptr); - } - } - public static final class Result_SecretKeyNoneZ_OK extends Result_SecretKeyNoneZ { - public final byte[] res; - private Result_SecretKeyNoneZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - this.res = bindings.CResult_SecretKeyNoneZ_get_ok(ptr); - } - } - - public static final class Result_SecretKeyNoneZ_Err extends Result_SecretKeyNoneZ { - private Result_SecretKeyNoneZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - /** - * Creates a new CResult_SecretKeyNoneZ in the success state. - */ - public static Result_SecretKeyNoneZ ok(byte[] o) { - long ret = bindings.CResult_SecretKeyNoneZ_ok(InternalUtils.check_arr_len(o, 32)); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SecretKeyNoneZ ret_hu_conv = Result_SecretKeyNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_SecretKeyNoneZ in the error state. - */ - public static Result_SecretKeyNoneZ err() { - long ret = bindings.CResult_SecretKeyNoneZ_err(); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SecretKeyNoneZ ret_hu_conv = Result_SecretKeyNoneZ.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_SecretKeyNoneZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_SecretKeyNoneZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_SecretKeyNoneZ clone() { - long ret = bindings.CResult_SecretKeyNoneZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SecretKeyNoneZ ret_hu_conv = Result_SecretKeyNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java index 85cc7140..9772f3c7 100644 --- a/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ShutdownDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java index 72730434..8d366a97 100644 --- a/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_ShutdownScriptDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java b/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java index 0afe372c..a13255b4 100644 --- a/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java @@ -58,6 +58,7 @@ public class Result_SiPrefixParseErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_SiPrefixParseErrorZ ret_hu_conv = Result_SiPrefixParseErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java deleted file mode 100644 index f1f759b1..00000000 --- a/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java +++ /dev/null @@ -1,95 +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; - -public class Result_SignDecodeErrorZ extends CommonBase { - private Result_SignDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_SignDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_SignDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_SignDecodeErrorZ_is_ok(ptr)) { - return new Result_SignDecodeErrorZ_OK(null, ptr); - } else { - return new Result_SignDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_SignDecodeErrorZ_OK extends Result_SignDecodeErrorZ { - public final Sign res; - private Result_SignDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_SignDecodeErrorZ_get_ok(ptr); - Sign ret_hu_conv = new Sign(null, res); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - this.res = ret_hu_conv; - } - } - - public static final class Result_SignDecodeErrorZ_Err extends Result_SignDecodeErrorZ { - public final DecodeError err; - private Result_SignDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_SignDecodeErrorZ_get_err(ptr); - org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); - if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_SignDecodeErrorZ in the success state. - */ - public static Result_SignDecodeErrorZ ok(org.ldk.structs.Sign o) { - long ret = bindings.CResult_SignDecodeErrorZ_ok(o == null ? 0 : o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - return ret_hu_conv; - } - - /** - * Creates a new CResult_SignDecodeErrorZ in the error state. - */ - public static Result_SignDecodeErrorZ err(org.ldk.structs.DecodeError e) { - long ret = bindings.CResult_SignDecodeErrorZ_err(e.ptr); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.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_SignDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_SignDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_SignDecodeErrorZ clone() { - long ret = bindings.CResult_SignDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java index b75d3530..861f42eb 100644 --- a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java @@ -62,6 +62,7 @@ public class Result_SignedRawInvoiceParseErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_SignedRawInvoiceParseErrorZ ret_hu_conv = Result_SignedRawInvoiceParseErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java index 2f9994c0..63db2371 100644 --- a/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java @@ -50,6 +50,7 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; return ret_hu_conv; } @@ -61,6 +62,7 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java index fbb2c0b9..e91d80ee 100644 --- a/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_StaticPaymentOutputDescriptorDecodeErrorZ extends CommonBase Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java index ab701e1a..9c2c18db 100644 --- a/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysDecodeErrorZ ret_hu_conv = Result_TxCreationKeysDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java b/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java deleted file mode 100644 index dacbe8eb..00000000 --- a/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java +++ /dev/null @@ -1,90 +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; - -public class Result_TxOutAccessErrorZ extends CommonBase { - private Result_TxOutAccessErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_TxOutAccessErrorZ_free(ptr); } super.finalize(); - } - - static Result_TxOutAccessErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_TxOutAccessErrorZ_is_ok(ptr)) { - return new Result_TxOutAccessErrorZ_OK(null, ptr); - } else { - return new Result_TxOutAccessErrorZ_Err(null, ptr); - } - } - public static final class Result_TxOutAccessErrorZ_OK extends Result_TxOutAccessErrorZ { - public final TxOut res; - private Result_TxOutAccessErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_TxOutAccessErrorZ_get_ok(ptr); - TxOut res_conv = new TxOut(null, res); - this.res = res_conv; - } - } - - public static final class Result_TxOutAccessErrorZ_Err extends Result_TxOutAccessErrorZ { - public final AccessError err; - private Result_TxOutAccessErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - this.err = bindings.CResult_TxOutAccessErrorZ_get_err(ptr); - } - } - - /** - * Creates a new CResult_TxOutAccessErrorZ in the success state. - */ - public static Result_TxOutAccessErrorZ ok(org.ldk.structs.TxOut o) { - long ret = bindings.CResult_TxOutAccessErrorZ_ok(o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_TxOutAccessErrorZ in the error state. - */ - public static Result_TxOutAccessErrorZ err(org.ldk.enums.AccessError e) { - long ret = bindings.CResult_TxOutAccessErrorZ_err(e); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.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_TxOutAccessErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_TxOutAccessErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_TxOutAccessErrorZ clone() { - long ret = bindings.CResult_TxOutAccessErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_TxOutUtxoLookupErrorZ.java b/src/main/java/org/ldk/structs/Result_TxOutUtxoLookupErrorZ.java new file mode 100644 index 00000000..bf2b49f9 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_TxOutUtxoLookupErrorZ.java @@ -0,0 +1,90 @@ +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_TxOutUtxoLookupErrorZ extends CommonBase { + private Result_TxOutUtxoLookupErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TxOutUtxoLookupErrorZ_free(ptr); } super.finalize(); + } + + static Result_TxOutUtxoLookupErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_TxOutUtxoLookupErrorZ_is_ok(ptr)) { + return new Result_TxOutUtxoLookupErrorZ_OK(null, ptr); + } else { + return new Result_TxOutUtxoLookupErrorZ_Err(null, ptr); + } + } + public static final class Result_TxOutUtxoLookupErrorZ_OK extends Result_TxOutUtxoLookupErrorZ { + public final TxOut res; + private Result_TxOutUtxoLookupErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_TxOutUtxoLookupErrorZ_get_ok(ptr); + TxOut res_conv = new TxOut(null, res); + this.res = res_conv; + } + } + + public static final class Result_TxOutUtxoLookupErrorZ_Err extends Result_TxOutUtxoLookupErrorZ { + public final UtxoLookupError err; + private Result_TxOutUtxoLookupErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.CResult_TxOutUtxoLookupErrorZ_get_err(ptr); + } + } + + /** + * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. + */ + public static Result_TxOutUtxoLookupErrorZ ok(org.ldk.structs.TxOut o) { + long ret = bindings.CResult_TxOutUtxoLookupErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_TxOutUtxoLookupErrorZ ret_hu_conv = Result_TxOutUtxoLookupErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. + */ + public static Result_TxOutUtxoLookupErrorZ err(org.ldk.enums.UtxoLookupError e) { + long ret = bindings.CResult_TxOutUtxoLookupErrorZ_err(e); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_TxOutUtxoLookupErrorZ ret_hu_conv = Result_TxOutUtxoLookupErrorZ.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_TxOutUtxoLookupErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_TxOutUtxoLookupErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_TxOutUtxoLookupErrorZ clone() { + long ret = bindings.CResult_TxOutUtxoLookupErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_TxOutUtxoLookupErrorZ ret_hu_conv = Result_TxOutUtxoLookupErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java index c6f832ed..d8f29a70 100644 --- a/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UnsignedChannelAnnouncementDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java index 800df2b0..1bfcff67 100644 --- a/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UnsignedChannelUpdateDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java index 6e941786..d87fde9b 100644 --- a/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UnsignedNodeAnnouncementDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java index d6d77f72..3f56fa50 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java index ac87ccca..c3b12b97 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java index c5ef4ba9..424b2514 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailMalformedHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java index cd8c35a2..da32f084 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UpdateFeeDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java index 09f4bfd9..7879891d 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_WarningMessageDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_WarningMessageDecodeErrorZ.java index 758a829a..d04f910a 100644 --- a/src/main/java/org/ldk/structs/Result_WarningMessageDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_WarningMessageDecodeErrorZ.java @@ -62,6 +62,7 @@ public class Result_WarningMessageDecodeErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.java new file mode 100644 index 00000000..b3c4f4aa --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.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; + +public class Result_WriteableEcdsaChannelSignerDecodeErrorZ extends CommonBase { + private Result_WriteableEcdsaChannelSignerDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_WriteableEcdsaChannelSignerDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(ptr)) { + return new Result_WriteableEcdsaChannelSignerDecodeErrorZ_OK(null, ptr); + } else { + return new Result_WriteableEcdsaChannelSignerDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_WriteableEcdsaChannelSignerDecodeErrorZ_OK extends Result_WriteableEcdsaChannelSignerDecodeErrorZ { + public final WriteableEcdsaChannelSigner res; + private Result_WriteableEcdsaChannelSignerDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(ptr); + WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, res); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + this.res = ret_hu_conv; + } + } + + public static final class Result_WriteableEcdsaChannelSignerDecodeErrorZ_Err extends Result_WriteableEcdsaChannelSignerDecodeErrorZ { + public final DecodeError err; + private Result_WriteableEcdsaChannelSignerDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. + */ + public static Result_WriteableEcdsaChannelSignerDecodeErrorZ ok(org.ldk.structs.WriteableEcdsaChannelSigner o) { + long ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WriteableEcdsaChannelSignerDecodeErrorZ ret_hu_conv = Result_WriteableEcdsaChannelSignerDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state. + */ + public static Result_WriteableEcdsaChannelSignerDecodeErrorZ err(org.ldk.structs.DecodeError e) { + long ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WriteableEcdsaChannelSignerDecodeErrorZ ret_hu_conv = Result_WriteableEcdsaChannelSignerDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_WriteableEcdsaChannelSignerDecodeErrorZ clone() { + long ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WriteableEcdsaChannelSignerDecodeErrorZ ret_hu_conv = Result_WriteableEcdsaChannelSignerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java index 8064b2ee..0ea89ece 100644 --- a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java @@ -58,6 +58,7 @@ public class Result__u832APIErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_u32GraphSyncErrorZ.java b/src/main/java/org/ldk/structs/Result_u32GraphSyncErrorZ.java index 52368a49..07d5b5d5 100644 --- a/src/main/java/org/ldk/structs/Result_u32GraphSyncErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_u32GraphSyncErrorZ.java @@ -58,6 +58,7 @@ public class Result_u32GraphSyncErrorZ extends CommonBase { Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_u32GraphSyncErrorZ ret_hu_conv = Result_u32GraphSyncErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Retry.java b/src/main/java/org/ldk/structs/Retry.java index 18988df0..166f11e6 100644 --- a/src/main/java/org/ldk/structs/Retry.java +++ b/src/main/java/org/ldk/structs/Retry.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * Strategies available to retry payment path failures for an [`Invoice`]. + * Strategies available to retry payment path failures. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Retry extends CommonBase { @@ -33,9 +33,9 @@ public class Retry extends CommonBase { /** * Max number of attempts to retry payment. * - * Note that this is the number of *path* failures, not full payment retries. For multi-path - * payments, if this is less than the total number of paths, we will never even retry all of the - * payment's paths. + * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a + * retry, and may retry multiple failed HTLCs at once if they failed around the same time and + * were retried along a route from a single call to [`Router::find_route_with_id`]. */ public final static class Attempts extends Retry { public final long attempts; @@ -45,7 +45,10 @@ public class Retry extends CommonBase { } } /** - * Time elapsed before abandoning retries for a payment. + * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; + * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time */ public final static class Timeout extends Retry { public final long timeout; diff --git a/src/main/java/org/ldk/structs/RevokeAndACK.java b/src/main/java/org/ldk/structs/RevokeAndACK.java index 6e42eaa9..8a4bc471 100644 --- a/src/main/java/org/ldk/structs/RevokeAndACK.java +++ b/src/main/java/org/ldk/structs/RevokeAndACK.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A revoke_and_ack message to be sent or received from a peer + * A [`revoke_and_ack`] message to be sent to or received from a peer. + * + * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class RevokeAndACK extends CommonBase { diff --git a/src/main/java/org/ldk/structs/RouteHintHop.java b/src/main/java/org/ldk/structs/RouteHintHop.java index 857af539..5d49c9c2 100644 --- a/src/main/java/org/ldk/structs/RouteHintHop.java +++ b/src/main/java/org/ldk/structs/RouteHintHop.java @@ -115,6 +115,7 @@ public class RouteHintHop extends CommonBase { bindings.RouteHintHop_set_htlc_minimum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -136,6 +137,7 @@ public class RouteHintHop extends CommonBase { bindings.RouteHintHop_set_htlc_maximum_msat(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -153,6 +155,8 @@ public class RouteHintHop extends CommonBase { org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fees_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(htlc_minimum_msat_arg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(htlc_maximum_msat_arg); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/RouteParameters.java b/src/main/java/org/ldk/structs/RouteParameters.java index 0d4ac699..62ea5473 100644 --- a/src/main/java/org/ldk/structs/RouteParameters.java +++ b/src/main/java/org/ldk/structs/RouteParameters.java @@ -12,7 +12,7 @@ import javax.annotation.Nullable; * Parameters needed to find a [`Route`]. * * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in - * [`Event::PaymentPathFailed`] for retrying a failed payment path. + * [`Event::PaymentPathFailed`]. * * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed */ @@ -65,32 +65,13 @@ public class RouteParameters extends CommonBase { Reference.reachabilityFence(val); } - /** - * The CLTV on the final hop of the failed payment path. - */ - public int get_final_cltv_expiry_delta() { - int ret = bindings.RouteParameters_get_final_cltv_expiry_delta(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * The CLTV on the final hop of the failed payment path. - */ - public void set_final_cltv_expiry_delta(int val) { - bindings.RouteParameters_set_final_cltv_expiry_delta(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - /** * Constructs a new RouteParameters given each field */ - public static RouteParameters of(org.ldk.structs.PaymentParameters payment_params_arg, long final_value_msat_arg, int final_cltv_expiry_delta_arg) { - long ret = bindings.RouteParameters_new(payment_params_arg == null ? 0 : payment_params_arg.ptr, final_value_msat_arg, final_cltv_expiry_delta_arg); + public static RouteParameters of(org.ldk.structs.PaymentParameters payment_params_arg, long final_value_msat_arg) { + long ret = bindings.RouteParameters_new(payment_params_arg == null ? 0 : payment_params_arg.ptr, final_value_msat_arg); Reference.reachabilityFence(payment_params_arg); Reference.reachabilityFence(final_value_msat_arg); - Reference.reachabilityFence(final_cltv_expiry_delta_arg); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteParameters(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; @@ -116,6 +97,23 @@ public class RouteParameters extends CommonBase { return ret_hu_conv; } + /** + * Checks if two RouteParameterss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(org.ldk.structs.RouteParameters b) { + boolean ret = bindings.RouteParameters_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + if (this != null) { this.ptrs_to.add(b); }; + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof RouteParameters)) return false; + return this.eq((RouteParameters)o); + } /** * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ diff --git a/src/main/java/org/ldk/structs/Router.java b/src/main/java/org/ldk/structs/Router.java index 8770a3b3..67727768 100644 --- a/src/main/java/org/ldk/structs/Router.java +++ b/src/main/java/org/ldk/structs/Router.java @@ -23,7 +23,19 @@ public class Router extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Router_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Router_free(ptr); } + ptr = 0; + } public static interface RouterInterface { /** * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. @@ -38,22 +50,6 @@ public class Router extends CommonBase { * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ Result_RouteLightningErrorZ find_route_with_id(byte[] payer, RouteParameters route_params, ChannelDetails[] first_hops, InFlightHtlcs inflight_htlcs, byte[] _payment_hash, byte[] _payment_id); - /** - * Lets the router know that payment through a specific path has failed. - */ - void notify_payment_path_failed(RouteHop[] path, long short_channel_id); - /** - * Lets the router know that payment through a specific path was successful. - */ - void notify_payment_path_successful(RouteHop[] path); - /** - * Lets the router know that a payment probe was successful. - */ - void notify_payment_probe_successful(RouteHop[] path); - /** - * Lets the router know that a payment probe failed. - */ - void notify_payment_probe_failed(RouteHop[] path, long short_channel_id); } private static class LDKRouterHolder { Router held; } public static Router new_impl(RouterInterface arg) { @@ -72,7 +68,6 @@ public class Router extends CommonBase { } } org.ldk.structs.InFlightHtlcs inflight_htlcs_hu_conv = null; if (inflight_htlcs < 0 || inflight_htlcs > 4096) { inflight_htlcs_hu_conv = new org.ldk.structs.InFlightHtlcs(null, inflight_htlcs); } - if (inflight_htlcs_hu_conv != null) { inflight_htlcs_hu_conv.ptrs_to.add(this); }; Result_RouteLightningErrorZ ret = arg.find_route(payer, route_params_hu_conv, first_hops_conv_16_arr, inflight_htlcs_hu_conv); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); @@ -91,60 +86,11 @@ public class Router extends CommonBase { } } org.ldk.structs.InFlightHtlcs inflight_htlcs_hu_conv = null; if (inflight_htlcs < 0 || inflight_htlcs > 4096) { inflight_htlcs_hu_conv = new org.ldk.structs.InFlightHtlcs(null, inflight_htlcs); } - if (inflight_htlcs_hu_conv != null) { inflight_htlcs_hu_conv.ptrs_to.add(this); }; Result_RouteLightningErrorZ ret = arg.find_route_with_id(payer, route_params_hu_conv, first_hops_conv_16_arr, inflight_htlcs_hu_conv, _payment_hash, _payment_id); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } - @Override public void notify_payment_path_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); } - if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); }; - path_conv_10_arr[k] = path_conv_10_hu_conv; - } - arg.notify_payment_path_failed(path_conv_10_arr, short_channel_id); - Reference.reachabilityFence(arg); - } - @Override public void notify_payment_path_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); } - if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); }; - path_conv_10_arr[k] = path_conv_10_hu_conv; - } - arg.notify_payment_path_successful(path_conv_10_arr); - Reference.reachabilityFence(arg); - } - @Override public void notify_payment_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); } - if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); }; - path_conv_10_arr[k] = path_conv_10_hu_conv; - } - arg.notify_payment_probe_successful(path_conv_10_arr); - Reference.reachabilityFence(arg); - } - @Override public void notify_payment_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); } - if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.add(this); }; - path_conv_10_arr[k] = path_conv_10_hu_conv; - } - arg.notify_payment_probe_failed(path_conv_10_arr, short_channel_id); - Reference.reachabilityFence(arg); - } }); return impl_holder.held; } @@ -191,46 +137,4 @@ public class Router extends CommonBase { return ret_hu_conv; } - /** - * Lets the router know that payment through a specific path has failed. - */ - public void notify_payment_path_failed(RouteHop[] path, long short_channel_id) { - bindings.Router_notify_payment_path_failed(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id); - Reference.reachabilityFence(this); - Reference.reachabilityFence(path); - Reference.reachabilityFence(short_channel_id); - for (RouteHop path_conv_10: path) { if (this != null) { this.ptrs_to.add(path_conv_10); }; }; - } - - /** - * Lets the router know that payment through a specific path was successful. - */ - public void notify_payment_path_successful(RouteHop[] path) { - bindings.Router_notify_payment_path_successful(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null); - Reference.reachabilityFence(this); - Reference.reachabilityFence(path); - for (RouteHop path_conv_10: path) { if (this != null) { this.ptrs_to.add(path_conv_10); }; }; - } - - /** - * Lets the router know that a payment probe was successful. - */ - public void notify_payment_probe_successful(RouteHop[] path) { - bindings.Router_notify_payment_probe_successful(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null); - Reference.reachabilityFence(this); - Reference.reachabilityFence(path); - for (RouteHop path_conv_10: path) { if (this != null) { this.ptrs_to.add(path_conv_10); }; }; - } - - /** - * Lets the router know that a payment probe failed. - */ - public void notify_payment_probe_failed(RouteHop[] path, long short_channel_id) { - bindings.Router_notify_payment_probe_failed(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr).toArray() : null, short_channel_id); - Reference.reachabilityFence(this); - Reference.reachabilityFence(path); - Reference.reachabilityFence(short_channel_id); - for (RouteHop path_conv_10: path) { if (this != null) { this.ptrs_to.add(path_conv_10); }; }; - } - } diff --git a/src/main/java/org/ldk/structs/RoutingFees.java b/src/main/java/org/ldk/structs/RoutingFees.java index 8cbc480e..6615c3b8 100644 --- a/src/main/java/org/ldk/structs/RoutingFees.java +++ b/src/main/java/org/ldk/structs/RoutingFees.java @@ -21,7 +21,7 @@ public class RoutingFees extends CommonBase { } /** - * Flat routing fee in satoshis + * Flat routing fee in millisatoshis. */ public int get_base_msat() { int ret = bindings.RoutingFees_get_base_msat(this.ptr); @@ -30,7 +30,7 @@ public class RoutingFees extends CommonBase { } /** - * Flat routing fee in satoshis + * Flat routing fee in millisatoshis. */ public void set_base_msat(int val) { bindings.RoutingFees_set_base_msat(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index 094779c6..64988f24 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -12,8 +12,8 @@ import javax.annotation.Nullable; * * # Implementor DoS Warnings * - * For `gossip_queries` messages there are potential DoS vectors when handling - * inbound queries. Implementors using an on-disk network graph should be aware of + * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when + * handling inbound queries. Implementors using an on-disk network graph should be aware of * repeated disk I/O for queries accessing different parts of the network graph. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays @@ -30,39 +30,51 @@ public class RoutingMessageHandler extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.RoutingMessageHandler_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.RoutingMessageHandler_free(ptr); } + ptr = 0; + } public static interface RoutingMessageHandlerInterface { /** - * Handle an incoming node_announcement message, returning true if it should be forwarded on, - * false or returning an Err otherwise. + * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, + * `false` or returning an `Err` otherwise. */ Result_boolLightningErrorZ handle_node_announcement(NodeAnnouncement msg); /** - * Handle a channel_announcement message, returning true if it should be forwarded on, false - * or returning an Err otherwise. + * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` + * or returning an `Err` otherwise. */ Result_boolLightningErrorZ handle_channel_announcement(ChannelAnnouncement msg); /** - * Handle an incoming channel_update message, returning true if it should be forwarded on, - * false or returning an Err otherwise. + * Handle an incoming `channel_update` message, returning true if it should be forwarded on, + * `false` or returning an `Err` otherwise. */ Result_boolLightningErrorZ handle_channel_update(ChannelUpdate msg); /** * Gets channel announcements and updates required to dump our routing table to a remote node, - * starting at the short_channel_id indicated by starting_point and including announcements + * starting at the `short_channel_id` indicated by `starting_point` and including announcements * for a single channel. */ Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement(long starting_point); /** * Gets a node announcement required to dump our routing table to a remote node, starting at * the node *after* the provided pubkey and including up to one announcement immediately - * higher (as defined by ::cmp) than starting_point. - * If None is provided for starting_point, we start at the first node. + * higher (as defined by `::cmp`) than `starting_point`. + * If `None` is provided for `starting_point`, we start at the first node. * * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - NodeAnnouncement get_next_node_announcement(byte[] starting_point); + NodeAnnouncement get_next_node_announcement(NodeId starting_point); /** * Called when a connection is established with a peer. This can be used to * perform routing table synchronization using a strategy defined by the @@ -72,7 +84,7 @@ public class RoutingMessageHandler extends CommonBase { * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - Result_NoneNoneZ peer_connected(byte[] their_node_id, Init init); + Result_NoneNoneZ peer_connected(byte[] their_node_id, Init init, boolean inbound); /** * Handles the reply of a query we initiated to learn about channels * for a given range of blocks. We can expect to receive one or more @@ -87,15 +99,22 @@ public class RoutingMessageHandler extends CommonBase { */ Result_NoneLightningErrorZ handle_reply_short_channel_ids_end(byte[] their_node_id, ReplyShortChannelIdsEnd msg); /** - * Handles when a peer asks us to send a list of short_channel_ids + * Handles when a peer asks us to send a list of `short_channel_id`s * for the requested range of blocks. */ Result_NoneLightningErrorZ handle_query_channel_range(byte[] their_node_id, QueryChannelRange msg); /** * Handles when a peer asks us to send routing gossip messages for a - * list of short_channel_ids. + * list of `short_channel_id`s. */ Result_NoneLightningErrorZ handle_query_short_channel_ids(byte[] their_node_id, QueryShortChannelIds msg); + /** + * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages + * pending some async action. While there is no guarantee of the rate of future messages, the + * caller should seek to reduce the rate of new gossip messages handled, especially + * [`ChannelAnnouncement`]s. + */ + boolean processing_queue_high(); /** * Gets the node feature flags which this handler itself supports. All available handlers are * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] @@ -140,17 +159,20 @@ public class RoutingMessageHandler extends CommonBase { Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = arg.get_next_channel_announcement(starting_point); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); + if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; return result; } - @Override public long get_next_node_announcement(byte[] starting_point) { - NodeAnnouncement ret = arg.get_next_node_announcement(starting_point); + @Override public long get_next_node_announcement(long starting_point) { + org.ldk.structs.NodeId starting_point_hu_conv = null; if (starting_point < 0 || starting_point > 4096) { starting_point_hu_conv = new org.ldk.structs.NodeId(null, starting_point); } + if (starting_point_hu_conv != null) { starting_point_hu_conv.ptrs_to.add(this); }; + NodeAnnouncement ret = arg.get_next_node_announcement(starting_point_hu_conv); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } - @Override public long peer_connected(byte[] their_node_id, long init) { + @Override public long peer_connected(byte[] their_node_id, long init, boolean inbound) { org.ldk.structs.Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new org.ldk.structs.Init(null, init); } - Result_NoneNoneZ ret = arg.peer_connected(their_node_id, init_hu_conv); + Result_NoneNoneZ ret = arg.peer_connected(their_node_id, init_hu_conv, inbound); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; @@ -187,6 +209,11 @@ public class RoutingMessageHandler extends CommonBase { long result = ret == null ? 0 : ret.clone_ptr(); return result; } + @Override public boolean processing_queue_high() { + boolean ret = arg.processing_queue_high(); + Reference.reachabilityFence(arg); + return ret; + } @Override public long provided_node_features() { NodeFeatures ret = arg.provided_node_features(); Reference.reachabilityFence(arg); @@ -208,13 +235,13 @@ public class RoutingMessageHandler extends CommonBase { */ public MessageSendEventsProvider get_message_send_events_provider() { MessageSendEventsProvider res = new MessageSendEventsProvider(null, bindings.LDKRoutingMessageHandler_get_MessageSendEventsProvider(this.ptr)); - this.ptrs_to.add(res); + res.ptrs_to.add(this); return res; } /** - * Handle an incoming node_announcement message, returning true if it should be forwarded on, - * false or returning an Err otherwise. + * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, + * `false` or returning an `Err` otherwise. */ public Result_boolLightningErrorZ handle_node_announcement(org.ldk.structs.NodeAnnouncement msg) { long ret = bindings.RoutingMessageHandler_handle_node_announcement(this.ptr, msg == null ? 0 : msg.ptr); @@ -227,8 +254,8 @@ public class RoutingMessageHandler extends CommonBase { } /** - * Handle a channel_announcement message, returning true if it should be forwarded on, false - * or returning an Err otherwise. + * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` + * or returning an `Err` otherwise. */ public Result_boolLightningErrorZ handle_channel_announcement(org.ldk.structs.ChannelAnnouncement msg) { long ret = bindings.RoutingMessageHandler_handle_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr); @@ -241,8 +268,8 @@ public class RoutingMessageHandler extends CommonBase { } /** - * Handle an incoming channel_update message, returning true if it should be forwarded on, - * false or returning an Err otherwise. + * Handle an incoming `channel_update` message, returning true if it should be forwarded on, + * `false` or returning an `Err` otherwise. */ public Result_boolLightningErrorZ handle_channel_update(org.ldk.structs.ChannelUpdate msg) { long ret = bindings.RoutingMessageHandler_handle_channel_update(this.ptr, msg == null ? 0 : msg.ptr); @@ -256,7 +283,7 @@ public class RoutingMessageHandler extends CommonBase { /** * Gets channel announcements and updates required to dump our routing table to a remote node, - * starting at the short_channel_id indicated by starting_point and including announcements + * starting at the `short_channel_id` indicated by `starting_point` and including announcements * for a single channel. */ public Option_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement(long starting_point) { @@ -272,20 +299,21 @@ public class RoutingMessageHandler extends CommonBase { /** * Gets a node announcement required to dump our routing table to a remote node, starting at * the node *after* the provided pubkey and including up to one announcement immediately - * higher (as defined by ::cmp) than starting_point. - * If None is provided for starting_point, we start at the first node. + * higher (as defined by `::cmp`) than `starting_point`. + * If `None` is provided for `starting_point`, we start at the first node. * * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public NodeAnnouncement get_next_node_announcement(@Nullable byte[] starting_point) { - long ret = bindings.RoutingMessageHandler_get_next_node_announcement(this.ptr, InternalUtils.check_arr_len(starting_point, 33)); + public NodeAnnouncement get_next_node_announcement(@Nullable org.ldk.structs.NodeId starting_point) { + long ret = bindings.RoutingMessageHandler_get_next_node_announcement(this.ptr, starting_point == null ? 0 : starting_point.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(starting_point); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + if (this != null) { this.ptrs_to.add(starting_point); }; return ret_hu_conv; } @@ -298,11 +326,12 @@ public class RoutingMessageHandler extends CommonBase { * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init init) { - long ret = bindings.RoutingMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr); + public Result_NoneNoneZ peer_connected(byte[] their_node_id, org.ldk.structs.Init init, boolean inbound) { + long ret = bindings.RoutingMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr, inbound); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); Reference.reachabilityFence(init); + Reference.reachabilityFence(inbound); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(init); }; @@ -343,7 +372,7 @@ public class RoutingMessageHandler extends CommonBase { } /** - * Handles when a peer asks us to send a list of short_channel_ids + * Handles when a peer asks us to send a list of `short_channel_id`s * for the requested range of blocks. */ public Result_NoneLightningErrorZ handle_query_channel_range(byte[] their_node_id, org.ldk.structs.QueryChannelRange msg) { @@ -359,7 +388,7 @@ public class RoutingMessageHandler extends CommonBase { /** * Handles when a peer asks us to send routing gossip messages for a - * list of short_channel_ids. + * list of `short_channel_id`s. */ public Result_NoneLightningErrorZ handle_query_short_channel_ids(byte[] their_node_id, org.ldk.structs.QueryShortChannelIds msg) { long ret = bindings.RoutingMessageHandler_handle_query_short_channel_ids(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr); @@ -372,6 +401,18 @@ public class RoutingMessageHandler extends CommonBase { return ret_hu_conv; } + /** + * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages + * pending some async action. While there is no guarantee of the rate of future messages, the + * caller should seek to reduce the rate of new gossip messages handled, especially + * [`ChannelAnnouncement`]s. + */ + public boolean processing_queue_high() { + boolean ret = bindings.RoutingMessageHandler_processing_queue_high(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Gets the node feature flags which this handler itself supports. All available handlers are * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] diff --git a/src/main/java/org/ldk/structs/Score.java b/src/main/java/org/ldk/structs/Score.java index c51a88b2..92a32b16 100644 --- a/src/main/java/org/ldk/structs/Score.java +++ b/src/main/java/org/ldk/structs/Score.java @@ -25,7 +25,19 @@ public class Score extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Score_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Score_free(ptr); } + ptr = 0; + } public static interface ScoreInterface { /** * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the diff --git a/src/main/java/org/ldk/structs/SendError.java b/src/main/java/org/ldk/structs/SendError.java index 7f8e7585..543ba0dc 100644 --- a/src/main/java/org/ldk/structs/SendError.java +++ b/src/main/java/org/ldk/structs/SendError.java @@ -103,9 +103,9 @@ public class SendError extends CommonBase { } } /** - * Failed to retrieve our node id from the provided [`KeysInterface`]. + * Failed to retrieve our node id from the provided [`NodeSigner`]. * - * [`KeysInterface`]: crate::chain::keysinterface::KeysInterface + * [`NodeSigner`]: crate::chain::keysinterface::NodeSigner */ public final static class GetNodeIdFailed extends SendError { private GetNodeIdFailed(long ptr, bindings.LDKSendError.GetNodeIdFailed obj) { @@ -115,7 +115,7 @@ public class SendError extends CommonBase { /** * We attempted to send to a blinded path where we are the introduction node, and failed to * advance the blinded path to make the second hop the new introduction node. Either - * [`KeysInterface::ecdh`] failed, we failed to tweak the current blinding point to get the + * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the * new blinding point, or we were attempting to send to ourselves. */ public final static class BlindedPathAdvanceFailed extends SendError { diff --git a/src/main/java/org/ldk/structs/Shutdown.java b/src/main/java/org/ldk/structs/Shutdown.java index e814ce54..3966d798 100644 --- a/src/main/java/org/ldk/structs/Shutdown.java +++ b/src/main/java/org/ldk/structs/Shutdown.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A shutdown message to be sent or received from a peer + * A [`shutdown`] message to be sent to or received from a peer. + * + * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Shutdown extends CommonBase { @@ -40,7 +42,8 @@ public class Shutdown extends CommonBase { /** * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ public byte[] get_scriptpubkey() { byte[] ret = bindings.Shutdown_get_scriptpubkey(this.ptr); @@ -50,7 +53,8 @@ public class Shutdown extends CommonBase { /** * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ public void set_scriptpubkey(byte[] val) { bindings.Shutdown_set_scriptpubkey(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/Sign.java b/src/main/java/org/ldk/structs/Sign.java deleted file mode 100644 index b68379f9..00000000 --- a/src/main/java/org/ldk/structs/Sign.java +++ /dev/null @@ -1,89 +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 writeable signer. - * - * There will always be two instances of a signer per channel, one occupied by the - * [`ChannelManager`] and another by the channel's [`ChannelMonitor`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Sign extends CommonBase { - final bindings.LDKSign bindings_instance; - Sign(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private Sign(bindings.LDKSign arg, bindings.LDKBaseSign BaseSign, ChannelPublicKeys pubkeys) { - super(bindings.LDKSign_new(arg, BaseSign, pubkeys == null ? 0 : pubkeys.clone_ptr())); - this.ptrs_to.add(arg); - this.ptrs_to.add(BaseSign); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.Sign_free(ptr); } super.finalize(); - } - - public static interface SignInterface { - /** - * Serialize the object into a byte array - */ - byte[] write(); - } - private static class LDKSignHolder { Sign held; } - public static Sign new_impl(SignInterface arg, BaseSign.BaseSignInterface BaseSign_impl, ChannelPublicKeys pubkeys) { - final LDKSignHolder impl_holder = new LDKSignHolder(); - impl_holder.held = new Sign(new bindings.LDKSign() { - @Override public byte[] write() { - byte[] ret = arg.write(); - Reference.reachabilityFence(arg); - return ret; - } - }, BaseSign.new_impl(BaseSign_impl, pubkeys).bindings_instance, pubkeys); - return impl_holder.held; - } - - /** - * Gets the underlying BaseSign. - */ - public BaseSign get_base_sign() { - BaseSign res = new BaseSign(null, bindings.LDKSign_get_BaseSign(this.ptr)); - this.ptrs_to.add(res); - return res; - } - - /** - * Serialize the object into a byte array - */ - public byte[] write() { - byte[] ret = bindings.Sign_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.Sign_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a copy of a Sign - */ - public Sign clone() { - long ret = bindings.Sign_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Sign ret_hu_conv = new Sign(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/SignerProvider.java b/src/main/java/org/ldk/structs/SignerProvider.java new file mode 100644 index 00000000..86a5cb7f --- /dev/null +++ b/src/main/java/org/ldk/structs/SignerProvider.java @@ -0,0 +1,214 @@ +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 trait that can return signer instances for individual channels. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class SignerProvider extends CommonBase { + final bindings.LDKSignerProvider bindings_instance; + SignerProvider(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private SignerProvider(bindings.LDKSignerProvider arg) { + super(bindings.LDKSignerProvider_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.SignerProvider_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.SignerProvider_free(ptr); } + ptr = 0; + } + public static interface SignerProviderInterface { + /** + * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through + * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow + * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated + * `channel_keys_id`. + * + * This method must return a different value each time it is called. + */ + byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, UInt128 user_channel_id); + /** + * Derives the private key material backing a `Signer`. + * + * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * re-derived from its `channel_keys_id`, which can be obtained through its trait method + * [`ChannelSigner::channel_keys_id`]. + */ + WriteableEcdsaChannelSigner derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id); + /** + * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. + * This is only called during deserialization of other objects which contain + * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. + * + * This method is slowly being phased out -- it will only be called when reading objects + * written by LDK versions prior to 0.0.113. + * + * [`Signer`]: Self::Signer + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + Result_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer(byte[] reader); + /** + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + byte[] get_destination_script(); + /** + * Get a script pubkey which we will send funds to when closing a channel. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + ShutdownScript get_shutdown_scriptpubkey(); + } + private static class LDKSignerProviderHolder { SignerProvider held; } + public static SignerProvider new_impl(SignerProviderInterface arg) { + final LDKSignerProviderHolder impl_holder = new LDKSignerProviderHolder(); + impl_holder.held = new SignerProvider(new bindings.LDKSignerProvider() { + @Override public byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, byte[] user_channel_id) { + org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id); + byte[] ret = arg.generate_channel_keys_id(inbound, channel_value_satoshis, user_channel_id_conv); + Reference.reachabilityFence(arg); + byte[] result = InternalUtils.check_arr_len(ret, 32); + return result; + } + @Override public long derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id) { + WriteableEcdsaChannelSigner ret = arg.derive_channel_signer(channel_value_satoshis, channel_keys_id); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; + return result; + } + @Override public long read_chan_signer(byte[] reader) { + Result_WriteableEcdsaChannelSignerDecodeErrorZ ret = arg.read_chan_signer(reader); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public byte[] get_destination_script() { + byte[] ret = arg.get_destination_script(); + Reference.reachabilityFence(arg); + return ret; + } + @Override public long get_shutdown_scriptpubkey() { + ShutdownScript ret = arg.get_shutdown_scriptpubkey(); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + }); + return impl_holder.held; + } + /** + * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through + * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow + * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated + * `channel_keys_id`. + * + * This method must return a different value each time it is called. + */ + public byte[] generate_channel_keys_id(boolean inbound, long channel_value_satoshis, org.ldk.util.UInt128 user_channel_id) { + byte[] ret = bindings.SignerProvider_generate_channel_keys_id(this.ptr, inbound, channel_value_satoshis, user_channel_id.getLEBytes()); + Reference.reachabilityFence(this); + Reference.reachabilityFence(inbound); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(user_channel_id); + return ret; + } + + /** + * Derives the private key material backing a `Signer`. + * + * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * re-derived from its `channel_keys_id`, which can be obtained through its trait method + * [`ChannelSigner::channel_keys_id`]. + */ + public WriteableEcdsaChannelSigner derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id) { + long ret = bindings.SignerProvider_derive_channel_signer(this.ptr, channel_value_satoshis, InternalUtils.check_arr_len(channel_keys_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(channel_keys_id); + if (ret >= 0 && ret <= 4096) { return null; } + WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. + * This is only called during deserialization of other objects which contain + * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. + * + * This method is slowly being phased out -- it will only be called when reading objects + * written by LDK versions prior to 0.0.113. + * + * [`Signer`]: Self::Signer + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + public Result_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer(byte[] reader) { + long ret = bindings.SignerProvider_read_chan_signer(this.ptr, reader); + Reference.reachabilityFence(this); + Reference.reachabilityFence(reader); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WriteableEcdsaChannelSignerDecodeErrorZ ret_hu_conv = Result_WriteableEcdsaChannelSignerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + public byte[] get_destination_script() { + byte[] ret = bindings.SignerProvider_get_destination_script(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Get a script pubkey which we will send funds to when closing a channel. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + public ShutdownScript get_shutdown_scriptpubkey() { + long ret = bindings.SignerProvider_get_shutdown_scriptpubkey(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ShutdownScript(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/SocketDescriptor.java b/src/main/java/org/ldk/structs/SocketDescriptor.java index 0c76a245..de4ccb0a 100644 --- a/src/main/java/org/ldk/structs/SocketDescriptor.java +++ b/src/main/java/org/ldk/structs/SocketDescriptor.java @@ -34,7 +34,19 @@ public class SocketDescriptor extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.SocketDescriptor_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.SocketDescriptor_free(ptr); } + ptr = 0; + } public static interface SocketDescriptorInterface { /** * Attempts to send some data from the given slice to the peer. diff --git a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java index 460a9b98..15b6fbb7 100644 --- a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java @@ -42,14 +42,14 @@ public class SpendableOutputDescriptor extends CommonBase { } /** - * An output to a script which was provided via [`KeysInterface`] directly, either from + * An output to a script which was provided via [`SignerProvider`] directly, either from * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already * know how to spend it. No secret keys are provided as LDK was never given any key. * These may include outputs from a transaction punishing our counterparty or claiming an HTLC * on-chain using the payment preimage or after it has timed out. * - * [`get_shutdown_scriptpubkey`]: KeysInterface::get_shutdown_scriptpubkey - * [`get_destination_script`]: KeysInterface::get_shutdown_scriptpubkey + * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey + * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey */ public final static class StaticOutput extends SpendableOutputDescriptor { /** @@ -93,15 +93,15 @@ public class SpendableOutputDescriptor extends CommonBase { * * To derive the delayed payment key which is used to sign this input, you must pass the * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the - * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`BaseSign::pubkeys`]) and the provided + * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be * generated without the secret key using [`chan_utils::derive_public_key`] and only the - * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`BaseSign::pubkeys`]. + * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`]. * * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is * used in the witness script generation), you must pass the counterparty * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to - * [`BaseSign::provide_channel_parameters`]) and the provided + * [`ChannelSigner::provide_channel_parameters`]) and the provided * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to * [`chan_utils::derive_public_revocation_key`]. * @@ -123,7 +123,7 @@ public class SpendableOutputDescriptor extends CommonBase { } /** * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key - * which corresponds to the `payment_point` in [`BaseSign::pubkeys`]). The witness + * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness * in the spending input is, thus, simply: * ```bitcoin * diff --git a/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java b/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java index b9ae73b8..06842bbc 100644 --- a/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java @@ -67,7 +67,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { } /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. * This may be useful in re-deriving keys used in the channel to spend the output. */ public byte[] get_channel_keys_id() { @@ -77,7 +77,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { } /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. * This may be useful in re-deriving keys used in the channel to spend the output. */ public void set_channel_keys_id(byte[] val) { diff --git a/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java b/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java index d7df71fe..0b7ac8c0 100644 --- a/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java +++ b/src/main/java/org/ldk/structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.java @@ -89,6 +89,7 @@ public class ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ extends CommonBase ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ ret_hu_conv = new ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + for (MonitorEvent b_conv_14: b) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_conv_14); }; }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java index 1caafd1b..778492d1 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java @@ -44,14 +44,17 @@ public class TwoTuple_BlockHashChannelManagerZ extends CommonBase { /** * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ - public static TwoTuple_BlockHashChannelManagerZ of(byte[] a, FeeEstimator b_fee_est, Watch b_chain_monitor, BroadcasterInterface b_tx_broadcaster, Logger b_logger, KeysInterface b_keys_manager, UserConfig b_config, ChainParameters b_params) { - long ret = bindings.C2Tuple_BlockHashChannelManagerZ_new(InternalUtils.check_arr_len(a, 32), bindings.ChannelManager_new(b_fee_est == null ? 0 : b_fee_est.ptr, b_chain_monitor == null ? 0 : b_chain_monitor.ptr, b_tx_broadcaster == null ? 0 : b_tx_broadcaster.ptr, b_logger == null ? 0 : b_logger.ptr, b_keys_manager == null ? 0 : b_keys_manager.ptr, b_config == null ? 0 : b_config.ptr, b_params == null ? 0 : b_params.ptr)); + public static TwoTuple_BlockHashChannelManagerZ of(byte[] a, FeeEstimator b_fee_est, Watch b_chain_monitor, BroadcasterInterface b_tx_broadcaster, Router b_router, Logger b_logger, EntropySource b_entropy_source, NodeSigner b_node_signer, SignerProvider b_signer_provider, UserConfig b_config, ChainParameters b_params) { + long ret = bindings.C2Tuple_BlockHashChannelManagerZ_new(InternalUtils.check_arr_len(a, 32), bindings.ChannelManager_new(b_fee_est == null ? 0 : b_fee_est.ptr, b_chain_monitor == null ? 0 : b_chain_monitor.ptr, b_tx_broadcaster == null ? 0 : b_tx_broadcaster.ptr, b_router == null ? 0 : b_router.ptr, b_logger == null ? 0 : b_logger.ptr, b_entropy_source == null ? 0 : b_entropy_source.ptr, b_node_signer == null ? 0 : b_node_signer.ptr, b_signer_provider == null ? 0 : b_signer_provider.ptr, b_config == null ? 0 : b_config.ptr, b_params == null ? 0 : b_params.ptr)); Reference.reachabilityFence(a); Reference.reachabilityFence(b_fee_est); Reference.reachabilityFence(b_chain_monitor); Reference.reachabilityFence(b_tx_broadcaster); + Reference.reachabilityFence(b_router); Reference.reachabilityFence(b_logger); - Reference.reachabilityFence(b_keys_manager); + Reference.reachabilityFence(b_entropy_source); + Reference.reachabilityFence(b_node_signer); + Reference.reachabilityFence(b_signer_provider); Reference.reachabilityFence(b_config); Reference.reachabilityFence(b_params); if (ret >= 0 && ret <= 4096) { return null; } @@ -60,8 +63,11 @@ public class TwoTuple_BlockHashChannelManagerZ extends CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_fee_est); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_chain_monitor); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_tx_broadcaster); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_router); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_logger); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_node_signer); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_signer_provider); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_config); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_params); }; return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/TwoTuple_PublicKeyCOption_NetAddressZZ.java b/src/main/java/org/ldk/structs/TwoTuple_PublicKeyCOption_NetAddressZZ.java new file mode 100644 index 00000000..ae8993d9 --- /dev/null +++ b/src/main/java/org/ldk/structs/TwoTuple_PublicKeyCOption_NetAddressZZ.java @@ -0,0 +1,77 @@ +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_PublicKeyCOption_NetAddressZZ extends CommonBase { + TwoTuple_PublicKeyCOption_NetAddressZZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C2Tuple_PublicKeyCOption_NetAddressZZ_free(ptr); } + } + + /** + * + */ + public byte[] get_a() { + byte[] ret = bindings.C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * + */ + public Option_NetAddressZ get_b() { + long ret = bindings.C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.C2Tuple_PublicKeyCOption_NetAddressZZ_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_PublicKeyCOption_NetAddressZZ clone() { + long ret = bindings.C2Tuple_PublicKeyCOption_NetAddressZZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple_PublicKeyCOption_NetAddressZZ ret_hu_conv = new TwoTuple_PublicKeyCOption_NetAddressZZ(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements. + */ + public static TwoTuple_PublicKeyCOption_NetAddressZZ of(byte[] a, org.ldk.structs.Option_NetAddressZ b) { + long ret = bindings.C2Tuple_PublicKeyCOption_NetAddressZZ_new(InternalUtils.check_arr_len(a, 33), b.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple_PublicKeyCOption_NetAddressZZ ret_hu_conv = new TwoTuple_PublicKeyCOption_NetAddressZZ(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/TwoTuple_SignatureSignatureZ.java b/src/main/java/org/ldk/structs/TwoTuple_SignatureSignatureZ.java deleted file mode 100644 index f16acca5..00000000 --- a/src/main/java/org/ldk/structs/TwoTuple_SignatureSignatureZ.java +++ /dev/null @@ -1,73 +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_SignatureSignatureZ extends CommonBase { - TwoTuple_SignatureSignatureZ(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.C2Tuple_SignatureSignatureZ_free(ptr); } - } - - /** - * - */ - public byte[] get_a() { - byte[] ret = bindings.C2Tuple_SignatureSignatureZ_get_a(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * - */ - public byte[] get_b() { - byte[] ret = bindings.C2Tuple_SignatureSignatureZ_get_b(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.C2Tuple_SignatureSignatureZ_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_SignatureSignatureZ clone() { - long ret = bindings.C2Tuple_SignatureSignatureZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_SignatureSignatureZ ret_hu_conv = new TwoTuple_SignatureSignatureZ(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - - /** - * Creates a new C2Tuple_SignatureSignatureZ from the contained elements. - */ - public static TwoTuple_SignatureSignatureZ of(byte[] a, byte[] b) { - long ret = bindings.C2Tuple_SignatureSignatureZ_new(InternalUtils.check_arr_len(a, 64), InternalUtils.check_arr_len(b, 64)); - Reference.reachabilityFence(a); - Reference.reachabilityFence(b); - if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_SignatureSignatureZ ret_hu_conv = new TwoTuple_SignatureSignatureZ(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/TwoTuple_Z.java b/src/main/java/org/ldk/structs/TwoTuple_Z.java new file mode 100644 index 00000000..46c52f2f --- /dev/null +++ b/src/main/java/org/ldk/structs/TwoTuple_Z.java @@ -0,0 +1,73 @@ +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_Z extends CommonBase { + TwoTuple_Z(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C2Tuple_Z_free(ptr); } + } + + /** + * + */ + public short[] get_a() { + short[] ret = bindings.C2Tuple_Z_get_a(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * + */ + public short[] get_b() { + short[] ret = bindings.C2Tuple_Z_get_b(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.C2Tuple_Z_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_Z clone() { + long ret = bindings.C2Tuple_Z_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple_Z ret_hu_conv = new TwoTuple_Z(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Creates a new C2Tuple_Z from the contained elements. + */ + public static TwoTuple_Z of(short[] a, short[] b) { + long ret = bindings.C2Tuple_Z_new(InternalUtils.check_arr_16_len(a, 8), InternalUtils.check_arr_16_len(b, 8)); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple_Z ret_hu_conv = new TwoTuple_Z(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/TwoTuple__u168_u168Z.java b/src/main/java/org/ldk/structs/TwoTuple__u168_u168Z.java new file mode 100644 index 00000000..1aa7458f --- /dev/null +++ b/src/main/java/org/ldk/structs/TwoTuple__u168_u168Z.java @@ -0,0 +1,73 @@ +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__u168_u168Z extends CommonBase { + TwoTuple__u168_u168Z(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C2Tuple__u168_u168Z_free(ptr); } + } + + /** + * + */ + public short[] get_a() { + short[] ret = bindings.C2Tuple__u168_u168Z_get_a(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * + */ + public short[] get_b() { + short[] ret = bindings.C2Tuple__u168_u168Z_get_b(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.C2Tuple__u168_u168Z_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__u168_u168Z clone() { + long ret = bindings.C2Tuple__u168_u168Z_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple__u168_u168Z ret_hu_conv = new TwoTuple__u168_u168Z(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Creates a new C2Tuple__u168_u168Z from the contained elements. + */ + public static TwoTuple__u168_u168Z of(short[] a, short[] b) { + long ret = bindings.C2Tuple__u168_u168Z_new(InternalUtils.check_arr_16_len(a, 8), InternalUtils.check_arr_16_len(b, 8)); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + if (ret >= 0 && ret <= 4096) { return null; } + TwoTuple__u168_u168Z ret_hu_conv = new TwoTuple__u168_u168Z(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Type.java b/src/main/java/org/ldk/structs/Type.java index 0e7e32eb..d4a5cacf 100644 --- a/src/main/java/org/ldk/structs/Type.java +++ b/src/main/java/org/ldk/structs/Type.java @@ -25,7 +25,19 @@ public class Type extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Type_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Type_free(ptr); } + ptr = 0; + } public static interface TypeInterface { /** * Returns the type identifying the message payload. diff --git a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java index f77c766b..d93703ca 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * The unsigned part of a channel_announcement + * The unsigned part of a [`channel_announcement`] message. + * + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UnsignedChannelAnnouncement extends CommonBase { @@ -79,75 +81,91 @@ public class UnsignedChannelAnnouncement extends CommonBase { } /** - * One of the two node_ids which are endpoints of this channel + * One of the two `node_id`s which are endpoints of this channel */ - public byte[] get_node_id_1() { - byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr); + public NodeId get_node_id_1() { + long ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** - * One of the two node_ids which are endpoints of this channel + * One of the two `node_id`s which are endpoints of this channel */ - public void set_node_id_1(byte[] val) { - bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, InternalUtils.check_arr_len(val, 33)); + public void set_node_id_1(org.ldk.structs.NodeId val) { + bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** - * The other of the two node_ids which are endpoints of this channel + * The other of the two `node_id`s which are endpoints of this channel */ - public byte[] get_node_id_2() { - byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr); + public NodeId get_node_id_2() { + long ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** - * The other of the two node_ids which are endpoints of this channel + * The other of the two `node_id`s which are endpoints of this channel */ - public void set_node_id_2(byte[] val) { - bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, InternalUtils.check_arr_len(val, 33)); + public void set_node_id_2(org.ldk.structs.NodeId val) { + bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** * The funding key for the first node */ - public byte[] get_bitcoin_key_1() { - byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr); + public NodeId get_bitcoin_key_1() { + long ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** * The funding key for the first node */ - public void set_bitcoin_key_1(byte[] val) { - bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, InternalUtils.check_arr_len(val, 33)); + public void set_bitcoin_key_1(org.ldk.structs.NodeId val) { + bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** * The funding key for the second node */ - public byte[] get_bitcoin_key_2() { - byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr); + public NodeId get_bitcoin_key_2() { + long ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** * The funding key for the second node */ - public void set_bitcoin_key_2(byte[] val) { - bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, InternalUtils.check_arr_len(val, 33)); + public void set_bitcoin_key_2(org.ldk.structs.NodeId val) { + bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } long clone_ptr() { diff --git a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java index 91ed2a7d..9927f7c1 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * The unsigned part of a channel_update + * The unsigned part of a [`channel_update`] message. + * + * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UnsignedChannelUpdate extends CommonBase { @@ -95,10 +97,10 @@ public class UnsignedChannelUpdate extends CommonBase { /** * The number of blocks such that if: * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before * forwarding. Note that the HTLC sender is the one who originally sets this value when * constructing the route. */ @@ -111,10 +113,10 @@ public class UnsignedChannelUpdate extends CommonBase { /** * The number of blocks such that if: * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before * forwarding. Note that the HTLC sender is the one who originally sets this value when * constructing the route. */ @@ -143,7 +145,9 @@ public class UnsignedChannelUpdate extends CommonBase { } /** - * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ public long get_htlc_maximum_msat() { long ret = bindings.UnsignedChannelUpdate_get_htlc_maximum_msat(this.ptr); @@ -152,7 +156,9 @@ public class UnsignedChannelUpdate extends CommonBase { } /** - * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ public void set_htlc_maximum_msat(long val) { bindings.UnsignedChannelUpdate_set_htlc_maximum_msat(this.ptr, val); @@ -198,8 +204,9 @@ public class UnsignedChannelUpdate extends CommonBase { /** * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. This is stored to ensure forward-compatibility as new fields are added to the - * lightning gossip + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. * * Returns a copy of the field. */ @@ -211,8 +218,9 @@ public class UnsignedChannelUpdate extends CommonBase { /** * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. This is stored to ensure forward-compatibility as new fields are added to the - * lightning gossip + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. */ public void set_excess_data(byte[] val) { bindings.UnsignedChannelUpdate_set_excess_data(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/UnsignedGossipMessage.java b/src/main/java/org/ldk/structs/UnsignedGossipMessage.java new file mode 100644 index 00000000..f895fbef --- /dev/null +++ b/src/main/java/org/ldk/structs/UnsignedGossipMessage.java @@ -0,0 +1,141 @@ +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 the set of gossip messages that require a signature from a node's identity key. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class UnsignedGossipMessage extends CommonBase { + private UnsignedGossipMessage(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.UnsignedGossipMessage_free(ptr); } + } + static UnsignedGossipMessage constr_from_ptr(long ptr) { + bindings.LDKUnsignedGossipMessage raw_val = bindings.LDKUnsignedGossipMessage_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKUnsignedGossipMessage.ChannelAnnouncement.class) { + return new ChannelAnnouncement(ptr, (bindings.LDKUnsignedGossipMessage.ChannelAnnouncement)raw_val); + } + if (raw_val.getClass() == bindings.LDKUnsignedGossipMessage.ChannelUpdate.class) { + return new ChannelUpdate(ptr, (bindings.LDKUnsignedGossipMessage.ChannelUpdate)raw_val); + } + if (raw_val.getClass() == bindings.LDKUnsignedGossipMessage.NodeAnnouncement.class) { + return new NodeAnnouncement(ptr, (bindings.LDKUnsignedGossipMessage.NodeAnnouncement)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * An unsigned channel announcement. + */ + public final static class ChannelAnnouncement extends UnsignedGossipMessage { + public final org.ldk.structs.UnsignedChannelAnnouncement channel_announcement; + private ChannelAnnouncement(long ptr, bindings.LDKUnsignedGossipMessage.ChannelAnnouncement obj) { + super(null, ptr); + long channel_announcement = obj.channel_announcement; + org.ldk.structs.UnsignedChannelAnnouncement channel_announcement_hu_conv = null; if (channel_announcement < 0 || channel_announcement > 4096) { channel_announcement_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, channel_announcement); } + if (channel_announcement_hu_conv != null) { channel_announcement_hu_conv.ptrs_to.add(this); }; + this.channel_announcement = channel_announcement_hu_conv; + } + } + /** + * An unsigned channel update. + */ + public final static class ChannelUpdate extends UnsignedGossipMessage { + public final org.ldk.structs.UnsignedChannelUpdate channel_update; + private ChannelUpdate(long ptr, bindings.LDKUnsignedGossipMessage.ChannelUpdate obj) { + super(null, ptr); + long channel_update = obj.channel_update; + org.ldk.structs.UnsignedChannelUpdate channel_update_hu_conv = null; if (channel_update < 0 || channel_update > 4096) { channel_update_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, channel_update); } + if (channel_update_hu_conv != null) { channel_update_hu_conv.ptrs_to.add(this); }; + this.channel_update = channel_update_hu_conv; + } + } + /** + * An unsigned node announcement. + */ + public final static class NodeAnnouncement extends UnsignedGossipMessage { + public final org.ldk.structs.UnsignedNodeAnnouncement node_announcement; + private NodeAnnouncement(long ptr, bindings.LDKUnsignedGossipMessage.NodeAnnouncement obj) { + super(null, ptr); + long node_announcement = obj.node_announcement; + org.ldk.structs.UnsignedNodeAnnouncement node_announcement_hu_conv = null; if (node_announcement < 0 || node_announcement > 4096) { node_announcement_hu_conv = new org.ldk.structs.UnsignedNodeAnnouncement(null, node_announcement); } + if (node_announcement_hu_conv != null) { node_announcement_hu_conv.ptrs_to.add(this); }; + this.node_announcement = node_announcement_hu_conv; + } + } + long clone_ptr() { + long ret = bindings.UnsignedGossipMessage_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the UnsignedGossipMessage + */ + public UnsignedGossipMessage clone() { + long ret = bindings.UnsignedGossipMessage_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage + */ + public static UnsignedGossipMessage channel_announcement(org.ldk.structs.UnsignedChannelAnnouncement a) { + long ret = bindings.UnsignedGossipMessage_channel_announcement(a == null ? 0 : a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage + */ + public static UnsignedGossipMessage channel_update(org.ldk.structs.UnsignedChannelUpdate a) { + long ret = bindings.UnsignedGossipMessage_channel_update(a == null ? 0 : a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage + */ + public static UnsignedGossipMessage node_announcement(org.ldk.structs.UnsignedNodeAnnouncement a) { + long ret = bindings.UnsignedGossipMessage_node_announcement(a == null ? 0 : a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UnsignedGossipMessage ret_hu_conv = org.ldk.structs.UnsignedGossipMessage.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + return ret_hu_conv; + } + + /** + * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read + */ + public byte[] write() { + byte[] ret = bindings.UnsignedGossipMessage_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java index afecabf1..bbeb4176 100644 --- a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * The unsigned part of a node_announcement + * The unsigned part of a [`node_announcement`] message. + * + * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UnsignedNodeAnnouncement extends CommonBase { @@ -61,23 +63,27 @@ public class UnsignedNodeAnnouncement extends CommonBase { } /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back * to this node). */ - public byte[] get_node_id() { - byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr); + public NodeId get_node_id() { + long ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr); Reference.reachabilityFence(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; } /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back * to this node). */ - public void set_node_id(byte[] val) { - bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + public void set_node_id(org.ldk.structs.NodeId val) { + bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val == null ? 0 : val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -99,8 +105,9 @@ public class UnsignedNodeAnnouncement extends CommonBase { } /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ public byte[] get_alias() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr); @@ -109,8 +116,9 @@ public class UnsignedNodeAnnouncement extends CommonBase { } /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ public void set_alias(byte[] val) { bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, InternalUtils.check_arr_len(val, 32)); @@ -144,6 +152,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null); Reference.reachabilityFence(this); Reference.reachabilityFence(val); + for (NetAddress val_conv_12: val) { if (this != null) { this.ptrs_to.add(val_conv_12); }; }; } long clone_ptr() { diff --git a/src/main/java/org/ldk/structs/UpdateAddHTLC.java b/src/main/java/org/ldk/structs/UpdateAddHTLC.java index 84ab2d94..879c5295 100644 --- a/src/main/java/org/ldk/structs/UpdateAddHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateAddHTLC.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An update_add_htlc message to be sent or received from a peer + * An [`update_add_htlc`] message to be sent to or received from a peer. + * + * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UpdateAddHTLC extends CommonBase { diff --git a/src/main/java/org/ldk/structs/UpdateFailHTLC.java b/src/main/java/org/ldk/structs/UpdateFailHTLC.java index 64982c97..a4f89c6a 100644 --- a/src/main/java/org/ldk/structs/UpdateFailHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFailHTLC.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An update_fail_htlc message to be sent or received from a peer + * An [`update_fail_htlc`] message to be sent to or received from a peer. + * + * [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UpdateFailHTLC extends CommonBase { diff --git a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java index fd8f75b8..388c79ac 100644 --- a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An update_fail_malformed_htlc message to be sent or received from a peer + * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer. + * + * [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UpdateFailMalformedHTLC extends CommonBase { diff --git a/src/main/java/org/ldk/structs/UpdateFee.java b/src/main/java/org/ldk/structs/UpdateFee.java index 5795555f..316214fb 100644 --- a/src/main/java/org/ldk/structs/UpdateFee.java +++ b/src/main/java/org/ldk/structs/UpdateFee.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An update_fee message to be sent or received from a peer + * An [`update_fee`] message to be sent to or received from a peer + * + * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UpdateFee extends CommonBase { diff --git a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java index 63332291..22e9090d 100644 --- a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * An update_fulfill_htlc message to be sent or received from a peer + * An [`update_fulfill_htlc`] message to be sent to or received from a peer. + * + * [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class UpdateFulfillHTLC extends CommonBase { diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index 6565229a..3ba0b392 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -42,6 +42,17 @@ public class UtilMethods { return ret; } + /** + * Read a PathFailure from a byte array, created by PathFailure_write + */ + public static Result_COption_PathFailureZDecodeErrorZ PathFailure_read(byte[] ser) { + long ret = bindings.PathFailure_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Read a ClosureReason from a byte array, created by ClosureReason_write */ @@ -75,6 +86,17 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Read a APIError from a byte array, created by APIError_write + */ + public static Result_COption_APIErrorZDecodeErrorZ APIError_read(byte[] ser) { + long ret = bindings.APIError_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Creates a digital signature of a message given a SecretKey, like the node's secret. * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. @@ -137,37 +159,15 @@ public class UtilMethods { /** * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write */ - public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, org.ldk.structs.KeysInterface arg) { - long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg == null ? 0 : arg.ptr); + public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, org.ldk.structs.EntropySource arg_a, org.ldk.structs.SignerProvider arg_b) { + long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg_a == null ? 0 : arg_a.ptr, arg_b == null ? 0 : arg_b.ptr); Reference.reachabilityFence(ser); - Reference.reachabilityFence(arg); + Reference.reachabilityFence(arg_a); + Reference.reachabilityFence(arg_b); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg); }; - return ret_hu_conv; - } - - /** - * Fetches the set of [`NodeFeatures`] flags which are provided by or required by - * [`ChannelManager`]. - */ - public static NodeFeatures provided_node_features() { - long ret = bindings.provided_node_features(); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - return ret_hu_conv; - } - - /** - * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by - * [`ChannelManager`]. - */ - public static ChannelFeatures provided_channel_features() { - long ret = bindings.provided_channel_features(); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_a); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_b); }; return ret_hu_conv; } @@ -175,33 +175,41 @@ public class UtilMethods { * Fetches the set of [`InitFeatures`] flags which are provided by or required by * [`ChannelManager`]. */ - public static InitFeatures provided_init_features() { - long ret = bindings.provided_init_features(); + public static InitFeatures provided_init_features(org.ldk.structs.UserConfig _config) { + long ret = bindings.provided_init_features(_config == null ? 0 : _config.ptr); + Reference.reachabilityFence(_config); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); } if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(_config); }; return ret_hu_conv; } /** * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write */ - public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) { - long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null)); + public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, EntropySource arg_entropy_source, NodeSigner arg_node_signer, SignerProvider arg_signer_provider, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Router arg_router, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) { + long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_entropy_source == null ? 0 : arg_entropy_source.ptr, arg_node_signer == null ? 0 : arg_node_signer.ptr, arg_signer_provider == null ? 0 : arg_signer_provider.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_router == null ? 0 : arg_router.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null)); Reference.reachabilityFence(ser); - Reference.reachabilityFence(arg_keys_manager); + Reference.reachabilityFence(arg_entropy_source); + Reference.reachabilityFence(arg_node_signer); + Reference.reachabilityFence(arg_signer_provider); Reference.reachabilityFence(arg_fee_estimator); Reference.reachabilityFence(arg_chain_monitor); Reference.reachabilityFence(arg_tx_broadcaster); + Reference.reachabilityFence(arg_router); Reference.reachabilityFence(arg_logger); Reference.reachabilityFence(arg_default_config); Reference.reachabilityFence(arg_channel_monitors); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_node_signer); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_signer_provider); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_fee_estimator); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_chain_monitor); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_tx_broadcaster); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_router); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_logger); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_default_config); }; for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); }; }; @@ -213,25 +221,32 @@ public class UtilMethods { * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without * a `ChannelManager`. * - * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then + * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not * regenerate it for each new inbound payment. * * `current_time` is a Unix timestamp representing the current time. * + * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material */ - public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.KeysInterface keys_manager, long current_time) { - long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, keys_manager == null ? 0 : keys_manager.ptr, current_time); + public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.EntropySource entropy_source, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, entropy_source == null ? 0 : entropy_source.ptr, current_time, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(keys); Reference.reachabilityFence(min_value_msat); Reference.reachabilityFence(invoice_expiry_delta_secs); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(entropy_source); Reference.reachabilityFence(current_time); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_value_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -242,18 +257,24 @@ public class UtilMethods { * * See [`create`] for information on the `keys` and `current_time` parameters. * + * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager */ - public static Result_PaymentSecretNoneZ create_from_hash(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time) { - long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time); + public static Result_PaymentSecretNoneZ create_from_hash(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(keys); Reference.reachabilityFence(min_value_msat); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(invoice_expiry_delta_secs); Reference.reachabilityFence(current_time); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_value_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -575,6 +596,106 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Pays the given [`Invoice`], retrying if needed based on [`Retry`]. + * + * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long + * as the payment is still pending. Once the payment completes or fails, you must ensure that + * a second payment with the same [`PaymentHash`] is never sent. + * + * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. + */ + public static Result_PaymentIdPaymentErrorZ pay_invoice(org.ldk.structs.Invoice invoice, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { + long ret = bindings.pay_invoice(invoice == null ? 0 : invoice.ptr, retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); + Reference.reachabilityFence(invoice); + Reference.reachabilityFence(retry_strategy); + Reference.reachabilityFence(channelmanager); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; + return ret_hu_conv; + } + + /** + * Pays the given [`Invoice`] with a custom idempotency key, retrying if needed based on [`Retry`]. + * + * Note that idempotency is only guaranteed as long as the payment is still pending. Once the + * payment completes or fails, no idempotency guarantees are made. + * + * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] + * has never been paid before. + * + * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token. + */ + public static Result_NonePaymentErrorZ pay_invoice_with_id(org.ldk.structs.Invoice invoice, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { + long ret = bindings.pay_invoice_with_id(invoice == null ? 0 : invoice.ptr, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); + Reference.reachabilityFence(invoice); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(retry_strategy); + Reference.reachabilityFence(channelmanager); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; + return ret_hu_conv; + } + + /** + * Pays the given zero-value [`Invoice`] using the given amount, retrying if needed based on + * [`Retry`]. + * + * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long + * as the payment is still pending. Once the payment completes or fails, you must ensure that + * a second payment with the same [`PaymentHash`] is never sent. + * + * If you wish to use a different payment idempotency token, see + * [`pay_zero_value_invoice_with_id`]. + */ + public static Result_PaymentIdPaymentErrorZ pay_zero_value_invoice(org.ldk.structs.Invoice invoice, long amount_msats, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { + long ret = bindings.pay_zero_value_invoice(invoice == null ? 0 : invoice.ptr, amount_msats, retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); + Reference.reachabilityFence(invoice); + Reference.reachabilityFence(amount_msats); + Reference.reachabilityFence(retry_strategy); + Reference.reachabilityFence(channelmanager); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; + return ret_hu_conv; + } + + /** + * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key, + * , retrying if needed based on [`Retry`]. + * + * Note that idempotency is only guaranteed as long as the payment is still pending. Once the + * payment completes or fails, no idempotency guarantees are made. + * + * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] + * has never been paid before. + * + * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the + * idempotency token. + */ + public static Result_NonePaymentErrorZ pay_zero_value_invoice_with_id(org.ldk.structs.Invoice invoice, long amount_msats, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) { + long ret = bindings.pay_zero_value_invoice_with_id(invoice == null ? 0 : invoice.ptr, amount_msats, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr); + Reference.reachabilityFence(invoice); + Reference.reachabilityFence(amount_msats); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(retry_strategy); + Reference.reachabilityFence(channelmanager); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NonePaymentErrorZ ret_hu_conv = Result_NonePaymentErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(retry_strategy); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; + return ret_hu_conv; + } + /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" * See [`PhantomKeysManager`] for more information on phantom node payments. @@ -596,7 +717,14 @@ public class UtilMethods { * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. * - * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom + * `duration_since_epoch` is the current time since epoch in seconds. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this * requirement). * @@ -605,24 +733,34 @@ public class UtilMethods { * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + * + * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not + * available and the current time is supplied by the caller. * * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network) { - long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network); + public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) { + long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(description); Reference.reachabilityFence(invoice_expiry_delta_secs); Reference.reachabilityFence(phantom_route_hints); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); + Reference.reachabilityFence(min_final_cltv_expiry_delta); + Reference.reachabilityFence(duration_since_epoch); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -649,7 +787,9 @@ public class UtilMethods { * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. * - * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom + * `duration_since_epoch` is the current time since epoch in seconds. + * + * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this * requirement). * @@ -659,24 +799,33 @@ public class UtilMethods { * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels * + * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not + * available and the current time is supplied by the caller. + * * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network) { - long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network); + public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) { + long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(invoice_expiry_delta_secs); Reference.reachabilityFence(description_hash); Reference.reachabilityFence(phantom_route_hints); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(entropy_source); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); + Reference.reachabilityFence(min_final_cltv_expiry_delta); + Reference.reachabilityFence(duration_since_epoch); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); }; for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -689,21 +838,31 @@ public class UtilMethods { * * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ - public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, int invoice_expiry_delta_secs) { - long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs); + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(description); Reference.reachabilityFence(invoice_expiry_delta_secs); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -717,22 +876,32 @@ public class UtilMethods { * * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ - public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, int invoice_expiry_delta_secs) { - long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs); + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(description_hash); Reference.reachabilityFence(invoice_expiry_delta_secs); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -741,22 +910,25 @@ public class UtilMethods { * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ - public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, long duration_since_epoch, int invoice_expiry_delta_secs) { - long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs); + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(description_hash); Reference.reachabilityFence(duration_since_epoch); Reference.reachabilityFence(invoice_expiry_delta_secs); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -765,21 +937,24 @@ public class UtilMethods { * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ - public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs) { - long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs); + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(description); Reference.reachabilityFence(duration_since_epoch); Reference.reachabilityFence(invoice_expiry_delta_secs); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } @@ -789,10 +964,10 @@ public class UtilMethods { * This may be useful if you're building an on-chain swap or involving another protocol where * the payment hash is also involved outside the scope of lightning. */ - public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash) { - long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32)); + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { + long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32), min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); - Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); Reference.reachabilityFence(network); Reference.reachabilityFence(amt_msat); @@ -800,11 +975,14 @@ public class UtilMethods { Reference.reachabilityFence(duration_since_epoch); Reference.reachabilityFence(invoice_expiry_delta_secs); Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(min_final_cltv_expiry_delta); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); }; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/UtxoFuture.java b/src/main/java/org/ldk/structs/UtxoFuture.java new file mode 100644 index 00000000..139098a3 --- /dev/null +++ b/src/main/java/org/ldk/structs/UtxoFuture.java @@ -0,0 +1,98 @@ +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 future resolution of a [`UtxoLookup::get_utxo`] query resolving async. + * + * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class UtxoFuture extends CommonBase { + UtxoFuture(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.UtxoFuture_free(ptr); } + } + + long clone_ptr() { + long ret = bindings.UtxoFuture_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the UtxoFuture + */ + public UtxoFuture clone() { + long ret = bindings.UtxoFuture_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UtxoFuture ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UtxoFuture(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Builds a new future for later resolution. + */ + public static UtxoFuture of() { + long ret = bindings.UtxoFuture_new(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UtxoFuture ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UtxoFuture(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Resolves this future against the given `graph` and with the given `result`. + * + * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling + * forwarding the validated gossip message onwards to peers. + * + * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order + * to allow us to interact with peers again, you should call [`PeerManager::process_events`] + * after this. + * + * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + */ + public void resolve_without_forwarding(org.ldk.structs.NetworkGraph graph, org.ldk.structs.Result_TxOutUtxoLookupErrorZ result) { + bindings.UtxoFuture_resolve_without_forwarding(this.ptr, graph == null ? 0 : graph.ptr, result != null ? result.ptr : 0); + Reference.reachabilityFence(this); + Reference.reachabilityFence(graph); + Reference.reachabilityFence(result); + if (this != null) { this.ptrs_to.add(graph); }; + } + + /** + * Resolves this future against the given `graph` and with the given `result`. + * + * The given `gossip` is used to broadcast any validated messages onwards to all peers which + * have available buffer space. + * + * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order + * to allow us to interact with peers again, you should call [`PeerManager::process_events`] + * after this. + * + * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + */ + public void resolve(org.ldk.structs.NetworkGraph graph, org.ldk.structs.P2PGossipSync gossip, org.ldk.structs.Result_TxOutUtxoLookupErrorZ result) { + bindings.UtxoFuture_resolve(this.ptr, graph == null ? 0 : graph.ptr, gossip == null ? 0 : gossip.ptr, result != null ? result.ptr : 0); + Reference.reachabilityFence(this); + Reference.reachabilityFence(graph); + Reference.reachabilityFence(gossip); + Reference.reachabilityFence(result); + if (this != null) { this.ptrs_to.add(graph); }; + if (this != null) { this.ptrs_to.add(gossip); }; + } + +} diff --git a/src/main/java/org/ldk/structs/UtxoLookup.java b/src/main/java/org/ldk/structs/UtxoLookup.java new file mode 100644 index 00000000..6087060d --- /dev/null +++ b/src/main/java/org/ldk/structs/UtxoLookup.java @@ -0,0 +1,81 @@ +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; + +/** + * The `UtxoLookup` trait defines behavior for accessing on-chain UTXOs. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class UtxoLookup extends CommonBase { + final bindings.LDKUtxoLookup bindings_instance; + UtxoLookup(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private UtxoLookup(bindings.LDKUtxoLookup arg) { + super(bindings.LDKUtxoLookup_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.UtxoLookup_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.UtxoLookup_free(ptr); } + ptr = 0; + } + public static interface UtxoLookupInterface { + /** + * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. + * Returns an error if `genesis_hash` is for a different chain or if such a transaction output + * is unknown. + * + * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id + */ + UtxoResult get_utxo(byte[] genesis_hash, long short_channel_id); + } + private static class LDKUtxoLookupHolder { UtxoLookup held; } + public static UtxoLookup new_impl(UtxoLookupInterface arg) { + final LDKUtxoLookupHolder impl_holder = new LDKUtxoLookupHolder(); + impl_holder.held = new UtxoLookup(new bindings.LDKUtxoLookup() { + @Override public long get_utxo(byte[] genesis_hash, long short_channel_id) { + UtxoResult ret = arg.get_utxo(genesis_hash, short_channel_id); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; + return result; + } + }); + return impl_holder.held; + } + /** + * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. + * Returns an error if `genesis_hash` is for a different chain or if such a transaction output + * is unknown. + * + * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id + */ + public UtxoResult get_utxo(byte[] genesis_hash, long short_channel_id) { + long ret = bindings.UtxoLookup_get_utxo(this.ptr, InternalUtils.check_arr_len(genesis_hash, 32), short_channel_id); + Reference.reachabilityFence(this); + Reference.reachabilityFence(genesis_hash); + Reference.reachabilityFence(short_channel_id); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/UtxoResult.java b/src/main/java/org/ldk/structs/UtxoResult.java new file mode 100644 index 00000000..0d4d3469 --- /dev/null +++ b/src/main/java/org/ldk/structs/UtxoResult.java @@ -0,0 +1,110 @@ +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; + + +/** + * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously, + * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async` + * variant. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class UtxoResult extends CommonBase { + private UtxoResult(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.UtxoResult_free(ptr); } + } + static UtxoResult constr_from_ptr(long ptr) { + bindings.LDKUtxoResult raw_val = bindings.LDKUtxoResult_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKUtxoResult.Sync.class) { + return new Sync(ptr, (bindings.LDKUtxoResult.Sync)raw_val); + } + if (raw_val.getClass() == bindings.LDKUtxoResult.Async.class) { + return new Async(ptr, (bindings.LDKUtxoResult.Async)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * A result which was resolved synchronously. It either includes a [`TxOut`] for the output + * requested or a [`UtxoLookupError`]. + */ + public final static class Sync extends UtxoResult { + public final org.ldk.structs.Result_TxOutUtxoLookupErrorZ sync; + private Sync(long ptr, bindings.LDKUtxoResult.Sync obj) { + super(null, ptr); + long sync = obj.sync; + Result_TxOutUtxoLookupErrorZ sync_hu_conv = Result_TxOutUtxoLookupErrorZ.constr_from_ptr(sync); + this.sync = sync_hu_conv; + } + } + /** + * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of + * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes. + * + * Note that in order to avoid runaway memory usage, the number of parallel checks is limited, + * but only fairly loosely. Because a pending checks block all message processing, leaving + * checks pending for an extended time may cause DoS of other functions. It is recommended you + * keep a tight timeout on lookups, on the order of a few seconds. + */ + public final static class Async extends UtxoResult { + public final org.ldk.structs.UtxoFuture async; + private Async(long ptr, bindings.LDKUtxoResult.Async obj) { + super(null, ptr); + long async = obj.async; + org.ldk.structs.UtxoFuture async_hu_conv = null; if (async < 0 || async > 4096) { async_hu_conv = new org.ldk.structs.UtxoFuture(null, async); } + if (async_hu_conv != null) { async_hu_conv.ptrs_to.add(this); }; + this.async = async_hu_conv; + } + } + long clone_ptr() { + long ret = bindings.UtxoResult_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the UtxoResult + */ + public UtxoResult clone() { + long ret = bindings.UtxoResult_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Sync-variant UtxoResult + */ + public static UtxoResult sync(org.ldk.structs.Result_TxOutUtxoLookupErrorZ a) { + long ret = bindings.UtxoResult_sync(a != null ? a.ptr : 0); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Async-variant UtxoResult + */ + public static UtxoResult async(org.ldk.structs.UtxoFuture a) { + long ret = bindings.UtxoResult_async(a == null ? 0 : a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/WarningMessage.java b/src/main/java/org/ldk/structs/WarningMessage.java index d4a6da4d..ae6cdbd1 100644 --- a/src/main/java/org/ldk/structs/WarningMessage.java +++ b/src/main/java/org/ldk/structs/WarningMessage.java @@ -9,7 +9,9 @@ import javax.annotation.Nullable; /** - * A warning message to be sent or received from a peer + * A [`warning`] message to be sent to or received from a peer. + * + * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class WarningMessage extends CommonBase { @@ -44,6 +46,7 @@ public class WarningMessage extends CommonBase { /** * A possibly human-readable warning description. + * * The string should be sanitized before it is used (e.g. emitted to logs or printed to * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. @@ -56,6 +59,7 @@ public class WarningMessage extends CommonBase { /** * A possibly human-readable warning description. + * * The string should be sanitized before it is used (e.g. emitted to logs or printed to * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index 8da38213..87ae3274 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -41,7 +41,19 @@ public class Watch extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.Watch_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.Watch_free(ptr); } + ptr = 0; + } public static interface WatchInterface { /** * Watches a channel identified by `funding_txo` using `monitor`. @@ -97,7 +109,6 @@ public class Watch extends CommonBase { org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); } if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); }; org.ldk.structs.ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new org.ldk.structs.ChannelMonitorUpdate(null, update); } - if (update_hu_conv != null) { update_hu_conv.ptrs_to.add(this); }; ChannelMonitorUpdateStatus ret = arg.update_channel(funding_txo_hu_conv, update_hu_conv); Reference.reachabilityFence(arg); return ret; diff --git a/src/main/java/org/ldk/structs/WriteableEcdsaChannelSigner.java b/src/main/java/org/ldk/structs/WriteableEcdsaChannelSigner.java new file mode 100644 index 00000000..7575d368 --- /dev/null +++ b/src/main/java/org/ldk/structs/WriteableEcdsaChannelSigner.java @@ -0,0 +1,112 @@ +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 writeable signer. + * + * There will always be two instances of a signer per channel, one occupied by the + * [`ChannelManager`] and another by the channel's [`ChannelMonitor`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class WriteableEcdsaChannelSigner extends CommonBase { + final bindings.LDKWriteableEcdsaChannelSigner bindings_instance; + WriteableEcdsaChannelSigner(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private WriteableEcdsaChannelSigner(bindings.LDKWriteableEcdsaChannelSigner arg, bindings.LDKEcdsaChannelSigner EcdsaChannelSigner, bindings.LDKChannelSigner ChannelSigner, ChannelPublicKeys pubkeys) { + super(bindings.LDKWriteableEcdsaChannelSigner_new(arg, EcdsaChannelSigner, ChannelSigner, pubkeys == null ? 0 : pubkeys.clone_ptr())); + this.ptrs_to.add(arg); + this.ptrs_to.add(EcdsaChannelSigner); + this.ptrs_to.add(ChannelSigner); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); } + ptr = 0; + } + public static interface WriteableEcdsaChannelSignerInterface { + /** + * Serialize the object into a byte array + */ + byte[] write(); + } + private static class LDKWriteableEcdsaChannelSignerHolder { WriteableEcdsaChannelSigner held; } + public static WriteableEcdsaChannelSigner new_impl(WriteableEcdsaChannelSignerInterface arg, EcdsaChannelSigner.EcdsaChannelSignerInterface EcdsaChannelSigner_impl, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) { + final LDKWriteableEcdsaChannelSignerHolder impl_holder = new LDKWriteableEcdsaChannelSignerHolder(); + impl_holder.held = new WriteableEcdsaChannelSigner(new bindings.LDKWriteableEcdsaChannelSigner() { + @Override public byte[] write() { + byte[] ret = arg.write(); + Reference.reachabilityFence(arg); + return ret; + } + }, EcdsaChannelSigner.new_impl(EcdsaChannelSigner_impl, ChannelSigner_impl, pubkeys).bindings_instance, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys); + return impl_holder.held; + } + + /** + * Gets the underlying EcdsaChannelSigner. + */ + public EcdsaChannelSigner get_ecdsa_channel_signer() { + EcdsaChannelSigner res = new EcdsaChannelSigner(null, bindings.LDKWriteableEcdsaChannelSigner_get_EcdsaChannelSigner(this.ptr)); + res.ptrs_to.add(this); + return res; + } + + + /** + * Gets the underlying ChannelSigner. + */ + public ChannelSigner get_channel_signer() { + ChannelSigner res = new ChannelSigner(null, bindings.LDKWriteableEcdsaChannelSigner_get_ChannelSigner(this.ptr)); + res.ptrs_to.add(this); + return res; + } + + /** + * Serialize the object into a byte array + */ + public byte[] write() { + byte[] ret = bindings.WriteableEcdsaChannelSigner_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.WriteableEcdsaChannelSigner_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of a WriteableEcdsaChannelSigner + */ + public WriteableEcdsaChannelSigner clone() { + long ret = bindings.WriteableEcdsaChannelSigner_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/WriteableScore.java b/src/main/java/org/ldk/structs/WriteableScore.java index 4e543105..e2a06844 100644 --- a/src/main/java/org/ldk/structs/WriteableScore.java +++ b/src/main/java/org/ldk/structs/WriteableScore.java @@ -27,7 +27,19 @@ public class WriteableScore extends CommonBase { protected void finalize() throws Throwable { if (ptr != 0) { bindings.WriteableScore_free(ptr); } super.finalize(); } - + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { + if (ptr != 0) { bindings.WriteableScore_free(ptr); } + ptr = 0; + } public static interface WriteableScoreInterface { /** * Serialize the object into a byte array @@ -52,7 +64,7 @@ public class WriteableScore extends CommonBase { */ public LockableScore get_lockable_score() { LockableScore res = new LockableScore(null, bindings.LDKWriteableScore_get_LockableScore(this.ptr)); - this.ptrs_to.add(res); + res.ptrs_to.add(this); return res; } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 023f1126..205561c9 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -37,6 +37,7 @@ _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits"); typedef jlongArray int64_tArray; typedef jbyteArray int8_tArray; +typedef jshortArray int16_tArray; static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) { // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator @@ -136,40 +137,6 @@ static inline uint64_t tag_ptr(const void* ptr, bool is_owned) { } } -static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) { - jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception."); - } - switch (ord) { - case 0: return LDKAccessError_UnknownChain; - case 1: return LDKAccessError_UnknownTx; - } - (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value."); - abort(); // Unreachable, but will let the compiler know we don't return here -} -static jclass AccessError_class = NULL; -static jfieldID AccessError_LDKAccessError_UnknownChain = NULL; -static jfieldID AccessError_LDKAccessError_UnknownTx = NULL; -JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) { - AccessError_class = (*env)->NewGlobalRef(env, clz); - CHECK(AccessError_class != NULL); - AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;"); - CHECK(AccessError_LDKAccessError_UnknownChain != NULL); - AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;"); - CHECK(AccessError_LDKAccessError_UnknownTx != NULL); -} -static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) { - switch (val) { - case LDKAccessError_UnknownChain: - return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain); - case LDKAccessError_UnknownTx: - return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx); - default: abort(); - } -} - static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) { jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { @@ -296,6 +263,7 @@ static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass cl case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_InvalidAmount; case 4: return LDKCreationError_MissingRouteHints; + case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort; } (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value."); abort(); // Unreachable, but will let the compiler know we don't return here @@ -306,6 +274,7 @@ static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL; static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL; static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL; static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL; +static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) { CreationError_class = (*env)->NewGlobalRef(env, clz); CHECK(CreationError_class != NULL); @@ -319,6 +288,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclas CHECK(CreationError_LDKCreationError_InvalidAmount != NULL); CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL); + CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;"); + CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL); } static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) { switch (val) { @@ -332,6 +303,8 @@ static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount); case LDKCreationError_MissingRouteHints: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints); + case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: + return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort); default: abort(); } } @@ -388,6 +361,46 @@ static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) { } } +static inline LDKFailureCode LDKFailureCode_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKFailureCode_TemporaryNodeFailure; + case 1: return LDKFailureCode_RequiredNodeFeatureMissing; + case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails; + } + (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass FailureCode_class = NULL; +static jfieldID FailureCode_LDKFailureCode_TemporaryNodeFailure = NULL; +static jfieldID FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = NULL; +static jfieldID FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_FailureCode_init (JNIEnv *env, jclass clz) { + FailureCode_class = (*env)->NewGlobalRef(env, clz); + CHECK(FailureCode_class != NULL); + FailureCode_LDKFailureCode_TemporaryNodeFailure = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_TemporaryNodeFailure", "Lorg/ldk/enums/FailureCode;"); + CHECK(FailureCode_LDKFailureCode_TemporaryNodeFailure != NULL); + FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_RequiredNodeFeatureMissing", "Lorg/ldk/enums/FailureCode;"); + CHECK(FailureCode_LDKFailureCode_RequiredNodeFeatureMissing != NULL); + FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_IncorrectOrUnknownPaymentDetails", "Lorg/ldk/enums/FailureCode;"); + CHECK(FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails != NULL); +} +static inline jclass LDKFailureCode_to_java(JNIEnv *env, LDKFailureCode val) { + switch (val) { + case LDKFailureCode_TemporaryNodeFailure: + return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_TemporaryNodeFailure); + case LDKFailureCode_RequiredNodeFeatureMissing: + return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_RequiredNodeFeatureMissing); + case LDKFailureCode_IncorrectOrUnknownPaymentDetails: + return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails); + default: abort(); + } +} + static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) { jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { @@ -708,6 +721,46 @@ static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) { } } +static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKRetryableSendFailure_PaymentExpired; + case 1: return LDKRetryableSendFailure_RouteNotFound; + case 2: return LDKRetryableSendFailure_DuplicatePayment; + } + (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass RetryableSendFailure_class = NULL; +static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL; +static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL; +static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) { + RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz); + CHECK(RetryableSendFailure_class != NULL); + RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;"); + CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL); + RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;"); + CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL); + RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;"); + CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL); +} +static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) { + switch (val) { + case LDKRetryableSendFailure_PaymentExpired: + return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired); + case LDKRetryableSendFailure_RouteNotFound: + return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound); + case LDKRetryableSendFailure_DuplicatePayment: + return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment); + default: abort(); + } +} + static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) { jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { @@ -924,6 +977,40 @@ static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) { } } +static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKUtxoLookupError_UnknownChain; + case 1: return LDKUtxoLookupError_UnknownTx; + } + (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass UtxoLookupError_class = NULL; +static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL; +static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) { + UtxoLookupError_class = (*env)->NewGlobalRef(env, clz); + CHECK(UtxoLookupError_class != NULL); + UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;"); + CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL); + UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;"); + CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL); +} +static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) { + switch (val) { + case LDKUtxoLookupError_UnknownChain: + return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain); + case LDKUtxoLookupError_UnknownTx: + return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx); + default: abort(); + } +} + struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) { LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes }; return ret; @@ -1045,6 +1132,122 @@ uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPO return ret_conv; } +static jclass LDKAPIError_APIMisuseError_class = NULL; +static jmethodID LDKAPIError_APIMisuseError_meth = NULL; +static jclass LDKAPIError_FeeRateTooHigh_class = NULL; +static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL; +static jclass LDKAPIError_InvalidRoute_class = NULL; +static jmethodID LDKAPIError_InvalidRoute_meth = NULL; +static jclass LDKAPIError_ChannelUnavailable_class = NULL; +static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL; +static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL; +static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL; +static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL; +static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) { + LDKAPIError_APIMisuseError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError")); + CHECK(LDKAPIError_APIMisuseError_class != NULL); + LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKAPIError_APIMisuseError_meth != NULL); + LDKAPIError_FeeRateTooHigh_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh")); + CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); + LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(Ljava/lang/String;I)V"); + CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); + LDKAPIError_InvalidRoute_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute")); + CHECK(LDKAPIError_InvalidRoute_class != NULL); + LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKAPIError_InvalidRoute_meth != NULL); + LDKAPIError_ChannelUnavailable_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable")); + CHECK(LDKAPIError_ChannelUnavailable_class != NULL); + LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); + LDKAPIError_MonitorUpdateInProgress_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress")); + CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL); + LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "", "()V"); + CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL); + LDKAPIError_IncompatibleShutdownScript_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript")); + CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL); + LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "", "(J)V"); + CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + switch(obj->tag) { + case LDKAPIError_APIMisuseError: { + LDKStr err_str = obj->api_misuse_error.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv); + } + case LDKAPIError_FeeRateTooHigh: { + LDKStr err_str = obj->fee_rate_too_high.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + int32_t feerate_conv = obj->fee_rate_too_high.feerate; + return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv); + } + case LDKAPIError_InvalidRoute: { + LDKStr err_str = obj->invalid_route.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv); + } + case LDKAPIError_ChannelUnavailable: { + LDKStr err_str = obj->channel_unavailable.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv); + } + case LDKAPIError_MonitorUpdateInProgress: { + return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth); + } + case LDKAPIError_IncompatibleShutdownScript: { + LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; + int64_t script_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var); + script_ref = tag_ptr(script_var.inner, false); + return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref); + } + default: abort(); + } +} +static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); + CResult_NoneAPIErrorZ_get_ok(owner_conv); +} + +static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return APIError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); + LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); + *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { + LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); + } + return ret; +} +static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { + LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = APIError_clone(&orig->data[i]); + } + return ret; +} static jclass LDKCOption_HTLCClaimZ_Some_class = NULL; static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL; static jclass LDKCOption_HTLCClaimZ_None_class = NULL; @@ -2602,6 +2805,165 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDeco return ret_ref; } +static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL; +static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL; +static jclass LDKNetworkUpdate_ChannelFailure_class = NULL; +static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL; +static jclass LDKNetworkUpdate_NodeFailure_class = NULL; +static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) { + LDKNetworkUpdate_ChannelUpdateMessage_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage")); + CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL); + LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "", "(J)V"); + CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL); + LDKNetworkUpdate_ChannelFailure_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure")); + CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL); + LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "", "(JZ)V"); + CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL); + LDKNetworkUpdate_NodeFailure_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure")); + CHECK(LDKNetworkUpdate_NodeFailure_class != NULL); + LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "", "([BZ)V"); + CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + switch(obj->tag) { + case LDKNetworkUpdate_ChannelUpdateMessage: { + LDKChannelUpdate msg_var = obj->channel_update_message.msg; + int64_t msg_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, false); + return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref); + } + case LDKNetworkUpdate_ChannelFailure: { + int64_t short_channel_id_conv = obj->channel_failure.short_channel_id; + jboolean is_permanent_conv = obj->channel_failure.is_permanent; + return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv); + } + case LDKNetworkUpdate_NodeFailure: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form); + jboolean is_permanent_conv = obj->node_failure.is_permanent; + return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv); + } + default: abort(); + } +} +static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL; +static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL; +static jclass LDKCOption_NetworkUpdateZ_None_class = NULL; +static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) { + LDKCOption_NetworkUpdateZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some")); + CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL); + LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL); + LDKCOption_NetworkUpdateZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None")); + CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL); + LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "", "()V"); + CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_NetworkUpdateZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref); + } + case LDKCOption_NetworkUpdateZ_None: { + return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth); + } + default: abort(); + } +} +static jclass LDKPathFailure_InitialSend_class = NULL; +static jmethodID LDKPathFailure_InitialSend_meth = NULL; +static jclass LDKPathFailure_OnPath_class = NULL; +static jmethodID LDKPathFailure_OnPath_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) { + LDKPathFailure_InitialSend_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend")); + CHECK(LDKPathFailure_InitialSend_class != NULL); + LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "", "(J)V"); + CHECK(LDKPathFailure_InitialSend_meth != NULL); + LDKPathFailure_OnPath_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath")); + CHECK(LDKPathFailure_OnPath_class != NULL); + LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "", "(J)V"); + CHECK(LDKPathFailure_OnPath_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr); + switch(obj->tag) { + case LDKPathFailure_InitialSend: { + int64_t err_ref = tag_ptr(&obj->initial_send.err, false); + return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref); + } + case LDKPathFailure_OnPath: { + int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false); + return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref); + } + default: abort(); + } +} +static jclass LDKCOption_PathFailureZ_Some_class = NULL; +static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL; +static jclass LDKCOption_PathFailureZ_None_class = NULL; +static jmethodID LDKCOption_PathFailureZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) { + LDKCOption_PathFailureZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some")); + CHECK(LDKCOption_PathFailureZ_Some_class != NULL); + LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_PathFailureZ_Some_meth != NULL); + LDKCOption_PathFailureZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None")); + CHECK(LDKCOption_PathFailureZ_None_class != NULL); + LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "", "()V"); + CHECK(LDKCOption_PathFailureZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_PathFailureZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref); + } + case LDKCOption_PathFailureZ_None: { + return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth); + } + default: abort(); + } +} +static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_PathFailureZ_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL; static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL; static jclass LDKClosureReason_HolderForceClosed_class = NULL; @@ -2886,82 +3248,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u128Z_1ref_1fro default: abort(); } } -static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL; -static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL; -static jclass LDKNetworkUpdate_ChannelFailure_class = NULL; -static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL; -static jclass LDKNetworkUpdate_NodeFailure_class = NULL; -static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) { - LDKNetworkUpdate_ChannelUpdateMessage_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage")); - CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL); - LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "", "(J)V"); - CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL); - LDKNetworkUpdate_ChannelFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure")); - CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL); - LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "", "(JZ)V"); - CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL); - LDKNetworkUpdate_NodeFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure")); - CHECK(LDKNetworkUpdate_NodeFailure_class != NULL); - LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "", "([BZ)V"); - CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - switch(obj->tag) { - case LDKNetworkUpdate_ChannelUpdateMessage: { - LDKChannelUpdate msg_var = obj->channel_update_message.msg; - int64_t msg_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); - msg_ref = tag_ptr(msg_var.inner, false); - return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref); - } - case LDKNetworkUpdate_ChannelFailure: { - int64_t short_channel_id_conv = obj->channel_failure.short_channel_id; - jboolean is_permanent_conv = obj->channel_failure.is_permanent; - return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv); - } - case LDKNetworkUpdate_NodeFailure: { - int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form); - jboolean is_permanent_conv = obj->node_failure.is_permanent; - return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv); - } - default: abort(); - } -} -static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL; -static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL; -static jclass LDKCOption_NetworkUpdateZ_None_class = NULL; -static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) { - LDKCOption_NetworkUpdateZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some")); - CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL); - LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "", "(J)V"); - CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL); - LDKCOption_NetworkUpdateZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None")); - CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL); - LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "", "()V"); - CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); - switch(obj->tag) { - case LDKCOption_NetworkUpdateZ_Some: { - int64_t some_ref = tag_ptr(&obj->some, false); - return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref); - } - case LDKCOption_NetworkUpdateZ_None: { - return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth); - } - default: abort(); - } -} static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL; static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL; static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL; @@ -3090,7 +3376,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_PaymentPathFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); - LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); + LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); LDKEvent_ProbeSuccessful_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful")); @@ -3227,8 +3513,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data); jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently; - int64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false); - jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed; + int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false); LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path; int64_tArray path_arr = NULL; path_arr = (*env)->NewLongArray(env, path_var.datalen); @@ -3246,7 +3531,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int64_t retry_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var); retry_ref = tag_ptr(retry_var.inner, false); - return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, payment_failed_permanently_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref); + return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, payment_failed_permanently_conv, failure_ref, path_arr, short_channel_id_ref, retry_ref); } case LDKEvent_ProbeSuccessful: { int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); @@ -3536,6 +3821,8 @@ static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL; static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL; static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL; static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL; +static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL; +static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL; static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL; static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL; static jclass LDKMessageSendEvent_HandleError_class = NULL; @@ -3619,6 +3906,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL); LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "", "(J)V"); CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL); + LDKMessageSendEvent_BroadcastNodeAnnouncement_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement")); + CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL); + LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "", "(J)V"); + CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL); LDKMessageSendEvent_SendChannelUpdate_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate")); CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL); @@ -3783,6 +4075,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f msg_ref = tag_ptr(msg_var.inner, false); return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref); } + case LDKMessageSendEvent_BroadcastNodeAnnouncement: { + LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg; + int64_t msg_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, false); + return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref); + } case LDKMessageSendEvent_SendChannelUpdate: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form); @@ -3844,27 +4143,6 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return TxOut_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner); - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv); - return tag_ptr(ret_ref, true); -} - -static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return AccessError_clone(&*owner->contents.err); -} -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner); - jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv)); - return ret_conv; -} - static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){ return owner->a; } @@ -4117,6 +4395,77 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64 default: abort(); } } +static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){ + return owner->a; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_a(owner_conv).data); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){ + return owner->b; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_b(owner_conv).data); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){ + return owner->a; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_a(owner_conv).data); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){ + return owner->b; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_b(owner_conv).data); + return ret_arr; +} + +static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = NULL; +static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = NULL; +static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = NULL; +static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_init (JNIEnv *env, jclass clz) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$Some")); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class != NULL); + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth != NULL); + LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$None")); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class != NULL); + LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, "", "()V"); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: { + LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *some_conv = obj->some; + *some_conv = C2Tuple__u168_u168Z_clone(some_conv); + return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth, tag_ptr(some_conv, true)); + } + case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: { + return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth); + } + default: abort(); + } +} static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) { LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -4328,80 +4677,54 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDec return ret_ref; } -static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKChannelTypeFeatures ret = *owner->contents.result; +static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKBlindedHopFeatures ret = *owner->contents.result; ret.is_owned = false; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKOfferFeatures CResult_OfferFeaturesDecodeErrorZ_get_ok(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKOfferFeatures ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKOfferFeatures ret_var = CResult_OfferFeaturesDecodeErrorZ_get_ok(owner_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_OfferFeaturesDecodeErrorZ_get_err(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_OfferFeaturesDecodeErrorZ_get_err(owner_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKInvoiceRequestFeatures CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKInvoiceRequestFeatures ret = *owner->contents.result; +static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKChannelTypeFeatures ret = *owner->contents.result; ret.is_owned = false; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKInvoiceRequestFeatures ret_var = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -4456,14 +4779,70 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUp return ret_ref; } -typedef struct LDKAccess_JCalls { +static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return TxOut_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner); + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv); + return tag_ptr(ret_ref, true); +} + +static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return UtxoLookupError_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner); + jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static jclass LDKUtxoResult_Sync_class = NULL; +static jmethodID LDKUtxoResult_Sync_meth = NULL; +static jclass LDKUtxoResult_Async_class = NULL; +static jmethodID LDKUtxoResult_Async_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) { + LDKUtxoResult_Sync_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync")); + CHECK(LDKUtxoResult_Sync_class != NULL); + LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "", "(J)V"); + CHECK(LDKUtxoResult_Sync_meth != NULL); + LDKUtxoResult_Async_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async")); + CHECK(LDKUtxoResult_Async_class != NULL); + LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "", "(J)V"); + CHECK(LDKUtxoResult_Async_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr); + switch(obj->tag) { + case LDKUtxoResult_Sync: { + LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *sync_conv = obj->sync; + *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv); + return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true)); + } + case LDKUtxoResult_Async: { + LDKUtxoFuture async_var = obj->async; + int64_t async_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var); + async_ref = tag_ptr(async_var.inner, false); + return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref); + } + default: abort(); + } +} +typedef struct LDKUtxoLookup_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; jmethodID get_utxo_meth; -} LDKAccess_JCalls; -static void LDKAccess_JCalls_free(void* this_arg) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; +} LDKUtxoLookup_JCalls; +static void LDKUtxoLookup_JCalls_free(void* this_arg) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -4479,8 +4858,8 @@ static void LDKAccess_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; +LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_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) { @@ -4496,87 +4875,88 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception."); + (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr); + LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg; +static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls"); + LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J"); CHECK(calls->get_utxo_meth != NULL); - LDKAccess ret = { + LDKUtxoLookup ret = { .this_arg = (void*) calls, - .get_utxo = get_utxo_LDKAccess_jcall, - .free = LDKAccess_JCalls_free, + .get_utxo = get_utxo_LDKUtxoLookup_jcall, + .free = LDKUtxoLookup_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) { - LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess"); - *res_ptr = LDKAccess_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) { + LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup"); + *res_ptr = LDKUtxoLookup_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr; - unsigned char genesis_hash_arr[32]; + LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr; + uint8_t genesis_hash_arr[32]; CHECK((*env)->GetArrayLength(env, genesis_hash) == 32); (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr); - unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr; - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); - return tag_ptr(ret_conv, true); -} - -static jclass LDKCOption_AccessZ_Some_class = NULL; -static jmethodID LDKCOption_AccessZ_Some_meth = NULL; -static jclass LDKCOption_AccessZ_None_class = NULL; -static jmethodID LDKCOption_AccessZ_None_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) { - LDKCOption_AccessZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some")); - CHECK(LDKCOption_AccessZ_Some_class != NULL); - LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "", "(J)V"); - CHECK(LDKCOption_AccessZ_Some_meth != NULL); - LDKCOption_AccessZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None")); - CHECK(LDKCOption_AccessZ_None_class != NULL); - LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "", "()V"); - CHECK(LDKCOption_AccessZ_None_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr); + uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr; + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static jclass LDKCOption_UtxoLookupZ_Some_class = NULL; +static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL; +static jclass LDKCOption_UtxoLookupZ_None_class = NULL; +static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) { + LDKCOption_UtxoLookupZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some")); + CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL); + LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL); + LDKCOption_UtxoLookupZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None")); + CHECK(LDKCOption_UtxoLookupZ_None_class != NULL); + LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "", "()V"); + CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr); switch(obj->tag) { - case LDKCOption_AccessZ_Some: { - LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess"); + case LDKCOption_UtxoLookupZ_Some: { + LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup"); *some_ret = obj->some; // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances - if ((*some_ret).free == LDKAccess_JCalls_free) { + if ((*some_ret).free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&(*some_ret)); + LDKUtxoLookup_JCalls_cloned(&(*some_ret)); } - return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, tag_ptr(some_ret, true)); + return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true)); } - case LDKCOption_AccessZ_None: { - return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth); + case LDKCOption_UtxoLookupZ_None: { + return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth); } default: abort(); } @@ -5154,66 +5534,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1 CResult_SignatureNoneZ_get_err(owner_conv); } -static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){ - return owner->a; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form); - return ret_arr; -} - -static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){ - return owner->b; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form); - return ret_arr; -} - -static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv); - return tag_ptr(ret_conv, true); -} - -static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner); - CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv); -} - -static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes); - return ret_arr; -} - -static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner); - CResult_SecretKeyNoneZ_get_err(owner_conv); -} - static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -5283,7 +5603,27 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ge CResult_SharedSecretNoneZ_get_err(owner_conv); } -typedef struct LDKBaseSign_JCalls { +static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); + int8_tArray ret_arr = (*env)->NewByteArray(env, 68); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form); + return ret_arr; +} + +static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); + CResult_RecoverableSignatureNoneZ_get_err(owner_conv); +} + +typedef struct LDKChannelSigner_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; @@ -5291,19 +5631,10 @@ typedef struct LDKBaseSign_JCalls { jmethodID release_commitment_secret_meth; jmethodID validate_holder_commitment_meth; jmethodID channel_keys_id_meth; - jmethodID sign_counterparty_commitment_meth; - jmethodID validate_counterparty_revocation_meth; - jmethodID sign_holder_commitment_and_htlcs_meth; - jmethodID sign_justice_revoked_output_meth; - jmethodID sign_justice_revoked_htlc_meth; - jmethodID sign_counterparty_htlc_transaction_meth; - jmethodID sign_closing_transaction_meth; - jmethodID sign_holder_anchor_input_meth; - jmethodID sign_channel_announcement_meth; jmethodID provide_channel_parameters_meth; -} LDKBaseSign_JCalls; -static void LDKBaseSign_JCalls_free(void* this_arg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +} LDKChannelSigner_JCalls; +static void LDKChannelSigner_JCalls_free(void* this_arg) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -5319,8 +5650,8 @@ static void LDKBaseSign_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5334,7 +5665,7 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception."); } LDKPublicKey ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 33); @@ -5344,8 +5675,8 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui } return ret_ref; } -LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5359,7 +5690,7 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception."); } LDKThirtyTwoBytes ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 32); @@ -5369,8 +5700,8 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a } return ret_ref; } -LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5399,7 +5730,7 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5410,8 +5741,8 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th } return ret_conv; } -LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5424,7 +5755,7 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception."); } LDKThirtyTwoBytes ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 32); @@ -5434,8 +5765,188 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { } return ret_ref; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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); + } + LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; + int64_t channel_parameters_ref = 0; + channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); + channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} +static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B"); + CHECK(calls->get_per_commitment_point_meth != NULL); + calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B"); + CHECK(calls->release_commitment_secret_meth != NULL); + calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J"); + CHECK(calls->validate_holder_commitment_meth != NULL); + calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B"); + CHECK(calls->channel_keys_id_meth != NULL); + calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V"); + CHECK(calls->provide_channel_parameters_meth != NULL); + + LDKChannelPublicKeys pubkeys_conv; + pubkeys_conv.inner = untag_ptr(pubkeys); + pubkeys_conv.is_owned = ptr_is_owned(pubkeys); + CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); + + LDKChannelSigner ret = { + .this_arg = (void*) calls, + .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall, + .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall, + .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall, + .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall, + .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall, + .free = LDKChannelSigner_JCalls_free, + .pubkeys = pubkeys_conv, + .set_pubkeys = NULL, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { + LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner"); + *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKHolderCommitmentTransaction holder_tx_conv; + holder_tx_conv.inner = untag_ptr(holder_tx); + holder_tx_conv.is_owned = ptr_is_owned(holder_tx); + CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); + holder_tx_conv.is_owned = false; + LDKCVec_PaymentPreimageZ preimages_constr; + preimages_constr.datalen = (*env)->GetArrayLength(env, preimages); + if (preimages_constr.datalen > 0) + preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); + else + preimages_constr.data = NULL; + for (size_t i = 0; i < preimages_constr.datalen; i++) { + int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i); + LDKThirtyTwoBytes preimages_conv_8_ref; + CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32); + (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data); + preimages_constr.data[i] = preimages_conv_8_ref; + } + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKChannelTransactionParameters channel_parameters_conv; + channel_parameters_conv.inner = untag_ptr(channel_parameters); + channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv); + channel_parameters_conv.is_owned = false; + (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); +} + +LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) { + if (this_arg->set_pubkeys != NULL) + this_arg->set_pubkeys(this_arg); + return this_arg->pubkeys; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +typedef struct LDKEcdsaChannelSigner_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + LDKChannelSigner_JCalls* ChannelSigner; + jmethodID sign_counterparty_commitment_meth; + jmethodID validate_counterparty_revocation_meth; + jmethodID sign_holder_commitment_and_htlcs_meth; + jmethodID sign_justice_revoked_output_meth; + jmethodID sign_justice_revoked_htlc_meth; + jmethodID sign_counterparty_htlc_transaction_meth; + jmethodID sign_closing_transaction_meth; + jmethodID sign_holder_anchor_input_meth; + jmethodID sign_channel_announcement_with_funding_key_meth; +} LDKEcdsaChannelSigner_JCalls; +static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5464,7 +5975,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5475,8 +5986,8 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L } return ret_conv; } -LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5492,7 +6003,7 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const vo uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5503,8 +6014,8 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const vo } return ret_conv; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5522,7 +6033,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5533,8 +6044,8 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl } return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5555,7 +6066,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5566,8 +6077,8 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo } return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5593,7 +6104,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5604,8 +6115,8 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void } return ret_conv; } -LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5631,7 +6142,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5642,8 +6153,8 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c } return ret_conv; } -LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5661,7 +6172,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5672,8 +6183,8 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* } return ret_conv; } -LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5691,7 +6202,7 @@ LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5702,8 +6213,8 @@ LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* } return ret_conv; } -LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5718,60 +6229,32 @@ LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSig msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr); + LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -void provide_channel_parameters_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_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); - } - LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; - int64_t channel_parameters_ref = 0; - channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); - channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to provide_channel_parameters in LDKBaseSign from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } +static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release); } -static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { +static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls"); + LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B"); - CHECK(calls->get_per_commitment_point_meth != NULL); - calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B"); - CHECK(calls->release_commitment_secret_meth != NULL); - calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J"); - CHECK(calls->validate_holder_commitment_meth != NULL); - calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B"); - CHECK(calls->channel_keys_id_meth != NULL); calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J"); CHECK(calls->sign_counterparty_commitment_meth != NULL); calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J"); @@ -5788,101 +6271,44 @@ static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, CHECK(calls->sign_closing_transaction_meth != NULL); calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J"); CHECK(calls->sign_holder_anchor_input_meth != NULL); - calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J"); - CHECK(calls->sign_channel_announcement_meth != NULL); - calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V"); - CHECK(calls->provide_channel_parameters_meth != NULL); + calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J"); + CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL); LDKChannelPublicKeys pubkeys_conv; pubkeys_conv.inner = untag_ptr(pubkeys); pubkeys_conv.is_owned = ptr_is_owned(pubkeys); CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); - LDKBaseSign ret = { + LDKEcdsaChannelSigner ret = { .this_arg = (void*) calls, - .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall, - .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall, - .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall, - .channel_keys_id = channel_keys_id_LDKBaseSign_jcall, - .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall, - .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall, - .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall, - .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall, - .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall, - .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall, - .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall, - .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall, - .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall, - .provide_channel_parameters = provide_channel_parameters_LDKBaseSign_jcall, - .free = LDKBaseSign_JCalls_free, - .pubkeys = pubkeys_conv, - .set_pubkeys = NULL, + .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall, + .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall, + .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall, + .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall, + .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall, + .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall, + .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall, + .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall, + .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall, + .free = LDKEcdsaChannelSigner_JCalls_free, + .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys), }; + calls->ChannelSigner = ret.ChannelSigner.this_arg; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { - LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); - *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) { + LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner"); + *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys); return tag_ptr(res_ptr, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); - return ret_arr; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - LDKHolderCommitmentTransaction holder_tx_conv; - holder_tx_conv.inner = untag_ptr(holder_tx); - holder_tx_conv.is_owned = ptr_is_owned(holder_tx); - CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); - holder_tx_conv.is_owned = false; - LDKCVec_PaymentPreimageZ preimages_constr; - preimages_constr.datalen = (*env)->GetArrayLength(env, preimages); - if (preimages_constr.datalen > 0) - preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); - else - preimages_constr.data = NULL; - for (size_t i = 0; i < preimages_constr.datalen; i++) { - int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i); - LDKThirtyTwoBytes preimages_conv_8_ref; - CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32); - (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data); - preimages_constr.data[i] = preimages_conv_8_ref; - } - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data); - return ret_arr; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) { + LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg); + return tag_ptr(&inp->ChannelSigner, false); } - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = untag_ptr(commitment_tx); commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); @@ -5906,23 +6332,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterpart return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - unsigned char secret_arr[32]; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; + uint8_t secret_arr[32]; CHECK((*env)->GetArrayLength(env, secret) == 32); (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr); - unsigned char (*secret_ref)[32] = &secret_arr; + uint8_t (*secret_ref)[32] = &secret_arr; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKHolderCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = untag_ptr(commitment_tx); commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); @@ -5933,37 +6359,37 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1com return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx); justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data); justice_tx_ref.data_is_owned = true; - unsigned char per_commitment_key_arr[32]; + uint8_t per_commitment_key_arr[32]; CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32); (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr); - unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr; + uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr; LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx); justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data); justice_tx_ref.data_is_owned = true; - unsigned char per_commitment_key_arr[32]; + uint8_t per_commitment_key_arr[32]; CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32); (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr); - unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr; + uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr; LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = untag_ptr(htlc); htlc_conv.is_owned = ptr_is_owned(htlc); @@ -5974,10 +6400,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1re return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction htlc_tx_ref; htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx); htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes"); @@ -5996,10 +6422,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterpart return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKClosingTransaction closing_tx_conv; closing_tx_conv.inner = untag_ptr(closing_tx); closing_tx_conv.is_owned = ptr_is_owned(closing_tx); @@ -6010,10 +6436,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1tr return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction anchor_tx_ref; anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx); anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes"); @@ -6024,57 +6450,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1anc return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1channel_1announcement_1with_1funding_1key(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKUnsignedChannelAnnouncement msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv); + LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - LDKChannelTransactionParameters channel_parameters_conv; - channel_parameters_conv.inner = untag_ptr(channel_parameters); - channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); - CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv); - channel_parameters_conv.is_owned = false; - (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); -} - -LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) { - if (this_arg->set_pubkeys != NULL) - this_arg->set_pubkeys(this_arg); - return this_arg->pubkeys; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -typedef struct LDKSign_JCalls { +typedef struct LDKWriteableEcdsaChannelSigner_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; - LDKBaseSign_JCalls* BaseSign; + LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner; + LDKChannelSigner_JCalls* ChannelSigner; jmethodID write_meth; -} LDKSign_JCalls; -static void LDKSign_JCalls_free(void* this_arg) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; +} LDKWriteableEcdsaChannelSigner_JCalls; +static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -6090,8 +6489,8 @@ static void LDKSign_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; +LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_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) { @@ -6104,7 +6503,7 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception."); + (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception."); } LDKCVec_u8Z ret_ref; ret_ref.datalen = (*env)->GetArrayLength(env, ret); @@ -6115,15 +6514,16 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { } return ret_ref; } -static void LDKSign_JCalls_cloned(LDKSign* new_obj) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg; +static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); - atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release); } -static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) { +static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls"); + LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); @@ -6135,29 +6535,34 @@ static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject pubkeys_conv.is_owned = ptr_is_owned(pubkeys); CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); - LDKSign ret = { + LDKWriteableEcdsaChannelSigner ret = { .this_arg = (void*) calls, - .write = write_LDKSign_jcall, - .cloned = LDKSign_JCalls_cloned, - .free = LDKSign_JCalls_free, - .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys), + .write = write_LDKWriteableEcdsaChannelSigner_jcall, + .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned, + .free = LDKWriteableEcdsaChannelSigner_JCalls_free, + .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys), }; - calls->BaseSign = ret.BaseSign.this_arg; + calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg; + calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) { - LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign"); - *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) { + LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) { - LDKSign *inp = (LDKSign *)untag_ptr(arg); - return tag_ptr(&inp->BaseSign, false); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) { + LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg); + return tag_ptr(&inp->EcdsaChannelSigner, false); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) { + LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg); + return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr; + LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr; LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); @@ -6165,49 +6570,29 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env return ret_arr; } -static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return Sign_clone(&*owner->contents.result); + return WriteableEcdsaChannelSigner_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner); - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv); return tag_ptr(ret_ret, true); } -static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 68); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form); - return ret_arr; -} - -static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); - CResult_RecoverableSignatureNoneZ_get_err(owner_conv); -} - static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) { LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -6390,122 +6775,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from default: abort(); } } -static jclass LDKAPIError_APIMisuseError_class = NULL; -static jmethodID LDKAPIError_APIMisuseError_meth = NULL; -static jclass LDKAPIError_FeeRateTooHigh_class = NULL; -static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL; -static jclass LDKAPIError_InvalidRoute_class = NULL; -static jmethodID LDKAPIError_InvalidRoute_meth = NULL; -static jclass LDKAPIError_ChannelUnavailable_class = NULL; -static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL; -static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL; -static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL; -static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL; -static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) { - LDKAPIError_APIMisuseError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError")); - CHECK(LDKAPIError_APIMisuseError_class != NULL); - LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(Ljava/lang/String;)V"); - CHECK(LDKAPIError_APIMisuseError_meth != NULL); - LDKAPIError_FeeRateTooHigh_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh")); - CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); - LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(Ljava/lang/String;I)V"); - CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); - LDKAPIError_InvalidRoute_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute")); - CHECK(LDKAPIError_InvalidRoute_class != NULL); - LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "", "(Ljava/lang/String;)V"); - CHECK(LDKAPIError_InvalidRoute_meth != NULL); - LDKAPIError_ChannelUnavailable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable")); - CHECK(LDKAPIError_ChannelUnavailable_class != NULL); - LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(Ljava/lang/String;)V"); - CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); - LDKAPIError_MonitorUpdateInProgress_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress")); - CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL); - LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "", "()V"); - CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL); - LDKAPIError_IncompatibleShutdownScript_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript")); - CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL); - LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "", "(J)V"); - CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - switch(obj->tag) { - case LDKAPIError_APIMisuseError: { - LDKStr err_str = obj->api_misuse_error.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv); - } - case LDKAPIError_FeeRateTooHigh: { - LDKStr err_str = obj->fee_rate_too_high.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - int32_t feerate_conv = obj->fee_rate_too_high.feerate; - return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv); - } - case LDKAPIError_InvalidRoute: { - LDKStr err_str = obj->invalid_route.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv); - } - case LDKAPIError_ChannelUnavailable: { - LDKStr err_str = obj->channel_unavailable.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv); - } - case LDKAPIError_MonitorUpdateInProgress: { - return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth); - } - case LDKAPIError_IncompatibleShutdownScript: { - LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; - int64_t script_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var); - script_ref = tag_ptr(script_var.inner, false); - return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref); - } - default: abort(); - } -} -static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); - CResult_NoneAPIErrorZ_get_ok(owner_conv); -} - -static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return APIError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); - LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); - *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { - LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); - } - return ret; -} -static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { - LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = APIError_clone(&orig->data[i]); - } - return ret; -} static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return ThirtyTwoBytes_clone(&*owner->contents.result); @@ -6529,6 +6798,58 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1g return ret_ref; } +static jclass LDKRecentPaymentDetails_Pending_class = NULL; +static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL; +static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL; +static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL; +static jclass LDKRecentPaymentDetails_Abandoned_class = NULL; +static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) { + LDKRecentPaymentDetails_Pending_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending")); + CHECK(LDKRecentPaymentDetails_Pending_class != NULL); + LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "", "([BJ)V"); + CHECK(LDKRecentPaymentDetails_Pending_meth != NULL); + LDKRecentPaymentDetails_Fulfilled_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled")); + CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL); + LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "", "([B)V"); + CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL); + LDKRecentPaymentDetails_Abandoned_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned")); + CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL); + LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "", "([B)V"); + CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + switch(obj->tag) { + case LDKRecentPaymentDetails_Pending: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data); + int64_t total_msat_conv = obj->pending.total_msat; + return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_hash_arr, total_msat_conv); + } + case LDKRecentPaymentDetails_Fulfilled: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->fulfilled.payment_hash.data); + return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_hash_arr); + } + case LDKRecentPaymentDetails_Abandoned: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data); + return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_hash_arr); + } + default: abort(); + } +} +static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) { + LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]); + } + return ret; +} static jclass LDKPaymentSendFailure_ParameterError_class = NULL; static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL; static jclass LDKPaymentSendFailure_PathParameterError_class = NULL; @@ -6646,6 +6967,25 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai return ret_ref; } +static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner); + CResult_NoneRetryableSendFailureZ_get_ok(owner_conv); +} + +static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return RetryableSendFailure_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner); + jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return ThirtyTwoBytes_clone(&*owner->contents.result); @@ -6669,6 +7009,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPayment return ret_ref; } +static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ThirtyTwoBytes_clone(&*owner->contents.result); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data); + return ret_arr; +} + +static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return RetryableSendFailure_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner); + jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){ return ThirtyTwoBytes_clone(&owner->a); } @@ -7014,7 +7375,7 @@ LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, } return ret_conv; } -LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { +LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) { 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); @@ -7027,8 +7388,9 @@ LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg int64_t funding_txo_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var); funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned); - LDKChannelMonitorUpdate update_var = update; + LDKChannelMonitorUpdate update_var = *update; int64_t update_ref = 0; + update_var = ChannelMonitorUpdate_clone(&update_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); update_ref = tag_ptr(update_var.inner, update_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); @@ -7144,8 +7506,8 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEn update_conv.inner = untag_ptr(update); update_conv.is_owned = ptr_is_owned(update); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv); - update_conv = ChannelMonitorUpdate_clone(&update_conv); - jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv)); + update_conv.is_owned = false; + jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv)); return ret_conv; } @@ -7252,24 +7614,150 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcas (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref); } -typedef struct LDKKeysInterface_JCalls { +typedef struct LDKEntropySource_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; - jmethodID get_node_secret_meth; + jmethodID get_secure_random_bytes_meth; +} LDKEntropySource_JCalls; +static void LDKEntropySource_JCalls_free(void* this_arg) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_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); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception."); + } + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_ref; +} +static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B"); + CHECK(calls->get_secure_random_bytes_meth != NULL); + + LDKEntropySource ret = { + .this_arg = (void*) calls, + .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall, + .free = LDKEntropySource_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) { + LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *res_ptr = LDKEntropySource_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); + return ret_arr; +} + +static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL; +static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL; +static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL; +static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL; +static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL; +static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) { + LDKUnsignedGossipMessage_ChannelAnnouncement_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement")); + CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL); + LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "", "(J)V"); + CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL); + LDKUnsignedGossipMessage_ChannelUpdate_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate")); + CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL); + LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "", "(J)V"); + CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL); + LDKUnsignedGossipMessage_NodeAnnouncement_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement")); + CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL); + LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "", "(J)V"); + CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr); + switch(obj->tag) { + case LDKUnsignedGossipMessage_ChannelAnnouncement: { + LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement; + int64_t channel_announcement_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var); + channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false); + return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref); + } + case LDKUnsignedGossipMessage_ChannelUpdate: { + LDKUnsignedChannelUpdate channel_update_var = obj->channel_update; + int64_t channel_update_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var); + channel_update_ref = tag_ptr(channel_update_var.inner, false); + return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref); + } + case LDKUnsignedGossipMessage_NodeAnnouncement: { + LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement; + int64_t node_announcement_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var); + node_announcement_ref = tag_ptr(node_announcement_var.inner, false); + return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref); + } + default: abort(); + } +} +typedef struct LDKNodeSigner_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID get_inbound_payment_key_material_meth; jmethodID get_node_id_meth; jmethodID ecdh_meth; - jmethodID get_destination_script_meth; - jmethodID get_shutdown_scriptpubkey_meth; - jmethodID generate_channel_keys_id_meth; - jmethodID derive_channel_signer_meth; - jmethodID get_secure_random_bytes_meth; - jmethodID read_chan_signer_meth; jmethodID sign_invoice_meth; - jmethodID get_inbound_payment_key_material_meth; -} LDKKeysInterface_JCalls; -static void LDKKeysInterface_JCalls_free(void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + jmethodID sign_gossip_message_meth; +} LDKNodeSigner_JCalls; +static void LDKNodeSigner_JCalls_free(void* this_arg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -7285,8 +7773,8 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7294,25 +7782,23 @@ LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* thi } else { DO_ASSERT(get_jenv_res == JNI_OK); } - jclass recipient_conv = LDKRecipient_to_java(env, recipient); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception."); } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr); - FREE(untag_ptr(ret)); + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_conv; + return ret_ref; } -LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7326,7 +7812,7 @@ LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_ar uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_node_id in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -7337,8 +7823,8 @@ LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_ar } return ret_conv; } -LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7357,7 +7843,7 @@ LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, L uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to ecdh in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -7368,8 +7854,8 @@ LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, L } return ret_conv; } -LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7377,24 +7863,38 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKu8slice hrp_bytes_var = hrp_bytes; + int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen); + (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data); + LDKCVec_U5Z invoice_data_var = invoice_data; + jobjectArray invoice_data_arr = NULL; + invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen); + int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL); + for (size_t h = 0; h < invoice_data_var.datalen; h++) { + uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0; + invoice_data_arr_ptr[h] = invoice_data_conv_7_val; + } + (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0); + FREE(invoice_data_var.data); + jclass recipient_conv = LDKRecipient_to_java(env, recipient); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception."); } - LDKCVec_u8Z ret_ref; - ret_ref.datalen = (*env)->GetArrayLength(env, ret); - ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr); + FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_ref; + return ret_conv; } -LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7402,24 +7902,168 @@ LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* t } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *msg_copy = msg; + int64_t msg_ref = tag_ptr(msg_copy, true); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception."); } - LDKShutdownScript ret_conv; - ret_conv.inner = untag_ptr(ret); - ret_conv.is_owned = ptr_is_owned(ret); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); + FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B"); + CHECK(calls->get_inbound_payment_key_material_meth != NULL); + calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J"); + CHECK(calls->get_node_id_meth != NULL); + calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J"); + CHECK(calls->ecdh_meth != NULL); + calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J"); + CHECK(calls->sign_invoice_meth != NULL); + calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J"); + CHECK(calls->sign_gossip_message_meth != NULL); + + LDKNodeSigner ret = { + .this_arg = (void*) calls, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall, + .get_node_id = get_node_id_LDKNodeSigner_jcall, + .ecdh = ecdh_LDKNodeSigner_jcall, + .sign_invoice = sign_invoice_LDKNodeSigner_jcall, + .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall, + .free = LDKNodeSigner_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) { + LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *res_ptr = LDKNodeSigner_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); + LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ"); + *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); + LDKPublicKey other_key_ref; + CHECK((*env)->GetArrayLength(env, other_key) == 33); + (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form); + void* tweak_ptr = untag_ptr(tweak); + CHECK_ACCESS(tweak_ptr); + LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ + LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); + *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass recipient) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKu8slice hrp_bytes_ref; + hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes); + hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL); + LDKCVec_U5Z invoice_data_constr; + invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data); + if (invoice_data_constr.datalen > 0) + invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); + else + invoice_data_constr.data = NULL; + int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL); + for (size_t h = 0; h < invoice_data_constr.datalen; h++) { + int8_t invoice_data_conv_7 = invoice_data_vals[h]; + + invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 }; + } + (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0); + LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); + LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv); + (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + void* msg_ptr = untag_ptr(msg); + CHECK_ACCESS(msg_ptr); + LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr); + msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg)); + LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv); + return tag_ptr(ret_conv, true); +} + +typedef struct LDKSignerProvider_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID generate_channel_keys_id_meth; + jmethodID derive_channel_signer_meth; + jmethodID read_chan_signer_meth; + jmethodID get_destination_script_meth; + jmethodID get_shutdown_scriptpubkey_meth; +} LDKSignerProvider_JCalls; +static void LDKSignerProvider_JCalls_free(void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7436,7 +8080,7 @@ LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* th int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception."); } LDKThirtyTwoBytes ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 32); @@ -7446,8 +8090,8 @@ LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* th } return ret_ref; } -LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7463,43 +8107,19 @@ LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint6 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to derive_channel_signer in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKSign ret_conv = *(LDKSign*)(ret_ptr); + LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception."); - } - LDKThirtyTwoBytes ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 32); - (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_ref; -} -LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7515,19 +8135,19 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient receipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7535,38 +8155,24 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKu8slice hrp_bytes_var = hrp_bytes; - int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen); - (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data); - LDKCVec_U5Z invoice_data_var = invoice_data; - jobjectArray invoice_data_arr = NULL; - invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen); - int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL); - for (size_t h = 0; h < invoice_data_var.datalen; h++) { - uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0; - invoice_data_arr_ptr[h] = invoice_data_conv_7_val; - } - (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0); - FREE(invoice_data_var.data); - jclass receipient_conv = LDKRecipient_to_java(env, receipient); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception."); } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr); - FREE(untag_ptr(ret)); + LDKCVec_u8Z ret_ref; + ret_ref.datalen = (*env)->GetArrayLength(env, ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_conv; + return ret_ref; } -LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7576,138 +8182,62 @@ LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception."); } - LDKThirtyTwoBytes ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 32); - (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + LDKShutdownScript ret_conv; + ret_conv.inner = untag_ptr(ret); + ret_conv.is_owned = ptr_is_owned(ret); + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_ref; + return ret_conv; } -static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; +static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls"); + LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J"); - CHECK(calls->get_node_secret_meth != NULL); - calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J"); - CHECK(calls->get_node_id_meth != NULL); - calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J"); - CHECK(calls->ecdh_meth != NULL); - calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B"); - CHECK(calls->get_destination_script_meth != NULL); - calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J"); - CHECK(calls->get_shutdown_scriptpubkey_meth != NULL); calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B"); CHECK(calls->generate_channel_keys_id_meth != NULL); calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J"); CHECK(calls->derive_channel_signer_meth != NULL); - calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B"); - CHECK(calls->get_secure_random_bytes_meth != NULL); calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J"); CHECK(calls->read_chan_signer_meth != NULL); - calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J"); - CHECK(calls->sign_invoice_meth != NULL); - calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B"); - CHECK(calls->get_inbound_payment_key_material_meth != NULL); + calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B"); + CHECK(calls->get_destination_script_meth != NULL); + calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J"); + CHECK(calls->get_shutdown_scriptpubkey_meth != NULL); - LDKKeysInterface ret = { + LDKSignerProvider ret = { .this_arg = (void*) calls, - .get_node_secret = get_node_secret_LDKKeysInterface_jcall, - .get_node_id = get_node_id_LDKKeysInterface_jcall, - .ecdh = ecdh_LDKKeysInterface_jcall, - .get_destination_script = get_destination_script_LDKKeysInterface_jcall, - .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall, - .generate_channel_keys_id = generate_channel_keys_id_LDKKeysInterface_jcall, - .derive_channel_signer = derive_channel_signer_LDKKeysInterface_jcall, - .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, - .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, - .sign_invoice = sign_invoice_LDKKeysInterface_jcall, - .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, - .free = LDKKeysInterface_JCalls_free, + .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall, + .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall, + .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall, + .get_destination_script = get_destination_script_LDKSignerProvider_jcall, + .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall, + .free = LDKSignerProvider_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) { - LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *res_ptr = LDKKeysInterface_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) { + LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *res_ptr = LDKSignerProvider_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); - LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ"); - *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); - LDKPublicKey other_key_ref; - CHECK((*env)->GetArrayLength(env, other_key) == 33); - (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form); - void* tweak_ptr = untag_ptr(tweak); - CHECK_ACCESS(tweak_ptr); - LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ - LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); - *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); - 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_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKU128 user_channel_id_ref; CHECK((*env)->GetArrayLength(env, user_channel_id) == 16); (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes); @@ -7716,74 +8246,51 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1generate return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKThirtyTwoBytes channel_keys_id_ref; CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data); - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref); return tag_ptr(ret_ret, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKu8slice reader_ref; reader_ref.datalen = (*env)->GetArrayLength(env, reader); reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref); (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass receipient) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKu8slice hrp_bytes_ref; - hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes); - hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL); - LDKCVec_U5Z invoice_data_constr; - invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data); - if (invoice_data_constr.datalen > 0) - invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); - else - invoice_data_constr.data = NULL; - int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL); - for (size_t h = 0; h < invoice_data_constr.datalen; h++) { - int8_t invoice_data_conv_7 = invoice_data_vals[h]; - - invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 }; - } - (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0); - LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient); - LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ"); - *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv); - (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0); - return tag_ptr(ret_conv, true); + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; + LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); + 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 int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data); - return ret_arr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; + LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } typedef struct LDKFeeEstimator_JCalls { @@ -7866,6 +8373,261 @@ JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat return ret_conv; } +typedef struct LDKRouter_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID find_route_meth; + jmethodID find_route_with_id_meth; +} LDKRouter_JCalls; +static void LDKRouter_JCalls_free(void* this_arg) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) { + LDKRouter_JCalls *j_calls = (LDKRouter_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); + } + int8_tArray payer_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); + LDKRouteParameters route_params_var = *route_params; + int64_t route_params_ref = 0; + route_params_var = RouteParameters_clone(&route_params_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); + LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; + int64_tArray first_hops_arr = NULL; + if (first_hops != NULL) { + LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; + first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); + int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); + for (size_t q = 0; q < first_hops_var.datalen; q++) { + LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; + int64_t first_hops_conv_16_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); + first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); + first_hops_arr_ptr[q] = first_hops_conv_16_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); + } + LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs; + int64_t inflight_htlcs_ref = 0; + inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); + inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); + } + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); + FREE(untag_ptr(ret)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) { + LDKRouter_JCalls *j_calls = (LDKRouter_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); + } + int8_tArray payer_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); + LDKRouteParameters route_params_var = *route_params; + int64_t route_params_ref = 0; + route_params_var = RouteParameters_clone(&route_params_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); + LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; + int64_tArray first_hops_arr = NULL; + if (first_hops != NULL) { + LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; + first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); + int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); + for (size_t q = 0; q < first_hops_var.datalen; q++) { + LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; + int64_t first_hops_conv_16_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); + first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); + first_hops_arr_ptr[q] = first_hops_conv_16_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); + } + LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs; + int64_t inflight_htlcs_ref = 0; + inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); + inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); + int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data); + int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception."); + } + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); + FREE(untag_ptr(ret)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); + CHECK(calls->find_route_meth != NULL); + calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J"); + CHECK(calls->find_route_with_id_meth != NULL); + + LDKRouter ret = { + .this_arg = (void*) calls, + .find_route = find_route_LDKRouter_jcall, + .find_route_with_id = find_route_with_id_LDKRouter_jcall, + .free = LDKRouter_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) { + LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); + *res_ptr = LDKRouter_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; + LDKPublicKey payer_ref; + CHECK((*env)->GetArrayLength(env, payer) == 33); + (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv.is_owned = false; + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); + first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); + first_hops_conv_16_conv.is_owned = false; + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKInFlightHtlcs inflight_htlcs_conv; + inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); + inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); + inflight_htlcs_conv.is_owned = false; + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; + LDKPublicKey payer_ref; + CHECK((*env)->GetArrayLength(env, payer) == 33); + (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv.is_owned = false; + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); + first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); + first_hops_conv_16_conv.is_owned = false; + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKInFlightHtlcs inflight_htlcs_conv; + inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); + inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); + inflight_htlcs_conv.is_owned = false; + LDKThirtyTwoBytes _payment_hash_ref; + CHECK((*env)->GetArrayLength(env, _payment_hash) == 32); + (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data); + LDKThirtyTwoBytes _payment_id_ref; + CHECK((*env)->GetArrayLength(env, _payment_id) == 32); + (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return tag_ptr(ret_conv, true); +} + static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ return ThirtyTwoBytes_clone(&owner->a); } @@ -7938,6 +8700,59 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecod return ret_ref; } +static jclass LDKCOption_APIErrorZ_Some_class = NULL; +static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL; +static jclass LDKCOption_APIErrorZ_None_class = NULL; +static jmethodID LDKCOption_APIErrorZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) { + LDKCOption_APIErrorZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some")); + CHECK(LDKCOption_APIErrorZ_Some_class != NULL); + LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_APIErrorZ_Some_meth != NULL); + LDKCOption_APIErrorZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None")); + CHECK(LDKCOption_APIErrorZ_None_class != NULL); + LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "", "()V"); + CHECK(LDKCOption_APIErrorZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_APIErrorZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref); + } + case LDKCOption_APIErrorZ_None: { + return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth); + } + default: abort(); + } +} +static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_APIErrorZ_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){ LDKOutPoint ret = *owner->contents.result; ret.is_owned = false; @@ -8175,8 +8990,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDeco static jclass LDKPaymentError_Invoice_class = NULL; static jmethodID LDKPaymentError_Invoice_meth = NULL; -static jclass LDKPaymentError_Routing_class = NULL; -static jmethodID LDKPaymentError_Routing_meth = NULL; static jclass LDKPaymentError_Sending_class = NULL; static jmethodID LDKPaymentError_Sending_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) { @@ -8185,15 +8998,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNI CHECK(LDKPaymentError_Invoice_class != NULL); LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "", "(Ljava/lang/String;)V"); CHECK(LDKPaymentError_Invoice_meth != NULL); - LDKPaymentError_Routing_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing")); - CHECK(LDKPaymentError_Routing_class != NULL); - LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "", "(J)V"); - CHECK(LDKPaymentError_Routing_meth != NULL); LDKPaymentError_Sending_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending")); CHECK(LDKPaymentError_Sending_class != NULL); - LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(J)V"); + LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(Lorg/ldk/enums/RetryableSendFailure;)V"); CHECK(LDKPaymentError_Sending_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { @@ -8204,16 +9012,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_ jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len); return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv); } - case LDKPaymentError_Routing: { - LDKLightningError routing_var = obj->routing; - int64_t routing_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var); - routing_ref = tag_ptr(routing_var.inner, false); - return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref); - } case LDKPaymentError_Sending: { - int64_t sending_ref = tag_ptr(&obj->sending, false); - return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref); + jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending); + return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv); } default: abort(); } @@ -8905,6 +9706,34 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1re default: abort(); } } +static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){ + return owner->a; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form); + return ret_arr; +} + +static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){ + return COption_NetAddressZ_clone(&owner->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) { + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]); + } + return ret; +} static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return CVec_u8Z_clone(&*owner->contents.result); @@ -10730,10 +11559,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *e void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK((*env)->GetArrayLength(env, txid) == 32); (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; LDKu8slice script_pubkey_ref; script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey); script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL); @@ -11632,10 +12461,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1filtered_1block_1conne void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -11670,10 +12499,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JN void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height); } @@ -11858,10 +12687,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirm void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -11885,10 +12714,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfir void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK((*env)->GetArrayLength(env, txid) == 32); (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref); } @@ -11896,10 +12725,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated( void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height); } @@ -11980,7 +12809,7 @@ LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* t } return ret_conv; } -LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { +LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -11993,9 +12822,8 @@ LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const vo int64_t channel_id_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var); channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned); - LDKChannelMonitorUpdate update_var = *update; + LDKChannelMonitorUpdate update_var = update; int64_t update_ref = 0; - update_var = ChannelMonitorUpdate_clone(&update_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); update_ref = tag_ptr(update_var.inner, update_var.is_owned); LDKChannelMonitor data_var = *data; @@ -12085,7 +12913,7 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1 update_conv.inner = untag_ptr(update); update_conv.is_owned = ptr_is_owned(update); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv); - update_conv.is_owned = false; + update_conv = ChannelMonitorUpdate_clone(&update_conv); LDKChannelMonitor data_conv; data_conv.inner = untag_ptr(data); data_conv.is_owned = ptr_is_owned(data); @@ -12096,10 +12924,40 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1 update_id_conv.is_owned = ptr_is_owned(update_id); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv); update_id_conv = MonitorUpdateId_clone(&update_id_conv); - jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv)); + jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv)); return ret_conv; } +static jclass LDKRetry_Attempts_class = NULL; +static jmethodID LDKRetry_Attempts_meth = NULL; +static jclass LDKRetry_Timeout_class = NULL; +static jmethodID LDKRetry_Timeout_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) { + LDKRetry_Attempts_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts")); + CHECK(LDKRetry_Attempts_class != NULL); + LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "", "(J)V"); + CHECK(LDKRetry_Attempts_meth != NULL); + LDKRetry_Timeout_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout")); + CHECK(LDKRetry_Timeout_class != NULL); + LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "", "(J)V"); + CHECK(LDKRetry_Timeout_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); + switch(obj->tag) { + case LDKRetry_Attempts: { + int64_t attempts_conv = obj->attempts; + return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv); + } + case LDKRetry_Timeout: { + int64_t timeout_conv = obj->timeout; + return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv); + } + default: abort(); + } +} typedef struct LDKChannelMessageHandler_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -12145,7 +13003,7 @@ static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { +void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12156,10 +13014,6 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - LDKInitFeatures their_features_var = their_features; - int64_t their_features_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKOpenChannel msg_var = *msg; int64_t msg_ref = 0; msg_var = OpenChannel_clone(&msg_var); @@ -12167,7 +13021,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref); + (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception."); @@ -12176,7 +13030,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { +void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12187,10 +13041,6 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - LDKInitFeatures their_features_var = their_features; - int64_t their_features_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKAcceptChannel msg_var = *msg; int64_t msg_ref = 0; msg_var = AcceptChannel_clone(&msg_var); @@ -12198,7 +13048,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref); + (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception."); @@ -12288,7 +13138,7 @@ void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, L DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { +void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12299,11 +13149,6 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - LDKInitFeatures their_features_var = *their_features; - int64_t their_features_ref = 0; - their_features_var = InitFeatures_clone(&their_features_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKShutdown msg_var = *msg; int64_t msg_ref = 0; msg_var = Shutdown_clone(&msg_var); @@ -12311,7 +13156,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); + (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception."); @@ -12563,7 +13408,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12574,10 +13419,9 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jboolean no_connection_possible_conv = no_connection_possible; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv); + (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception."); @@ -12586,7 +13430,7 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { +LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12602,9 +13446,10 @@ LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* t msg_var = Init_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); + jboolean inbound_conv = inbound; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception."); @@ -12763,9 +13608,9 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V"); + calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V"); CHECK(calls->handle_open_channel_meth != NULL); - calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V"); + calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V"); CHECK(calls->handle_accept_channel_meth != NULL); calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V"); CHECK(calls->handle_funding_created_meth != NULL); @@ -12773,7 +13618,7 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->handle_funding_signed_meth != NULL); calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V"); CHECK(calls->handle_channel_ready_meth != NULL); - calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V"); + calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V"); CHECK(calls->handle_shutdown_meth != NULL); calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V"); CHECK(calls->handle_closing_signed_meth != NULL); @@ -12793,9 +13638,9 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->handle_update_fee_meth != NULL); calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V"); CHECK(calls->handle_announcement_signatures_meth != NULL); - calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V"); + calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V"); CHECK(calls->peer_disconnected_meth != NULL); - calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)J"); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V"); CHECK(calls->handle_channel_reestablish_meth != NULL); @@ -12847,44 +13692,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1g LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg); return tag_ptr(&inp->MessageSendEventsProvider, false); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv = InitFeatures_clone(&their_features_conv); LDKOpenChannel msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv = InitFeatures_clone(&their_features_conv); LDKAcceptChannel msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -12932,24 +13767,19 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv.is_owned = false; LDKShutdown msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv); + (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -13087,17 +13917,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); + (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; @@ -13110,7 +13940,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound); return tag_ptr(ret_conv, true); } @@ -13199,6 +14029,7 @@ typedef struct LDKRoutingMessageHandler_JCalls { jmethodID handle_reply_short_channel_ids_end_meth; jmethodID handle_query_channel_range_meth; jmethodID handle_query_short_channel_ids_meth; + jmethodID processing_queue_high_meth; jmethodID provided_node_features_meth; jmethodID provided_init_features_meth; } LDKRoutingMessageHandler_JCalls; @@ -13335,7 +14166,7 @@ LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_chan } return ret_conv; } -LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) { +LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13344,11 +14175,13 @@ LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(co } else { DO_ASSERT(get_jenv_res == JNI_OK); } - int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form); + LDKNodeId starting_point_var = starting_point; + int64_t starting_point_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var); + starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_arr); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception."); @@ -13362,7 +14195,7 @@ LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(co } return ret_conv; } -LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13378,9 +14211,10 @@ LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* t init_var = Init_clone(&init_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); init_ref = tag_ptr(init_var.inner, init_var.is_owned); + jboolean inbound_conv = inbound; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception."); @@ -13518,6 +14352,27 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH } return ret_conv; } +bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret; +} LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; @@ -13590,9 +14445,9 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en CHECK(calls->handle_channel_update_meth != NULL); calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J"); CHECK(calls->get_next_channel_announcement_meth != NULL); - calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "([B)J"); + calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J"); CHECK(calls->get_next_node_announcement_meth != NULL); - calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)J"); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J"); CHECK(calls->handle_reply_channel_range_meth != NULL); @@ -13602,6 +14457,8 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en CHECK(calls->handle_query_channel_range_meth != NULL); calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J"); CHECK(calls->handle_query_short_channel_ids_meth != NULL); + calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z"); + CHECK(calls->processing_queue_high_meth != NULL); calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J"); CHECK(calls->provided_node_features_meth != NULL); calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J"); @@ -13619,6 +14476,7 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall, + .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall, .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall, .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall, .free = LDKRoutingMessageHandler_JCalls_free, @@ -13688,21 +14546,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_ return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; - LDKPublicKey starting_point_ref; - CHECK((*env)->GetArrayLength(env, starting_point) == 33); - (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form); - LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref); + LDKNodeId starting_point_conv; + starting_point_conv.inner = untag_ptr(starting_point); + starting_point_conv.is_owned = ptr_is_owned(starting_point); + CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv); + starting_point_conv = NodeId_clone(&starting_point_conv); + LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; @@ -13715,7 +14575,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); init_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound); return tag_ptr(ret_conv, true); } @@ -13787,6 +14647,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1hand return tag_ptr(ret_conv, true); } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; + jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } @@ -13867,7 +14735,7 @@ void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDK DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13883,9 +14751,10 @@ LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* thi init_var = Init_clone(&init_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); init_ref = tag_ptr(init_var.inner, init_var.is_owned); + jboolean inbound_conv = inbound; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception."); @@ -13899,7 +14768,7 @@ LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* thi } return ret_conv; } -void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13910,10 +14779,9 @@ void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPub } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jboolean no_connection_possible_conv = no_connection_possible; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv); + (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception."); @@ -13988,9 +14856,9 @@ static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, j calls->o = (*env)->NewWeakGlobalRef(env, o); calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V"); CHECK(calls->handle_onion_message_meth != NULL); - calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)J"); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); - calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V"); + calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V"); CHECK(calls->peer_disconnected_meth != NULL); calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J"); CHECK(calls->provided_node_features_meth != NULL); @@ -14034,7 +14902,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1o (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; @@ -14047,18 +14915,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); init_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound); return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); + (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -14712,505 +15580,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1 default: abort(); } } -typedef struct LDKRouter_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - jmethodID find_route_meth; - jmethodID find_route_with_id_meth; - jmethodID notify_payment_path_failed_meth; - jmethodID notify_payment_path_successful_meth; - jmethodID notify_payment_probe_successful_meth; - jmethodID notify_payment_probe_failed_meth; -} LDKRouter_JCalls; -static void LDKRouter_JCalls_free(void* this_arg) { - LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - 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); - } - (*env)->DeleteWeakGlobalRef(env, j_calls->o); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - FREE(j_calls); - } -} -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) { - LDKRouter_JCalls *j_calls = (LDKRouter_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); - } - int8_tArray payer_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); - LDKRouteParameters route_params_var = *route_params; - int64_t route_params_ref = 0; - route_params_var = RouteParameters_clone(&route_params_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); - route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); - LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; - int64_tArray first_hops_arr = NULL; - if (first_hops != NULL) { - LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; - first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); - int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); - for (size_t q = 0; q < first_hops_var.datalen; q++) { - LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; - int64_t first_hops_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); - first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); - first_hops_arr_ptr[q] = first_hops_conv_16_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); - } - LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs; - int64_t inflight_htlcs_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); - inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_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); - } - int8_tArray payer_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); - LDKRouteParameters route_params_var = *route_params; - int64_t route_params_ref = 0; - route_params_var = RouteParameters_clone(&route_params_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); - route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); - LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; - int64_tArray first_hops_arr = NULL; - if (first_hops != NULL) { - LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; - first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); - int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); - for (size_t q = 0; q < first_hops_var.datalen; q++) { - LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; - int64_t first_hops_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); - first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); - first_hops_arr_ptr[q] = first_hops_conv_16_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); - } - LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs; - int64_t inflight_htlcs_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); - inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); - int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data); - int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_path_failed_meth, path_arr, short_channel_id_conv); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_path_failed in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_path_successful_meth, path_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_path_successful in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_probe_successful_meth, path_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_probe_successful in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_probe_failed_meth, path_arr, short_channel_id_conv); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_probe_failed in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { - LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { - jclass c = (*env)->GetObjectClass(env, o); - CHECK(c != NULL); - LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); - atomic_init(&calls->refcnt, 1); - DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); - calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); - CHECK(calls->find_route_meth != NULL); - calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J"); - CHECK(calls->find_route_with_id_meth != NULL); - calls->notify_payment_path_failed_meth = (*env)->GetMethodID(env, c, "notify_payment_path_failed", "([JJ)V"); - CHECK(calls->notify_payment_path_failed_meth != NULL); - calls->notify_payment_path_successful_meth = (*env)->GetMethodID(env, c, "notify_payment_path_successful", "([J)V"); - CHECK(calls->notify_payment_path_successful_meth != NULL); - calls->notify_payment_probe_successful_meth = (*env)->GetMethodID(env, c, "notify_payment_probe_successful", "([J)V"); - CHECK(calls->notify_payment_probe_successful_meth != NULL); - calls->notify_payment_probe_failed_meth = (*env)->GetMethodID(env, c, "notify_payment_probe_failed", "([JJ)V"); - CHECK(calls->notify_payment_probe_failed_meth != NULL); - - LDKRouter ret = { - .this_arg = (void*) calls, - .find_route = find_route_LDKRouter_jcall, - .find_route_with_id = find_route_with_id_LDKRouter_jcall, - .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall, - .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall, - .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall, - .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall, - .free = LDKRouter_JCalls_free, - }; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) { - LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); - *res_ptr = LDKRouter_init(env, clz, o); - return tag_ptr(res_ptr, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; - LDKPublicKey payer_ref; - CHECK((*env)->GetArrayLength(env, payer) == 33); - (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); - LDKRouteParameters route_params_conv; - route_params_conv.inner = untag_ptr(route_params); - route_params_conv.is_owned = ptr_is_owned(route_params); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); - route_params_conv.is_owned = false; - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); - first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); - first_hops_conv_16_conv.is_owned = false; - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKInFlightHtlcs inflight_htlcs_conv; - inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); - inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; - LDKPublicKey payer_ref; - CHECK((*env)->GetArrayLength(env, payer) == 33); - (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); - LDKRouteParameters route_params_conv; - route_params_conv.inner = untag_ptr(route_params); - route_params_conv.is_owned = ptr_is_owned(route_params); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); - route_params_conv.is_owned = false; - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); - first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); - first_hops_conv_16_conv.is_owned = false; - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKInFlightHtlcs inflight_htlcs_conv; - inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); - inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); - LDKThirtyTwoBytes _payment_hash_ref; - CHECK((*env)->GetArrayLength(env, _payment_hash) == 32); - (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data); - LDKThirtyTwoBytes _payment_id_ref; - CHECK((*env)->GetArrayLength(env, _payment_id) == 32); - (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); -} - static jclass LDKDestination_Node_class = NULL; static jmethodID LDKDestination_Node_meth = NULL; static jclass LDKDestination_BlindedPath_class = NULL; @@ -15357,429 +15726,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr default: abort(); } } -typedef struct LDKPayer_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - jmethodID node_id_meth; - jmethodID first_hops_meth; - jmethodID send_payment_meth; - jmethodID send_spontaneous_payment_meth; - jmethodID retry_payment_meth; - jmethodID abandon_payment_meth; - jmethodID inflight_htlcs_meth; -} LDKPayer_JCalls; -static void LDKPayer_JCalls_free(void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - 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); - } - (*env)->DeleteWeakGlobalRef(env, j_calls->o); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - FREE(j_calls); - } -} -LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception."); - } - LDKPublicKey ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 33); - (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_ref; -} -LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception."); - } - LDKCVec_ChannelDetailsZ ret_constr; - ret_constr.datalen = (*env)->GetArrayLength(env, ret); - if (ret_constr.datalen > 0) - ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - ret_constr.data = NULL; - int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); - for (size_t q = 0; q < ret_constr.datalen; q++) { - int64_t ret_conv_16 = ret_vals[q]; - LDKChannelDetails ret_conv_16_conv; - ret_conv_16_conv.inner = untag_ptr(ret_conv_16); - ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv); - ret_constr.data[q] = ret_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_constr; -} -LDKCResult_NonePaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - LDKRoute route_var = *route; - int64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data); - int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data); - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -LDKCResult_NonePaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - LDKRoute route_var = *route; - int64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data); - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - LDKRoute route_var = *route; - int64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -LDKInFlightHtlcs inflight_htlcs_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->inflight_htlcs_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to inflight_htlcs in LDKPayer from rust threw an exception."); - } - LDKInFlightHtlcs ret_conv; - ret_conv.inner = untag_ptr(ret); - ret_conv.is_owned = ptr_is_owned(ret); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) { - jclass c = (*env)->GetObjectClass(env, o); - CHECK(c != NULL); - LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls"); - atomic_init(&calls->refcnt, 1); - DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); - calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B"); - CHECK(calls->node_id_meth != NULL); - calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J"); - CHECK(calls->first_hops_meth != NULL); - calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B[B)J"); - CHECK(calls->send_payment_meth != NULL); - calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B[B)J"); - CHECK(calls->send_spontaneous_payment_meth != NULL); - calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J"); - CHECK(calls->retry_payment_meth != NULL); - calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V"); - CHECK(calls->abandon_payment_meth != NULL); - calls->inflight_htlcs_meth = (*env)->GetMethodID(env, c, "inflight_htlcs", "()J"); - CHECK(calls->inflight_htlcs_meth != NULL); - - LDKPayer ret = { - .this_arg = (void*) calls, - .node_id = node_id_LDKPayer_jcall, - .first_hops = first_hops_LDKPayer_jcall, - .send_payment = send_payment_LDKPayer_jcall, - .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, - .retry_payment = retry_payment_LDKPayer_jcall, - .abandon_payment = abandon_payment_LDKPayer_jcall, - .inflight_htlcs = inflight_htlcs_LDKPayer_jcall, - .free = LDKPayer_JCalls_free, - }; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) { - LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer"); - *res_ptr = LDKPayer_init(env, clz, o); - return tag_ptr(res_ptr, true); -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form); - return ret_arr; -} - -JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(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 q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails ret_conv_16_var = ret_var.data[q]; - int64_t ret_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var); - ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned); - ret_arr_ptr[q] = ret_conv_16_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); - FREE(ret_var.data); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_hash_ref; - CHECK((*env)->GetArrayLength(env, payment_hash) == 32); - (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); - LDKThirtyTwoBytes payment_secret_ref; - CHECK((*env)->GetArrayLength(env, payment_secret) == 32); - (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_preimage_ref; - CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); - (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKInFlightHtlcs ret_var = (this_arg_conv->inflight_htlcs)(this_arg_conv->this_arg); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static jclass LDKRetry_Attempts_class = NULL; -static jmethodID LDKRetry_Attempts_meth = NULL; -static jclass LDKRetry_Timeout_class = NULL; -static jmethodID LDKRetry_Timeout_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) { - LDKRetry_Attempts_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts")); - CHECK(LDKRetry_Attempts_class != NULL); - LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "", "(J)V"); - CHECK(LDKRetry_Attempts_meth != NULL); - LDKRetry_Timeout_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout")); - CHECK(LDKRetry_Timeout_class != NULL); - LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "", "(J)V"); - CHECK(LDKRetry_Timeout_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); - switch(obj->tag) { - case LDKRetry_Attempts: { - int64_t attempts_conv = obj->attempts; - return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv); - } - case LDKRetry_Timeout: { - int64_t timeout_conv = obj->timeout; - return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv); - } - default: abort(); - } -} JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) { LDKStr ret_str = _ldk_get_compiled_version(); jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); @@ -15910,6 +15856,95 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass Str_free(dummy); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_ok(); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)untag_ptr(e)); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_CResult_NoneAPIErrorZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t w = 0; w < _res_constr.datalen; w++) { + int64_t _res_conv_22 = _res_vals[w]; + void* _res_conv_22_ptr = untag_ptr(_res_conv_22); + CHECK_ACCESS(_res_conv_22_ptr); + LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr); + FREE(untag_ptr(_res_conv_22)); + _res_constr.data[w] = _res_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_CResult_NoneAPIErrorZZ_free(_res_constr); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_APIErrorZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t k = 0; k < _res_constr.datalen; k++) { + int64_t _res_conv_10 = _res_vals[k]; + void* _res_conv_10_ptr = untag_ptr(_res_conv_10); + CHECK_ACCESS(_res_conv_10_ptr); + LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr); + FREE(untag_ptr(_res_conv_10)); + _res_constr.data[k] = _res_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_APIErrorZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) { LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o); LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ"); @@ -17679,6 +17714,153 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDeco return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr); + o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o)); + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_NetworkUpdateZ_free(_res_conv); +} + +static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) { + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg); + int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig); + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr); + o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o)); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_PathFailureZ_free(_res_conv); +} + +static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) { + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg); + int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr); + o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o)); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); @@ -17925,53 +18107,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr); - o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o)); - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_some(o_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) { - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_none(); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr); - FREE(untag_ptr(_res)); - COption_NetworkUpdateZ_free(_res_conv); -} - -static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) { - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_clone(arg); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg); - int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig); - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_clone(orig_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_SpendableOutputDescriptorZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -18112,56 +18247,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free( CVec_MessageSendEventZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKTxOut o_conv = *(LDKTxOut*)(o_ptr); - o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o)); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { - LDKAccessError e_conv = LDKAccessError_from_java(env, e); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_TxOutAccessErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) { - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) { LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ"); *ret_conv = C2Tuple_usizeTransactionZ_clone(arg); @@ -18510,6 +18595,131 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_ return ret_ref; } +static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) { + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig); + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) { + LDKEightU16s a_ref; + CHECK((*env)->GetArrayLength(env, a) == 8); + (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data); + LDKEightU16s b_ref; + CHECK((*env)->GetArrayLength(env, b) == 8); + (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data); + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_Z_free(_res_conv); +} + +static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) { + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg); + int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig); + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) { + LDKEightU16s a_ref; + CHECK((*env)->GetArrayLength(env, a) == 8); + (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data); + LDKEightU16s b_ref; + CHECK((*env)->GetArrayLength(env, b) == 8); + (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data); + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple__u168_u168Z_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr); + o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o)); + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv); +} + +static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg); + int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig); + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_NodeIdZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -18783,6 +18993,60 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDec return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKBlindedHopFeatures o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = BlindedHopFeatures_clone(&o_conv); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKChannelTypeFeatures o_conv; o_conv.inner = untag_ptr(o); @@ -18837,114 +19101,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeature return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKOfferFeatures o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = OfferFeatures_clone(&o_conv); - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_OfferFeaturesDecodeErrorZ* o_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_OfferFeaturesDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_OfferFeaturesDecodeErrorZ _res_conv = *(LDKCResult_OfferFeaturesDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_OfferFeaturesDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_OfferFeaturesDecodeErrorZ_clone_ptr(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_OfferFeaturesDecodeErrorZ* arg_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_OfferFeaturesDecodeErrorZ* orig_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(orig); - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInvoiceRequestFeatures o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InvoiceRequestFeatures_clone(&o_conv); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(orig); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKNodeId o_conv; o_conv.inner = untag_ptr(o); @@ -19052,34 +19208,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUp return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); - LDKAccess o_conv = *(LDKAccess*)(o_ptr); - if (o_conv.free == LDKAccess_JCalls_free) { + LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr); + if (o_conv.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&o_conv); + LDKUtxoLookup_JCalls_cloned(&o_conv); } - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_some(o_conv); + LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ"); + *ret_copy = COption_UtxoLookupZ_some(o_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) { - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_none(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ"); + *ret_copy = COption_UtxoLookupZ_none(); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr); + LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_AccessZ_free(_res_conv); + COption_UtxoLookupZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) { @@ -20041,142 +20197,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1cl return tag_ptr(ret_conv, true); } -static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) { - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg); - int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) { - LDKSignature a_ref; - CHECK((*env)->GetArrayLength(env, a) == 64); - (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form); - LDKSignature b_ref; - CHECK((*env)->GetArrayLength(env, b) == 64); - (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr); - FREE(untag_ptr(_res)); - C2Tuple_SignatureSignatureZ_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr); - o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o)); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv); -} - -static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg); - int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { - LDKSecretKey o_ref; - CHECK((*env)->GetArrayLength(env, o) == 32); - (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_SecretKeyNoneZ_free(_res_conv); -} - -static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) { - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKPublicKey o_ref; CHECK((*env)->GetArrayLength(env, o) == 33); @@ -20300,62 +20320,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_ return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKSign o_conv = *(LDKSign*)(o_ptr); - if (o_conv.free == LDKSign_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKSign_JCalls_cloned(&o_conv); - } - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_SignDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) { LDKCVec_U5Z _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -20421,6 +20385,62 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatu return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr); + if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv); + } + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) { LDKCVec_u8Z _res_ref; _res_ref.datalen = (*env)->GetArrayLength(env, _res); @@ -20796,95 +20816,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) { - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_ok(); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); - e_conv = APIError_clone((LDKAPIError*)untag_ptr(e)); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_NoneAPIErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_CResult_NoneAPIErrorZZ _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t w = 0; w < _res_constr.datalen; w++) { - int64_t _res_conv_22 = _res_vals[w]; - void* _res_conv_22_ptr = untag_ptr(_res_conv_22); - CHECK_ACCESS(_res_conv_22_ptr); - LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr); - FREE(untag_ptr(_res_conv_22)); - _res_constr.data[w] = _res_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_CResult_NoneAPIErrorZZ_free(_res_constr); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_APIErrorZ _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t k = 0; k < _res_constr.datalen; k++) { - int64_t _res_conv_10 = _res_vals[k]; - void* _res_conv_10_ptr = untag_ptr(_res_conv_10); - CHECK_ACCESS(_res_conv_10_ptr); - LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr); - FREE(untag_ptr(_res_conv_10)); - _res_constr.data[k] = _res_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_APIErrorZ_free(_res_constr); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -20937,6 +20868,26 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1c return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_RecentPaymentDetailsZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t w = 0; w < _res_constr.datalen; w++) { + int64_t _res_conv_22 = _res_vals[w]; + void* _res_conv_22_ptr = untag_ptr(_res_conv_22); + CHECK_ACCESS(_res_conv_22_ptr); + LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr); + FREE(untag_ptr(_res_conv_22)); + _res_constr.data[w] = _res_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_RecentPaymentDetailsZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_ok(); @@ -20986,6 +20937,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_ok(); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneRetryableSendFailureZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) { + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -21038,6 +21035,55 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPayment return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_PaymentHashRetryableSendFailureZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) { + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) { LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg); @@ -21789,6 +21835,106 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecod return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKAPIError o_conv = *(LDKAPIError*)(o_ptr); + o_conv = APIError_clone((LDKAPIError*)untag_ptr(o)); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_APIErrorZ_free(_res_conv); +} + +static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) { + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg); + int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr); + o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o)); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKOutPoint o_conv; o_conv.inner = untag_ptr(o); @@ -22976,6 +23122,66 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone return ret_ref; } +static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKPublicKey a_ref; + CHECK((*env)->GetArrayLength(env, a) == 33); + (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form); + void* b_ptr = untag_ptr(b); + CHECK_ACCESS(b_ptr); + LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr); + b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b)); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1NetAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t o = 0; o < _res_constr.datalen; o++) { + int64_t _res_conv_40 = _res_vals[o]; + void* _res_conv_40_ptr = untag_ptr(_res_conv_40); + CHECK_ACCESS(_res_conv_40_ptr); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr); + FREE(untag_ptr(_res_conv_40)); + _res_constr.data[o] = _res_conv_40_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKCVec_u8Z o_ref; o_ref.datalen = (*env)->GetArrayLength(env, o); @@ -23130,6 +23336,56 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErro return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKTxOut o_conv = *(LDKTxOut*)(o_ptr); + o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o)); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_TxOutUtxoLookupErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) { + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); *ret_conv = CResult_NoneSendErrorZ_ok(); @@ -25990,6 +26246,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a); + LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b); + jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv); + return ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj); LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv); @@ -26009,6 +26272,83 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PathFailure_free(this_ptr_conv); +} + +static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) { + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg); + int64_t ret_conv = PathFailure_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) { + void* err_ptr = untag_ptr(err); + CHECK_ACCESS(err_ptr); + LDKAPIError err_conv = *(LDKAPIError*)(err_ptr); + err_conv = APIError_clone((LDKAPIError*)untag_ptr(err)); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_initial_send(err_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) { + void* network_update_ptr = untag_ptr(network_update); + CHECK_ACCESS(network_update_ptr); + LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr); + network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update)); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_on_path(network_update_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a); + LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b); + jboolean ret_conv = PathFailure_eq(a_conv, b_conv); + return ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj); + LDKCVec_u8Z ret_var = PathFailure_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_PathFailure_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_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = PathFailure_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return tag_ptr(ret_conv, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -26367,17 +26707,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1succe return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_tArray path, int64_t short_channel_id, int64_t retry) { 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); - void* network_update_ptr = untag_ptr(network_update); - CHECK_ACCESS(network_update_ptr); - LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr); - network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update)); + void* failure_ptr = untag_ptr(failure); + CHECK_ACCESS(failure_ptr); + LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr); + failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure)); LDKCVec_RouteHopZ path_constr; path_constr.datalen = (*env)->GetArrayLength(env, path); if (path_constr.datalen > 0) @@ -26405,7 +26745,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv); retry_conv = RouteParameters_clone(&retry_conv); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv); + *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_constr, short_channel_id_conv, retry_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -26619,6 +26959,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKEvent* a_conv = (LDKEvent*)untag_ptr(a); + LDKEvent* b_conv = (LDKEvent*)untag_ptr(b); + jboolean ret_conv = Event_eq(a_conv, b_conv); + return ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj); LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -26881,6 +27228,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) { + LDKNodeAnnouncement msg_conv; + msg_conv.inner = untag_ptr(msg); + msg_conv.is_owned = ptr_is_owned(msg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = NodeAnnouncement_clone(&msg_conv); + LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) { LDKPublicKey node_id_ref; CHECK((*env)->GetArrayLength(env, node_id) == 33); @@ -27093,6 +27452,25 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, return ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj); + LDKCVec_u8Z ret_var = APIError_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_APIError_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_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = APIError_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return tag_ptr(ret_conv, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKBigSize this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -27195,10 +27573,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass cl LDKu8slice msg_ref; msg_ref.datalen = (*env)->GetArrayLength(env, msg); msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL); - unsigned char sk_arr[32]; + uint8_t sk_arr[32]; CHECK((*env)->GetArrayLength(env, sk) == 32); (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr); - unsigned char (*sk_ref)[32] = &sk_arr; + uint8_t (*sk_ref)[32] = &sk_arr; LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); *ret_conv = sign(msg_ref, sk_ref); (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0); @@ -28457,9 +28835,9 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) { LDKNetwork network_conv = LDKNetwork_from_java(env, network); - LDKBestBlock ret_var = BestBlock_from_genesis(network_conv); + LDKBestBlock ret_var = BestBlock_from_network(network_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -28498,31 +28876,6 @@ JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *e return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig); - jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv)); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain()); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx()); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Access_free(this_ptr_conv); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -29647,10 +30000,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_ this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -29708,10 +30061,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconn this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -29742,10 +30095,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transa this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -29803,10 +30156,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1u this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK((*env)->GetArrayLength(env, txid) == 32); (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -29837,10 +30190,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1 this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -29930,15 +30283,18 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1c return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - void* arg_ptr = untag_ptr(arg); - if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); } - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr; + void* arg_a_ptr = untag_ptr(arg_a); + if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); } + LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr; + void* arg_b_ptr = untag_ptr(arg_b); + if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); } + LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr; LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ"); - *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv); + *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } @@ -30637,44 +30993,53 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1 return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr); + LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - BaseSign_free(this_ptr_conv); + ChannelSigner_free(this_ptr_conv); } -static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) { - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = Sign_clone(arg); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + EcdsaChannelSigner_free(this_ptr_conv); +} + +static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) { + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = WriteableEcdsaChannelSigner_clone(arg); return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { void* arg_ptr = untag_ptr(arg); if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); } - LDKSign* arg_conv = (LDKSign*)arg_ptr; - int64_t ret_conv = Sign_clone_ptr(arg_conv); + LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr; + int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) { void* orig_ptr = untag_ptr(orig); if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); } - LDKSign* orig_conv = (LDKSign*)orig_ptr; - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = Sign_clone(orig_conv); + LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr; + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv); return tag_ptr(ret_ret, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr); + LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - Sign_free(this_ptr_conv); + WriteableEcdsaChannelSigner_free(this_ptr_conv); } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) { @@ -30693,13 +31058,31 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNI return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + EntropySource_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr); + LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - KeysInterface_free(this_ptr_conv); + NodeSigner_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + SignerProvider_free(this_ptr_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) { @@ -30878,10 +31261,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray node_secret, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { - LDKSecretKey node_secret_ref; - CHECK((*env)->GetArrayLength(env, node_secret) == 32); - (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { LDKSecretKey funding_key_ref; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes); @@ -30903,7 +31283,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv LDKThirtyTwoBytes channel_keys_id_ref; CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data); - LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); + LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -31031,25 +31411,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynam return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner"); + *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); - *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv); + LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner"); + *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv); return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = InMemorySigner_as_Sign(&this_arg_conv); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv); return tag_ptr(ret_ret, true); } @@ -31066,15 +31457,12 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(J return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_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); - LDKSecretKey arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 32); - (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes); LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); - *ret_conv = InMemorySigner_read(ser_ref, arg_ref); + *ret_conv = InMemorySigner_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } @@ -31088,10 +31476,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) { - unsigned char seed_arr[32]; + uint8_t seed_arr[32]; CHECK((*env)->GetArrayLength(env, seed) == 32); (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr); - unsigned char (*seed_ref)[32] = &seed_arr; + uint8_t (*seed_ref)[32] = &seed_arr; LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31099,16 +31487,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *en return ret_ref; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { LDKKeysManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char params_arr[32]; + uint8_t params_arr[32]; CHECK((*env)->GetArrayLength(env, params) == 32); (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); - unsigned char (*params_ref)[32] = ¶ms_arr; + uint8_t (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31163,14 +31562,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendab return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *ret_ret = KeysManager_as_EntropySource(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv); + LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv); return tag_ptr(ret_ret, true); } @@ -31182,26 +31603,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEn PhantomKeysManager_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPhantomKeysManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv); + LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv); return tag_ptr(ret_ret, true); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) { - unsigned char seed_arr[32]; + uint8_t seed_arr[32]; CHECK((*env)->GetArrayLength(env, seed) == 32); (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr); - unsigned char (*seed_ref)[32] = &seed_arr; - unsigned char cross_node_seed_arr[32]; + uint8_t (*seed_ref)[32] = &seed_arr; + uint8_t cross_node_seed_arr[32]; CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32); (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr); - unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr; + uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr; LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31262,10 +31705,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_ this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char params_arr[32]; + uint8_t params_arr[32]; CHECK((*env)->GetArrayLength(env, params) == 32); (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); - unsigned char (*params_ref)[32] = ¶ms_arr; + uint8_t (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31273,6 +31716,49 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_ return ret_ref; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes); + return ret_arr; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig); + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_temporary_node_failure()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_required_node_feature_missing()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_incorrect_or_unknown_payment_details()); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -32377,125 +32863,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbou return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr); + LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - PaymentSendFailure_free(this_ptr_conv); + RecentPaymentDetails_free(this_ptr_conv); } -static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) { - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_clone(arg); +static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) { + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_clone(arg); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg); - int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg); + int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_clone(orig_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) { - void* a_ptr = untag_ptr(a); - CHECK_ACCESS(a_ptr); - LDKAPIError a_conv = *(LDKAPIError*)(a_ptr); - a_conv = APIError_clone((LDKAPIError*)untag_ptr(a)); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_parameter_error(a_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) { - LDKCVec_CResult_NoneAPIErrorZZ a_constr; - a_constr.datalen = (*env)->GetArrayLength(env, a); - if (a_constr.datalen > 0) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - a_constr.data = NULL; - int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); - for (size_t w = 0; w < a_constr.datalen; w++) { - int64_t a_conv_22 = a_vals[w]; - void* a_conv_22_ptr = untag_ptr(a_conv_22); - CHECK_ACCESS(a_conv_22_ptr); - LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); - a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22)); - a_constr.data[w] = a_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_path_parameter_error(a_constr); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) { - LDKCVec_APIErrorZ a_constr; - a_constr.datalen = (*env)->GetArrayLength(env, a); - if (a_constr.datalen > 0) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); - else - a_constr.data = NULL; - int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); - for (size_t k = 0; k < a_constr.datalen; k++) { - int64_t a_conv_10 = a_vals[k]; - void* a_conv_10_ptr = untag_ptr(a_conv_10); - CHECK_ACCESS(a_conv_10_ptr); - LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr); - a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10)); - a_constr.data[k] = a_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t total_msat) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) { - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_duplicate_payment(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(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); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) { - LDKCVec_CResult_NoneAPIErrorZZ results_constr; - results_constr.datalen = (*env)->GetArrayLength(env, results); - if (results_constr.datalen > 0) - results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - results_constr.data = NULL; - int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL); - for (size_t w = 0; w < results_constr.datalen; w++) { - int64_t results_conv_22 = results_vals[w]; - void* results_conv_22_ptr = untag_ptr(results_conv_22); - CHECK_ACCESS(results_conv_22_ptr); - LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); - results_constr.data[w] = results_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, results, results_vals, 0); - LDKRouteParameters failed_paths_retry_conv; - failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry); - failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry); - CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv); - failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(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); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -32656,7 +33078,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t config, int64_t params) { void* fee_est_ptr = untag_ptr(fee_est); CHECK_ACCESS(fee_est_ptr); LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr); @@ -32678,6 +33100,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv); } + void* router_ptr = untag_ptr(router); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -32685,12 +33114,26 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + void* signer_provider_ptr = untag_ptr(signer_provider); + CHECK_ACCESS(signer_provider_ptr); + LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr); + if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKSignerProvider_JCalls_cloned(&signer_provider_conv); } LDKUserConfig config_conv; config_conv.inner = untag_ptr(config); @@ -32702,7 +33145,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv params_conv.is_owned = ptr_is_owned(params); CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); params_conv = ChainParameters_clone(¶ms_conv); - LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv); + LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -32788,16 +33231,37 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1 return ret_arr; } +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_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); + for (size_t w = 0; w < ret_var.datalen; w++) { + LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_conv_22_copy = ret_var.data[w]; + int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true); + ret_arr_ptr[w] = ret_conv_22_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32812,10 +33276,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1chan this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32830,10 +33294,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1clos this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32848,10 +33312,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1clos this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32903,22 +33367,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); LDKThirtyTwoBytes payment_id_ref; CHECK((*env)->GetArrayLength(env, payment_id) == 32); (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv = RouteParameters_clone(&route_params_conv); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = ChannelManager_send_payment_with_retry(&this_arg_conv, payment_hash_ref, payment_secret_ref, payment_id_ref, route_params_conv, retry_strategy_conv); return tag_ptr(ret_conv, true); } @@ -32956,6 +33430,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spont return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKThirtyTwoBytes payment_preimage_ref; + CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); + (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv = RouteParameters_clone(&route_params_conv); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, payment_id_ref, route_params_conv, retry_strategy_conv); + return tag_ptr(ret_conv, true); +} + 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 = untag_ptr(this_arg); @@ -32990,10 +33490,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1tr this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -33039,7 +33539,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1cha return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray _next_node_id, int64_t amt_to_forward_msat) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -33048,15 +33548,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1in LDKThirtyTwoBytes intercept_id_ref; CHECK((*env)->GetArrayLength(env, intercept_id) == 32); (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data); - unsigned char next_hop_channel_id_arr[32]; + uint8_t next_hop_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32); (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr); - unsigned char (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr; - LDKPublicKey _next_node_id_ref; - CHECK((*env)->GetArrayLength(env, _next_node_id) == 33); - (*env)->GetByteArrayRegion(env, _next_node_id, 0, 33, _next_node_id_ref.compressed_form); + uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr; + LDKPublicKey next_node_id_ref; + CHECK((*env)->GetArrayLength(env, next_node_id) == 33); + (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form); LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, _next_node_id_ref, amt_to_forward_msat); + *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat); return tag_ptr(ret_conv, true); } @@ -33098,13 +33598,27 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1ba this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char payment_hash_arr[32]; + uint8_t payment_hash_arr[32]; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); - unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; + uint8_t (*payment_hash_ref)[32] = &payment_hash_arr; ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards_1with_1reason(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, jclass failure_code) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + uint8_t payment_hash_arr[32]; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); + uint8_t (*payment_hash_ref)[32] = &payment_hash_arr; + LDKFailureCode failure_code_conv = LDKFailureCode_from_java(env, failure_code); + ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -33134,10 +33648,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -33155,10 +33669,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -33170,7 +33684,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -33180,8 +33694,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } @@ -33200,7 +33718,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -33213,8 +33731,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); + void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry); + CHECK_ACCESS(min_final_cltv_expiry_ptr); + LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr); + min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry)); LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv); return tag_ptr(ret_conv, true); } @@ -33388,35 +33910,76 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1be return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); - *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); + LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1node_1features(JNIEnv *env, jclass clz) { - LDKNodeFeatures ret_var = provided_node_features(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1channel_1features(JNIEnv *env, jclass clz) { - LDKChannelFeatures ret_var = provided_channel_features(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz) { - LDKInitFeatures ret_var = provided_init_features(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); + *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t _config) { + LDKUserConfig _config_conv; + _config_conv.inner = untag_ptr(_config); + _config_conv.is_owned = ptr_is_owned(_config); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv); + _config_conv.is_owned = false; + LDKInitFeatures ret_var = provided_init_features(&_config_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -33536,18 +34099,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(J ChannelManagerReadArgs_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; // WARNING: This object doesn't live past this scope, needs clone! - int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false); + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false); return ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); @@ -33555,12 +34118,66 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1k this_ptr_conv.is_owned = false; void* val_ptr = untag_ptr(val); CHECK_ACCESS(val_ptr); - LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr); - if (val_conv.free == LDKKeysInterface_JCalls_free) { + LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr); + if (val_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&val_conv); + LDKEntropySource_JCalls_cloned(&val_conv); } - ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv); + ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + // WARNING: This object doesn't live past this scope, needs clone! + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false); + return ret_ret; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr); + if (val_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + // WARNING: This object doesn't live past this scope, needs clone! + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false); + return ret_ret; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr); + if (val_conv.free == LDKSignerProvider_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKSignerProvider_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -33644,6 +34261,33 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1t ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + // WARNING: This object doesn't live past this scope, needs clone! + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false); + return ret_ret; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKRouter val_conv = *(LDKRouter*)(val_ptr); + if (val_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -33698,13 +34342,27 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1d ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) { - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t default_config, int64_tArray channel_monitors) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + void* signer_provider_ptr = untag_ptr(signer_provider); + CHECK_ACCESS(signer_provider_ptr); + LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr); + if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKSignerProvider_JCalls_cloned(&signer_provider_conv); } void* fee_estimator_ptr = untag_ptr(fee_estimator); CHECK_ACCESS(fee_estimator_ptr); @@ -33727,6 +34385,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv); } + void* router_ptr = untag_ptr(router); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -33756,7 +34421,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new channel_monitors_constr.data[q] = channel_monitors_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0); - LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr); + LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -33788,10 +34453,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) { - unsigned char key_material_arr[32]; + uint8_t key_material_arr[32]; CHECK((*env)->GetArrayLength(env, key_material) == 32); (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr); - unsigned char (*key_material_ref)[32] = &key_material_arr; + uint8_t (*key_material_ref)[32] = &key_material_arr; LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -33799,7 +34464,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *en return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t keys_manager, int64_t current_time) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t entropy_source, int64_t current_time, int64_t min_final_cltv_expiry_delta) { LDKExpandedKey keys_conv; keys_conv.inner = untag_ptr(keys); keys_conv.is_owned = ptr_is_owned(keys); @@ -33809,15 +34474,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); - void* keys_manager_ptr = untag_ptr(keys_manager); - if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); } - LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr; + void* entropy_source_ptr = untag_ptr(entropy_source); + if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); } + LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr; + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); - *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time); + *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time, int64_t min_final_cltv_expiry_delta) { LDKExpandedKey keys_conv; keys_conv.inner = untag_ptr(keys); keys_conv.is_owned = ptr_is_owned(keys); @@ -33830,8 +34499,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv * LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); - *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time); + *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } @@ -37539,6 +38212,80 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *en return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UnsignedGossipMessage_free(this_ptr_conv); +} + +static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) { + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg); + int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) { + LDKUnsignedChannelAnnouncement a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UnsignedChannelAnnouncement_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) { + LDKUnsignedChannelUpdate a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UnsignedChannelUpdate_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_channel_update(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) { + LDKUnsignedNodeAnnouncement a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UnsignedNodeAnnouncement_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_node_announcement(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj); + LDKCVec_u8Z ret_var = UnsignedGossipMessage_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 void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKUnsignedNodeAnnouncement this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -37593,27 +38340,31 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_ UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv); } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -37949,96 +38700,112 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1s UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv); } static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) { @@ -41049,27 +41816,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * PeerHandleError_free(this_obj_conv); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPeerHandleError this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { - LDKPeerHandleError this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - PeerHandleError_set_no_connection_possible(&this_ptr_conv, val); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) { - LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) { + LDKPeerHandleError ret_var = PeerHandleError_new(); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -41114,20 +41862,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, PeerManager_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler, int64_t node_signer) { LDKMessageHandler message_handler_conv; message_handler_conv.inner = untag_ptr(message_handler); message_handler_conv.is_owned = ptr_is_owned(message_handler); CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv); // WARNING: we need a move here but no clone is available for LDKMessageHandler - LDKSecretKey our_node_secret_ref; - CHECK((*env)->GetArrayLength(env, our_node_secret) == 32); - (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes); - unsigned char ephemeral_random_data_arr[32]; + uint8_t ephemeral_random_data_arr[32]; CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32); (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr); - unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; + uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -41142,29 +41887,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *en // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv); } - LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv); + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPeerManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv); - jobjectArray ret_arr = NULL; - ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); - ; - for (size_t i = 0; i < ret_var.datalen; i++) { - int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form); - (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_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); + for (size_t o = 0; o < ret_var.datalen; o++) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv_40_conv = ret_var.data[o]; + ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true); } - + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); return ret_arr; } @@ -41267,7 +42019,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnec PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) { LDKPeerManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -41276,7 +42028,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1n LDKPublicKey node_id_ref; CHECK((*env)->GetArrayLength(env, node_id) == 33); (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); - PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible); + PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -41388,10 +42140,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JN } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) { - unsigned char commitment_seed_arr[32]; + uint8_t commitment_seed_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_seed) == 32); (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr); - unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr; + uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data); return ret_arr; @@ -41526,10 +42278,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JN LDKPublicKey per_commitment_point_ref; CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33); (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form); - unsigned char base_secret_arr[32]; + uint8_t base_secret_arr[32]; CHECK((*env)->GetArrayLength(env, base_secret) == 32); (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr); - unsigned char (*base_secret_ref)[32] = &base_secret_arr; + uint8_t (*base_secret_ref)[32] = &base_secret_arr; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes); return ret_arr; @@ -41548,14 +42300,14 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNI } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) { - unsigned char per_commitment_secret_arr[32]; + uint8_t per_commitment_secret_arr[32]; CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32); (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr); - unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr; - unsigned char countersignatory_revocation_base_secret_arr[32]; + uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr; + uint8_t countersignatory_revocation_base_secret_arr[32]; CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32); (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr); - unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr; + uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes); return ret_arr; @@ -42288,10 +43040,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemsc } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, jboolean opt_anchors, jboolean use_non_zero_fee_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { - unsigned char commitment_txid_arr[32]; + uint8_t commitment_txid_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_txid) == 32); (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr); - unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr; + uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr; LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = untag_ptr(htlc); htlc_conv.is_owned = ptr_is_owned(htlc); @@ -43154,10 +43906,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransact this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char funding_key_arr[32]; + uint8_t funding_key_arr[32]; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr); - unsigned char (*funding_key_ref)[32] = &funding_key_arr; + uint8_t (*funding_key_ref)[32] = &funding_key_arr; LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript); funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL); @@ -43366,10 +44118,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransacti this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char funding_key_arr[32]; + uint8_t funding_key_arr[32]; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr); - unsigned char (*funding_key_ref)[32] = &funding_key_arr; + uint8_t (*funding_key_ref)[32] = &funding_key_arr; LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript); funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL); @@ -43580,10 +44332,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransactio this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char htlc_base_key_arr[32]; + uint8_t htlc_base_key_arr[32]; CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32); (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr); - unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr; + uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr; LDKDirectedChannelTransactionParameters channel_parameters_conv; channel_parameters_conv.inner = untag_ptr(channel_parameters); channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); @@ -43695,6 +44447,36 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq return ret_conv; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKBolt12InvoiceFeatures a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKBolt12InvoiceFeatures b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKBlindedHopFeatures a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKBlindedHopFeatures b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { LDKChannelTypeFeatures a_conv; a_conv.inner = untag_ptr(a); @@ -43890,6 +44672,66 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clo return ret_ref; } +static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) { + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKBolt12InvoiceFeatures arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKBolt12InvoiceFeatures orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) { + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKBlindedHopFeatures arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKBlindedHopFeatures orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); int64_t ret_ref = 0; @@ -43968,6 +44810,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(J InvoiceRequestFeatures_free(this_obj_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKBolt12InvoiceFeatures this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + Bolt12InvoiceFeatures_free(this_obj_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKBlindedHopFeatures this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + BlindedHopFeatures_free(this_obj_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelTypeFeatures this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -44084,6 +44942,42 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1re return ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) { + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty(); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) { + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty(); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBlindedHopFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) { LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); int64_t ret_ref = 0; @@ -44194,71 +45088,48 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEn return tag_ptr(ret_conv, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKChannelTypeFeatures obj_conv; - obj_conv.inner = untag_ptr(obj); - obj_conv.is_owned = ptr_is_owned(obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = ChannelTypeFeatures_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_ChannelTypeFeatures_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_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = ChannelTypeFeatures_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKOfferFeatures obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKBlindedHopFeatures obj_conv; obj_conv.inner = untag_ptr(obj); obj_conv.is_owned = ptr_is_owned(obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = OfferFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = BlindedHopFeatures_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_OfferFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_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_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = OfferFeatures_read(ser_ref); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = BlindedHopFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKInvoiceRequestFeatures obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelTypeFeatures obj_conv; obj_conv.inner = untag_ptr(obj); obj_conv.is_owned = ptr_is_owned(obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = InvoiceRequestFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_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_InvoiceRequestFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_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_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = InvoiceRequestFeatures_read(ser_ref); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } @@ -44945,6 +45816,34 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_ return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -44975,6 +45874,16 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_ return ret_conv; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -45051,6 +45960,120 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wu return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -45697,10 +46720,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; + uint8_t pubkey_hash_arr[20]; CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20); (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; + uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -45709,10 +46732,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) { - unsigned char script_hash_arr[32]; + uint8_t script_hash_arr[32]; CHECK((*env)->GetArrayLength(env, script_hash) == 32); (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr); - unsigned char (*script_hash_ref)[32] = &script_hash_arr; + uint8_t (*script_hash_ref)[32] = &script_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -45770,6 +46793,206 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compat return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + Retry_free(this_ptr_conv); +} + +static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg); + int64_t ret_conv = Retry_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig); + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_attempts(a); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_timeout(a); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRetry* a_conv = (LDKRetry*)untag_ptr(a); + LDKRetry* b_conv = (LDKRetry*)untag_ptr(b); + jboolean ret_conv = Retry_eq(a_conv, b_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRetry* o_conv = (LDKRetry*)untag_ptr(o); + int64_t ret_conv = Retry_hash(o_conv); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig); + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment()); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PaymentSendFailure_free(this_ptr_conv); +} + +static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) { + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg); + int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKAPIError a_conv = *(LDKAPIError*)(a_ptr); + a_conv = APIError_clone((LDKAPIError*)untag_ptr(a)); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_parameter_error(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) { + LDKCVec_CResult_NoneAPIErrorZZ a_constr; + a_constr.datalen = (*env)->GetArrayLength(env, a); + if (a_constr.datalen > 0) + a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + a_constr.data = NULL; + int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); + for (size_t w = 0; w < a_constr.datalen; w++) { + int64_t a_conv_22 = a_vals[w]; + void* a_conv_22_ptr = untag_ptr(a_conv_22); + CHECK_ACCESS(a_conv_22_ptr); + LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); + a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22)); + a_constr.data[w] = a_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_path_parameter_error(a_constr); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) { + LDKCVec_APIErrorZ a_constr; + a_constr.datalen = (*env)->GetArrayLength(env, a); + if (a_constr.datalen > 0) + a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); + else + a_constr.data = NULL; + int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); + for (size_t k = 0; k < a_constr.datalen; k++) { + int64_t a_conv_10 = a_vals[k]; + void* a_conv_10_ptr = untag_ptr(a_conv_10); + CHECK_ACCESS(a_conv_10_ptr); + LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr); + a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10)); + a_constr.data[k] = a_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) { + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_duplicate_payment(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) { + LDKCVec_CResult_NoneAPIErrorZZ results_constr; + results_constr.datalen = (*env)->GetArrayLength(env, results); + if (results_constr.datalen > 0) + results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + results_constr.data = NULL; + int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL); + for (size_t w = 0; w < results_constr.datalen; w++) { + int64_t results_conv_22 = results_vals[w]; + void* results_conv_22_ptr = untag_ptr(results_conv_22); + CHECK_ACCESS(results_conv_22_ptr); + LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); + results_constr.data[w] = results_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, results, results_vals, 0); + LDKRouteParameters failed_paths_retry_conv; + failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry); + failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry); + CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv); + failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -45810,6 +47033,168 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass Type_free(this_ptr_conv); } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig); + jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx()); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UtxoResult_free(this_ptr_conv); +} + +static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) { + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg); + int64_t ret_conv = UtxoResult_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr); + a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a)); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_sync(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) { + LDKUtxoFuture a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UtxoFuture_clone(&a_conv); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_async(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UtxoLookup_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKUtxoFuture this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + UtxoFuture_free(this_obj_conv); +} + +static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) { + LDKUtxoFuture ret_var = UtxoFuture_clone(arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKUtxoFuture arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUtxoFuture orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) { + LDKUtxoFuture ret_var = UtxoFuture_new(); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve_1without_1forwarding(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t result) { + LDKUtxoFuture this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNetworkGraph graph_conv; + graph_conv.inner = untag_ptr(graph); + graph_conv.is_owned = ptr_is_owned(graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv); + graph_conv.is_owned = false; + void* result_ptr = untag_ptr(result); + CHECK_ACCESS(result_ptr); + LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr); + UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) { + LDKUtxoFuture this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNetworkGraph graph_conv; + graph_conv.inner = untag_ptr(graph); + graph_conv.is_owned = ptr_is_owned(graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv); + graph_conv.is_owned = false; + LDKP2PGossipSync gossip_conv; + gossip_conv.inner = untag_ptr(gossip); + gossip_conv.is_owned = ptr_is_owned(gossip); + CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv); + gossip_conv.is_owned = false; + void* result_ptr = untag_ptr(result); + CHECK_ACCESS(result_ptr); + LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr); + UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -46012,21 +47397,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *en P2PGossipSync_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t utxo_lookup, int64_t logger) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = untag_ptr(network_graph); network_graph_conv.is_owned = ptr_is_owned(network_graph); CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); network_graph_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } void* logger_ptr = untag_ptr(logger); @@ -46036,31 +47421,31 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv * // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv); + LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) { LDKP2PGossipSync this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } - P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv); + P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) { @@ -47333,33 +48718,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv NodeInfo_set_channels(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKNodeInfo this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKNodeInfo this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; - val_conv.inner = untag_ptr(val); - val_conv.is_owned = ptr_is_owned(val); - CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = RoutingFees_clone(&val_conv); - NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -47387,7 +48745,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1i NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) { LDKCVec_u64Z channels_arg_constr; channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg); if (channels_arg_constr.datalen > 0) @@ -47400,17 +48758,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, channels_arg_constr.data[g] = channels_arg_conv_6; } (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0); - LDKRoutingFees lowest_inbound_channel_fees_arg_conv; - lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg); - lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv); - lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); LDKNodeAnnouncementInfo announcement_info_arg_conv; announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg); announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv); announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); - LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); + LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -47515,10 +48868,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) { - LDKThirtyTwoBytes genesis_hash_ref; - CHECK((*env)->GetArrayLength(env, genesis_hash) == 32); - (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) { + LDKNetwork network_conv = LDKNetwork_from_java(env, network); void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -47526,7 +48877,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *e // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv); + LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -47599,7 +48950,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_ return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t utxo_lookup) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -47610,23 +48961,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t utxo_lookup) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -47637,19 +48988,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv); return tag_ptr(ret_conv, true); } @@ -47911,8 +49262,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlight inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); - LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, inflight_htlcs_conv); + inflight_htlcs_conv.is_owned = false; + LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -48569,32 +49920,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1v RouteParameters_set_final_value_msat(&this_ptr_conv, val); } -JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteParameters this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKRouteParameters this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg) { LDKPaymentParameters payment_params_arg_conv; payment_params_arg_conv.inner = untag_ptr(payment_params_arg); payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv); payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv); - LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg); + LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -48631,6 +49963,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIE return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteParameters a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKRouteParameters b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv); + return ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKRouteParameters obj_conv; obj_conv.inner = untag_ptr(obj); @@ -48882,7 +50229,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previo 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) { +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + PaymentParameters_set_final_cltv_expiry_delta(&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_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int32_t final_cltv_expiry_delta_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); @@ -48924,7 +50290,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIE 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); + 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, final_cltv_expiry_delta_arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -48999,32 +50365,32 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1writ return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); - *ret_conv = PaymentParameters_read(ser_ref); + *ret_conv = PaymentParameters_read(ser_ref, arg); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) { LDKPublicKey payee_pubkey_ref; CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33); (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form); - LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref); + LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) { LDKPublicKey payee_pubkey_ref; CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33); (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form); - LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref); + LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -49483,10 +50849,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc void* scorer_ptr = untag_ptr(scorer); if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; - unsigned char random_seed_bytes_arr[32]; + uint8_t random_seed_bytes_arr[32]; CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr); - unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; + uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } @@ -49527,10 +50893,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_build_1route_1from_1hops(JN // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - unsigned char random_seed_bytes_arr[32]; + uint8_t random_seed_bytes_arr[32]; CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr); - unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; + uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref); return tag_ptr(ret_conv, true); @@ -50133,6 +51499,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estima return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1channel_1liquidity_1probabilities(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeId target_conv; + target_conv.inner = untag_ptr(target); + target_conv.is_owned = ptr_is_owned(target); + CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); + target_conv.is_owned = false; + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) { LDKProbabilisticScorer this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -50359,7 +51742,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *e return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t keys_manager) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) { LDKCVec_PublicKeyZ node_pks_constr; node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks); if (node_pks_constr.datalen > 0) @@ -50373,11 +51756,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *en (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form); node_pks_constr.data[i] = node_pks_conv_8_ref; } - void* keys_manager_ptr = untag_ptr(keys_manager); - if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); } - LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr; + void* entropy_source_ptr = untag_ptr(entropy_source); + if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); } + LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr; LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); - *ret_conv = BlindedPath_new(node_pks_constr, keys_manager_conv); + *ret_conv = BlindedPath_new(node_pks_constr, entropy_source_conv); return tag_ptr(ret_conv, true); } @@ -50588,13 +51971,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1fre CustomOnionMessageHandler_free(this_ptr_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t logger, int64_t custom_handler) { - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t custom_handler) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -50610,7 +52000,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv); } - LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_conv); + LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -50779,21 +52169,24 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1d return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t entropy_source, int64_t signer_provider) { LDKFilesystemPersister this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); } + void* signer_provider_ptr = untag_ptr(signer_provider); + if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); } + LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr; LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ"); - *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv); + *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, entropy_source_conv, signer_provider_conv); return tag_ptr(ret_conv, true); } @@ -51897,93 +53290,93 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKMinFinalCltvExpiry this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKMinFinalCltvExpiryDelta this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); this_obj_conv.is_owned = ptr_is_owned(this_obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - MinFinalCltvExpiry_free(this_obj_conv); + MinFinalCltvExpiryDelta_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKMinFinalCltvExpiry this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKMinFinalCltvExpiryDelta this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv); return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKMinFinalCltvExpiry this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKMinFinalCltvExpiryDelta this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - MinFinalCltvExpiry_set_a(&this_ptr_conv, val); + MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) { - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) { + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) { - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg); +static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) { + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKMinFinalCltvExpiry arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKMinFinalCltvExpiryDelta arg_conv; arg_conv.inner = untag_ptr(arg); arg_conv.is_owned = ptr_is_owned(arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); arg_conv.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKMinFinalCltvExpiry orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKMinFinalCltvExpiryDelta orig_conv; orig_conv.inner = untag_ptr(orig); orig_conv.is_owned = ptr_is_owned(orig); CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); orig_conv.is_owned = false; - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv); + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKMinFinalCltvExpiry o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKMinFinalCltvExpiryDelta o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); o_conv.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv); return ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKMinFinalCltvExpiry a_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKMinFinalCltvExpiryDelta a_conv; a_conv.inner = untag_ptr(a); a_conv.is_owned = ptr_is_owned(a); CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); a_conv.is_owned = false; - LDKMinFinalCltvExpiry b_conv; + LDKMinFinalCltvExpiryDelta b_conv; b_conv.inner = untag_ptr(b); b_conv.is_owned = ptr_is_owned(b); CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); b_conv.is_owned = false; - jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv); + jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv); return ret_conv; } @@ -52332,13 +53725,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) { LDKRawInvoice this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv); + LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -52603,13 +53996,13 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNI return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv); + int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv); return ret_conv; } @@ -52789,6 +54182,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1rout return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short()); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a); LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b); @@ -52934,77 +54332,90 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1st return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKInvoicePayer this_obj_conv; - this_obj_conv.inner = untag_ptr(this_obj); - this_obj_conv.is_owned = ptr_is_owned(this_obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - InvoicePayer_free(this_obj_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Payer_free(this_ptr_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Retry_free(this_ptr_conv); -} - -static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_clone(arg); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg); - int64_t ret_conv = Retry_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig); - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_clone(orig_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_attempts(a); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_timeout(a); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRetry* a_conv = (LDKRetry*)untag_ptr(a); - LDKRetry* b_conv = (LDKRetry*)untag_ptr(b); - jboolean ret_conv = Retry_eq(a_conv, b_conv); - return ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRetry* o_conv = (LDKRetry*)untag_ptr(o); - int64_t ret_conv = Retry_hash(o_conv); - return ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -53044,201 +54455,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) { - LDKLightningError a_conv; - a_conv.inner = untag_ptr(a); - a_conv.is_owned = ptr_is_owned(a); - CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - a_conv = LightningError_clone(&a_conv); - LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); - *ret_copy = PaymentError_routing(a_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) { - void* a_ptr = untag_ptr(a); - CHECK_ACCESS(a_ptr); - LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr); - a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a)); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) { + LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a); LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); *ret_copy = PaymentError_sending(a_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t logger, int64_t event_handler, int64_t retry) { - void* payer_ptr = untag_ptr(payer); - CHECK_ACCESS(payer_ptr); - LDKPayer payer_conv = *(LDKPayer*)(payer_ptr); - if (payer_conv.free == LDKPayer_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKPayer_JCalls_cloned(&payer_conv); - } - void* router_ptr = untag_ptr(router); - CHECK_ACCESS(router_ptr); - LDKRouter router_conv = *(LDKRouter*)(router_ptr); - if (router_conv.free == LDKRouter_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKRouter_JCalls_cloned(&router_conv); - } - void* logger_ptr = untag_ptr(logger); - CHECK_ACCESS(logger_ptr); - LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - void* event_handler_ptr = untag_ptr(event_handler); - CHECK_ACCESS(event_handler_ptr); - LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr); - if (event_handler_conv.free == LDKEventHandler_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKEventHandler_JCalls_cloned(&event_handler_conv); - } - void* retry_ptr = untag_ptr(retry); - CHECK_ACCESS(retry_ptr); - LDKRetry retry_conv = *(LDKRetry*)(retry_ptr); - retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry)); - LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int8_tArray payment_id) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); - *ret_conv = InvoicePayer_pay_invoice_with_id(&this_arg_conv, &invoice_conv, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats, int8_tArray payment_id) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); - *ret_conv = InvoicePayer_pay_zero_value_invoice_with_id(&this_arg_conv, &invoice_conv, amount_msats, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKThirtyTwoBytes payment_preimage_ref; - CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); - (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int8_tArray payment_id, int64_t amount_msats, int32_t final_cltv_expiry_delta) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKThirtyTwoBytes payment_preimage_ref; - CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); - (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); - *ret_conv = InvoicePayer_pay_pubkey_with_id(&this_arg_conv, pubkey_ref, payment_preimage_ref, payment_id_ref, amount_msats, final_cltv_expiry_delta); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - unsigned char payment_hash_arr[32]; - CHECK((*env)->GetArrayLength(env, payment_hash) == 32); - (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); - unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; - InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t keys_manager, int64_t logger, jclass network) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) { void* amt_msat_ptr = untag_ptr(amt_msat); CHECK_ACCESS(amt_msat_ptr); LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); @@ -53264,12 +54489,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JN phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0); - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53279,12 +54511,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JN LDKLogger_JCalls_cloned(&logger_conv); } LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, keys_manager_conv, logger_conv, network_conv); + *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t keys_manager, int64_t logger, jclass network) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) { void* amt_msat_ptr = untag_ptr(amt_msat); CHECK_ACCESS(amt_msat_ptr); LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); @@ -53314,12 +54550,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1w phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0); - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53329,23 +54572,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1w LDKLogger_JCalls_cloned(&logger_conv); } LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, keys_manager_conv, logger_conv, network_conv); + *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53360,23 +54607,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat)); LDKStr description_conv = java_to_owned_str(env, description); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53395,23 +54646,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan description_hash_conv.is_owned = ptr_is_owned(description_hash); CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); description_hash_conv = Sha256_clone(&description_hash_conv); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53430,23 +54685,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan description_hash_conv.is_owned = ptr_is_owned(description_hash); CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); description_hash_conv = Sha256_clone(&description_hash_conv); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53461,23 +54720,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat)); LDKStr description_conv = java_to_owned_str(env, description); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53495,22 +54758,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKChannelManager this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer"); - *ret_ret = ChannelManager_as_Payer(&this_arg_conv); - return tag_ptr(ret_ret, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); @@ -53596,13 +54852,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv * RapidGossipSync_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = untag_ptr(network_graph); network_graph_conv.is_owned = ptr_is_owned(network_graph); CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); network_graph_conv.is_owned = false; - LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv); + void* logger_ptr = untag_ptr(logger); + CHECK_ACCESS(logger_ptr); + LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -53624,6 +54887,25 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1ne return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) { + LDKRapidGossipSync this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKu8slice update_data_ref; + update_data_ref.datalen = (*env)->GetArrayLength(env, update_data); + update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL); + void* current_time_unix_ptr = untag_ptr(current_time_unix); + CHECK_ACCESS(current_time_unix_ptr); + LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr); + current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix)); + LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); + *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv); + (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0); + return tag_ptr(ret_conv, true); +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) { LDKRapidGossipSync this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 28018ee1..3fc5a887 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -35,6 +35,7 @@ _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits"); typedef jlongArray int64_tArray; typedef jbyteArray int8_tArray; +typedef jshortArray int16_tArray; static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) { // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator @@ -134,40 +135,6 @@ static inline uint64_t tag_ptr(const void* ptr, bool is_owned) { } } -static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) { - jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception."); - } - switch (ord) { - case 0: return LDKAccessError_UnknownChain; - case 1: return LDKAccessError_UnknownTx; - } - (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value."); - abort(); // Unreachable, but will let the compiler know we don't return here -} -static jclass AccessError_class = NULL; -static jfieldID AccessError_LDKAccessError_UnknownChain = NULL; -static jfieldID AccessError_LDKAccessError_UnknownTx = NULL; -JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) { - AccessError_class = (*env)->NewGlobalRef(env, clz); - CHECK(AccessError_class != NULL); - AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;"); - CHECK(AccessError_LDKAccessError_UnknownChain != NULL); - AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;"); - CHECK(AccessError_LDKAccessError_UnknownTx != NULL); -} -static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) { - switch (val) { - case LDKAccessError_UnknownChain: - return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain); - case LDKAccessError_UnknownTx: - return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx); - default: abort(); - } -} - static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) { jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { @@ -294,6 +261,7 @@ static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass cl case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_InvalidAmount; case 4: return LDKCreationError_MissingRouteHints; + case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort; } (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value."); abort(); // Unreachable, but will let the compiler know we don't return here @@ -304,6 +272,7 @@ static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL; static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL; static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL; static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL; +static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) { CreationError_class = (*env)->NewGlobalRef(env, clz); CHECK(CreationError_class != NULL); @@ -317,6 +286,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclas CHECK(CreationError_LDKCreationError_InvalidAmount != NULL); CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL); + CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;"); + CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL); } static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) { switch (val) { @@ -330,6 +301,8 @@ static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount); case LDKCreationError_MissingRouteHints: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints); + case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: + return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort); default: abort(); } } @@ -386,6 +359,46 @@ static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) { } } +static inline LDKFailureCode LDKFailureCode_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKFailureCode_TemporaryNodeFailure; + case 1: return LDKFailureCode_RequiredNodeFeatureMissing; + case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails; + } + (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass FailureCode_class = NULL; +static jfieldID FailureCode_LDKFailureCode_TemporaryNodeFailure = NULL; +static jfieldID FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = NULL; +static jfieldID FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_FailureCode_init (JNIEnv *env, jclass clz) { + FailureCode_class = (*env)->NewGlobalRef(env, clz); + CHECK(FailureCode_class != NULL); + FailureCode_LDKFailureCode_TemporaryNodeFailure = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_TemporaryNodeFailure", "Lorg/ldk/enums/FailureCode;"); + CHECK(FailureCode_LDKFailureCode_TemporaryNodeFailure != NULL); + FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_RequiredNodeFeatureMissing", "Lorg/ldk/enums/FailureCode;"); + CHECK(FailureCode_LDKFailureCode_RequiredNodeFeatureMissing != NULL); + FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_IncorrectOrUnknownPaymentDetails", "Lorg/ldk/enums/FailureCode;"); + CHECK(FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails != NULL); +} +static inline jclass LDKFailureCode_to_java(JNIEnv *env, LDKFailureCode val) { + switch (val) { + case LDKFailureCode_TemporaryNodeFailure: + return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_TemporaryNodeFailure); + case LDKFailureCode_RequiredNodeFeatureMissing: + return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_RequiredNodeFeatureMissing); + case LDKFailureCode_IncorrectOrUnknownPaymentDetails: + return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails); + default: abort(); + } +} + static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) { jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { @@ -706,6 +719,46 @@ static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) { } } +static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKRetryableSendFailure_PaymentExpired; + case 1: return LDKRetryableSendFailure_RouteNotFound; + case 2: return LDKRetryableSendFailure_DuplicatePayment; + } + (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass RetryableSendFailure_class = NULL; +static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL; +static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL; +static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) { + RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz); + CHECK(RetryableSendFailure_class != NULL); + RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;"); + CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL); + RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;"); + CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL); + RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;"); + CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL); +} +static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) { + switch (val) { + case LDKRetryableSendFailure_PaymentExpired: + return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired); + case LDKRetryableSendFailure_RouteNotFound: + return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound); + case LDKRetryableSendFailure_DuplicatePayment: + return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment); + default: abort(); + } +} + static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) { jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { @@ -922,6 +975,40 @@ static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) { } } +static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKUtxoLookupError_UnknownChain; + case 1: return LDKUtxoLookupError_UnknownTx; + } + (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass UtxoLookupError_class = NULL; +static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL; +static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) { + UtxoLookupError_class = (*env)->NewGlobalRef(env, clz); + CHECK(UtxoLookupError_class != NULL); + UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;"); + CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL); + UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;"); + CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL); +} +static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) { + switch (val) { + case LDKUtxoLookupError_UnknownChain: + return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain); + case LDKUtxoLookupError_UnknownTx: + return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx); + default: abort(); + } +} + struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) { LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes }; return ret; @@ -1043,6 +1130,122 @@ uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPO return ret_conv; } +static jclass LDKAPIError_APIMisuseError_class = NULL; +static jmethodID LDKAPIError_APIMisuseError_meth = NULL; +static jclass LDKAPIError_FeeRateTooHigh_class = NULL; +static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL; +static jclass LDKAPIError_InvalidRoute_class = NULL; +static jmethodID LDKAPIError_InvalidRoute_meth = NULL; +static jclass LDKAPIError_ChannelUnavailable_class = NULL; +static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL; +static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL; +static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL; +static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL; +static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) { + LDKAPIError_APIMisuseError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError")); + CHECK(LDKAPIError_APIMisuseError_class != NULL); + LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKAPIError_APIMisuseError_meth != NULL); + LDKAPIError_FeeRateTooHigh_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh")); + CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); + LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(Ljava/lang/String;I)V"); + CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); + LDKAPIError_InvalidRoute_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute")); + CHECK(LDKAPIError_InvalidRoute_class != NULL); + LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKAPIError_InvalidRoute_meth != NULL); + LDKAPIError_ChannelUnavailable_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable")); + CHECK(LDKAPIError_ChannelUnavailable_class != NULL); + LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); + LDKAPIError_MonitorUpdateInProgress_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress")); + CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL); + LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "", "()V"); + CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL); + LDKAPIError_IncompatibleShutdownScript_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript")); + CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL); + LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "", "(J)V"); + CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + switch(obj->tag) { + case LDKAPIError_APIMisuseError: { + LDKStr err_str = obj->api_misuse_error.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv); + } + case LDKAPIError_FeeRateTooHigh: { + LDKStr err_str = obj->fee_rate_too_high.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + int32_t feerate_conv = obj->fee_rate_too_high.feerate; + return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv); + } + case LDKAPIError_InvalidRoute: { + LDKStr err_str = obj->invalid_route.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv); + } + case LDKAPIError_ChannelUnavailable: { + LDKStr err_str = obj->channel_unavailable.err; + jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); + return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv); + } + case LDKAPIError_MonitorUpdateInProgress: { + return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth); + } + case LDKAPIError_IncompatibleShutdownScript: { + LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; + int64_t script_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var); + script_ref = tag_ptr(script_var.inner, false); + return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref); + } + default: abort(); + } +} +static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); + CResult_NoneAPIErrorZ_get_ok(owner_conv); +} + +static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return APIError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); + LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); + *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { + LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); + } + return ret; +} +static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { + LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = APIError_clone(&orig->data[i]); + } + return ret; +} static jclass LDKCOption_HTLCClaimZ_Some_class = NULL; static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL; static jclass LDKCOption_HTLCClaimZ_None_class = NULL; @@ -2600,6 +2803,165 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDeco return ret_ref; } +static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL; +static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL; +static jclass LDKNetworkUpdate_ChannelFailure_class = NULL; +static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL; +static jclass LDKNetworkUpdate_NodeFailure_class = NULL; +static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) { + LDKNetworkUpdate_ChannelUpdateMessage_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage")); + CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL); + LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "", "(J)V"); + CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL); + LDKNetworkUpdate_ChannelFailure_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure")); + CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL); + LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "", "(JZ)V"); + CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL); + LDKNetworkUpdate_NodeFailure_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure")); + CHECK(LDKNetworkUpdate_NodeFailure_class != NULL); + LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "", "([BZ)V"); + CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + switch(obj->tag) { + case LDKNetworkUpdate_ChannelUpdateMessage: { + LDKChannelUpdate msg_var = obj->channel_update_message.msg; + int64_t msg_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, false); + return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref); + } + case LDKNetworkUpdate_ChannelFailure: { + int64_t short_channel_id_conv = obj->channel_failure.short_channel_id; + jboolean is_permanent_conv = obj->channel_failure.is_permanent; + return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv); + } + case LDKNetworkUpdate_NodeFailure: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form); + jboolean is_permanent_conv = obj->node_failure.is_permanent; + return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv); + } + default: abort(); + } +} +static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL; +static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL; +static jclass LDKCOption_NetworkUpdateZ_None_class = NULL; +static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) { + LDKCOption_NetworkUpdateZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some")); + CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL); + LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL); + LDKCOption_NetworkUpdateZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None")); + CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL); + LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "", "()V"); + CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_NetworkUpdateZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref); + } + case LDKCOption_NetworkUpdateZ_None: { + return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth); + } + default: abort(); + } +} +static jclass LDKPathFailure_InitialSend_class = NULL; +static jmethodID LDKPathFailure_InitialSend_meth = NULL; +static jclass LDKPathFailure_OnPath_class = NULL; +static jmethodID LDKPathFailure_OnPath_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) { + LDKPathFailure_InitialSend_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend")); + CHECK(LDKPathFailure_InitialSend_class != NULL); + LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "", "(J)V"); + CHECK(LDKPathFailure_InitialSend_meth != NULL); + LDKPathFailure_OnPath_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath")); + CHECK(LDKPathFailure_OnPath_class != NULL); + LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "", "(J)V"); + CHECK(LDKPathFailure_OnPath_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr); + switch(obj->tag) { + case LDKPathFailure_InitialSend: { + int64_t err_ref = tag_ptr(&obj->initial_send.err, false); + return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref); + } + case LDKPathFailure_OnPath: { + int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false); + return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref); + } + default: abort(); + } +} +static jclass LDKCOption_PathFailureZ_Some_class = NULL; +static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL; +static jclass LDKCOption_PathFailureZ_None_class = NULL; +static jmethodID LDKCOption_PathFailureZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) { + LDKCOption_PathFailureZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some")); + CHECK(LDKCOption_PathFailureZ_Some_class != NULL); + LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_PathFailureZ_Some_meth != NULL); + LDKCOption_PathFailureZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None")); + CHECK(LDKCOption_PathFailureZ_None_class != NULL); + LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "", "()V"); + CHECK(LDKCOption_PathFailureZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_PathFailureZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref); + } + case LDKCOption_PathFailureZ_None: { + return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth); + } + default: abort(); + } +} +static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_PathFailureZ_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL; static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL; static jclass LDKClosureReason_HolderForceClosed_class = NULL; @@ -2884,82 +3246,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u128Z_1ref_1fro default: abort(); } } -static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL; -static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL; -static jclass LDKNetworkUpdate_ChannelFailure_class = NULL; -static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL; -static jclass LDKNetworkUpdate_NodeFailure_class = NULL; -static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) { - LDKNetworkUpdate_ChannelUpdateMessage_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage")); - CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL); - LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "", "(J)V"); - CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL); - LDKNetworkUpdate_ChannelFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure")); - CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL); - LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "", "(JZ)V"); - CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL); - LDKNetworkUpdate_NodeFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure")); - CHECK(LDKNetworkUpdate_NodeFailure_class != NULL); - LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "", "([BZ)V"); - CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - switch(obj->tag) { - case LDKNetworkUpdate_ChannelUpdateMessage: { - LDKChannelUpdate msg_var = obj->channel_update_message.msg; - int64_t msg_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); - msg_ref = tag_ptr(msg_var.inner, false); - return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref); - } - case LDKNetworkUpdate_ChannelFailure: { - int64_t short_channel_id_conv = obj->channel_failure.short_channel_id; - jboolean is_permanent_conv = obj->channel_failure.is_permanent; - return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv); - } - case LDKNetworkUpdate_NodeFailure: { - int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form); - jboolean is_permanent_conv = obj->node_failure.is_permanent; - return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv); - } - default: abort(); - } -} -static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL; -static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL; -static jclass LDKCOption_NetworkUpdateZ_None_class = NULL; -static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) { - LDKCOption_NetworkUpdateZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some")); - CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL); - LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "", "(J)V"); - CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL); - LDKCOption_NetworkUpdateZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None")); - CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL); - LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "", "()V"); - CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); - switch(obj->tag) { - case LDKCOption_NetworkUpdateZ_Some: { - int64_t some_ref = tag_ptr(&obj->some, false); - return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref); - } - case LDKCOption_NetworkUpdateZ_None: { - return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth); - } - default: abort(); - } -} static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL; static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL; static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL; @@ -3088,7 +3374,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_PaymentPathFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); - LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); + LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); LDKEvent_ProbeSuccessful_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful")); @@ -3225,8 +3511,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data); jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently; - int64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false); - jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed; + int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false); LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path; int64_tArray path_arr = NULL; path_arr = (*env)->NewLongArray(env, path_var.datalen); @@ -3244,7 +3529,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int64_t retry_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var); retry_ref = tag_ptr(retry_var.inner, false); - return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, payment_failed_permanently_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref); + return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, payment_failed_permanently_conv, failure_ref, path_arr, short_channel_id_ref, retry_ref); } case LDKEvent_ProbeSuccessful: { int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); @@ -3534,6 +3819,8 @@ static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL; static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL; static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL; static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL; +static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL; +static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL; static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL; static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL; static jclass LDKMessageSendEvent_HandleError_class = NULL; @@ -3617,6 +3904,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL); LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "", "(J)V"); CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL); + LDKMessageSendEvent_BroadcastNodeAnnouncement_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement")); + CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL); + LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "", "(J)V"); + CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL); LDKMessageSendEvent_SendChannelUpdate_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate")); CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL); @@ -3781,6 +4073,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f msg_ref = tag_ptr(msg_var.inner, false); return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref); } + case LDKMessageSendEvent_BroadcastNodeAnnouncement: { + LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg; + int64_t msg_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, false); + return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref); + } case LDKMessageSendEvent_SendChannelUpdate: { int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form); @@ -3842,27 +4141,6 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return TxOut_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner); - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv); - return tag_ptr(ret_ref, true); -} - -static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return AccessError_clone(&*owner->contents.err); -} -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner); - jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv)); - return ret_conv; -} - static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){ return owner->a; } @@ -4115,6 +4393,77 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64 default: abort(); } } +static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){ + return owner->a; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_a(owner_conv).data); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){ + return owner->b; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_b(owner_conv).data); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){ + return owner->a; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_a(owner_conv).data); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){ + return owner->b; +} +JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner); + int16_tArray ret_arr = (*env)->NewShortArray(env, 8); + (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_b(owner_conv).data); + return ret_arr; +} + +static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = NULL; +static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = NULL; +static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = NULL; +static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_init (JNIEnv *env, jclass clz) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$Some")); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class != NULL); + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth != NULL); + LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$None")); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class != NULL); + LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, "", "()V"); + CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: { + LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *some_conv = obj->some; + *some_conv = C2Tuple__u168_u168Z_clone(some_conv); + return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth, tag_ptr(some_conv, true)); + } + case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: { + return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth); + } + default: abort(); + } +} static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) { LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -4326,80 +4675,54 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDec return ret_ref; } -static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKChannelTypeFeatures ret = *owner->contents.result; +static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKBlindedHopFeatures ret = *owner->contents.result; ret.is_owned = false; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKOfferFeatures CResult_OfferFeaturesDecodeErrorZ_get_ok(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKOfferFeatures ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKOfferFeatures ret_var = CResult_OfferFeaturesDecodeErrorZ_get_ok(owner_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_OfferFeaturesDecodeErrorZ_get_err(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_OfferFeaturesDecodeErrorZ_get_err(owner_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKInvoiceRequestFeatures CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKInvoiceRequestFeatures ret = *owner->contents.result; +static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKChannelTypeFeatures ret = *owner->contents.result; ret.is_owned = false; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKInvoiceRequestFeatures ret_var = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -4454,14 +4777,70 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUp return ret_ref; } -typedef struct LDKAccess_JCalls { +static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return TxOut_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner); + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv); + return tag_ptr(ret_ref, true); +} + +static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return UtxoLookupError_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner); + jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static jclass LDKUtxoResult_Sync_class = NULL; +static jmethodID LDKUtxoResult_Sync_meth = NULL; +static jclass LDKUtxoResult_Async_class = NULL; +static jmethodID LDKUtxoResult_Async_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) { + LDKUtxoResult_Sync_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync")); + CHECK(LDKUtxoResult_Sync_class != NULL); + LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "", "(J)V"); + CHECK(LDKUtxoResult_Sync_meth != NULL); + LDKUtxoResult_Async_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async")); + CHECK(LDKUtxoResult_Async_class != NULL); + LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "", "(J)V"); + CHECK(LDKUtxoResult_Async_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr); + switch(obj->tag) { + case LDKUtxoResult_Sync: { + LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *sync_conv = obj->sync; + *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv); + return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true)); + } + case LDKUtxoResult_Async: { + LDKUtxoFuture async_var = obj->async; + int64_t async_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var); + async_ref = tag_ptr(async_var.inner, false); + return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref); + } + default: abort(); + } +} +typedef struct LDKUtxoLookup_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; jmethodID get_utxo_meth; -} LDKAccess_JCalls; -static void LDKAccess_JCalls_free(void* this_arg) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; +} LDKUtxoLookup_JCalls; +static void LDKUtxoLookup_JCalls_free(void* this_arg) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -4477,8 +4856,8 @@ static void LDKAccess_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; +LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_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) { @@ -4494,87 +4873,88 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception."); + (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr); + LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg; +static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls"); + LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J"); CHECK(calls->get_utxo_meth != NULL); - LDKAccess ret = { + LDKUtxoLookup ret = { .this_arg = (void*) calls, - .get_utxo = get_utxo_LDKAccess_jcall, - .free = LDKAccess_JCalls_free, + .get_utxo = get_utxo_LDKUtxoLookup_jcall, + .free = LDKUtxoLookup_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) { - LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess"); - *res_ptr = LDKAccess_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) { + LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup"); + *res_ptr = LDKUtxoLookup_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr; - unsigned char genesis_hash_arr[32]; + LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr; + uint8_t genesis_hash_arr[32]; CHECK((*env)->GetArrayLength(env, genesis_hash) == 32); (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr); - unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr; - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); - return tag_ptr(ret_conv, true); -} - -static jclass LDKCOption_AccessZ_Some_class = NULL; -static jmethodID LDKCOption_AccessZ_Some_meth = NULL; -static jclass LDKCOption_AccessZ_None_class = NULL; -static jmethodID LDKCOption_AccessZ_None_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) { - LDKCOption_AccessZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some")); - CHECK(LDKCOption_AccessZ_Some_class != NULL); - LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "", "(J)V"); - CHECK(LDKCOption_AccessZ_Some_meth != NULL); - LDKCOption_AccessZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None")); - CHECK(LDKCOption_AccessZ_None_class != NULL); - LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "", "()V"); - CHECK(LDKCOption_AccessZ_None_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr); + uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr; + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static jclass LDKCOption_UtxoLookupZ_Some_class = NULL; +static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL; +static jclass LDKCOption_UtxoLookupZ_None_class = NULL; +static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) { + LDKCOption_UtxoLookupZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some")); + CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL); + LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL); + LDKCOption_UtxoLookupZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None")); + CHECK(LDKCOption_UtxoLookupZ_None_class != NULL); + LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "", "()V"); + CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr); switch(obj->tag) { - case LDKCOption_AccessZ_Some: { - LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess"); + case LDKCOption_UtxoLookupZ_Some: { + LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup"); *some_ret = obj->some; // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances - if ((*some_ret).free == LDKAccess_JCalls_free) { + if ((*some_ret).free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&(*some_ret)); + LDKUtxoLookup_JCalls_cloned(&(*some_ret)); } - return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, tag_ptr(some_ret, true)); + return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true)); } - case LDKCOption_AccessZ_None: { - return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth); + case LDKCOption_UtxoLookupZ_None: { + return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth); } default: abort(); } @@ -5152,66 +5532,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1 CResult_SignatureNoneZ_get_err(owner_conv); } -static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){ - return owner->a; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form); - return ret_arr; -} - -static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){ - return owner->b; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form); - return ret_arr; -} - -static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv); - return tag_ptr(ret_conv, true); -} - -static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner); - CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv); -} - -static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes); - return ret_arr; -} - -static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner); - CResult_SecretKeyNoneZ_get_err(owner_conv); -} - static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -5281,7 +5601,27 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ge CResult_SharedSecretNoneZ_get_err(owner_conv); } -typedef struct LDKBaseSign_JCalls { +static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); + int8_tArray ret_arr = (*env)->NewByteArray(env, 68); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form); + return ret_arr; +} + +static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); + CResult_RecoverableSignatureNoneZ_get_err(owner_conv); +} + +typedef struct LDKChannelSigner_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; @@ -5289,19 +5629,10 @@ typedef struct LDKBaseSign_JCalls { jmethodID release_commitment_secret_meth; jmethodID validate_holder_commitment_meth; jmethodID channel_keys_id_meth; - jmethodID sign_counterparty_commitment_meth; - jmethodID validate_counterparty_revocation_meth; - jmethodID sign_holder_commitment_and_htlcs_meth; - jmethodID sign_justice_revoked_output_meth; - jmethodID sign_justice_revoked_htlc_meth; - jmethodID sign_counterparty_htlc_transaction_meth; - jmethodID sign_closing_transaction_meth; - jmethodID sign_holder_anchor_input_meth; - jmethodID sign_channel_announcement_meth; jmethodID provide_channel_parameters_meth; -} LDKBaseSign_JCalls; -static void LDKBaseSign_JCalls_free(void* this_arg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +} LDKChannelSigner_JCalls; +static void LDKChannelSigner_JCalls_free(void* this_arg) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -5317,8 +5648,8 @@ static void LDKBaseSign_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5332,7 +5663,7 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception."); } LDKPublicKey ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 33); @@ -5342,8 +5673,8 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui } return ret_ref; } -LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5357,7 +5688,7 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception."); } LDKThirtyTwoBytes ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 32); @@ -5367,8 +5698,8 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a } return ret_ref; } -LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5397,7 +5728,7 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5408,8 +5739,8 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th } return ret_conv; } -LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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) { @@ -5422,7 +5753,7 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception."); } LDKThirtyTwoBytes ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 32); @@ -5432,8 +5763,188 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { } return ret_ref; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_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); + } + LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; + int64_t channel_parameters_ref = 0; + channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); + channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} +static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B"); + CHECK(calls->get_per_commitment_point_meth != NULL); + calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B"); + CHECK(calls->release_commitment_secret_meth != NULL); + calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J"); + CHECK(calls->validate_holder_commitment_meth != NULL); + calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B"); + CHECK(calls->channel_keys_id_meth != NULL); + calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V"); + CHECK(calls->provide_channel_parameters_meth != NULL); + + LDKChannelPublicKeys pubkeys_conv; + pubkeys_conv.inner = untag_ptr(pubkeys); + pubkeys_conv.is_owned = ptr_is_owned(pubkeys); + CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); + + LDKChannelSigner ret = { + .this_arg = (void*) calls, + .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall, + .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall, + .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall, + .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall, + .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall, + .free = LDKChannelSigner_JCalls_free, + .pubkeys = pubkeys_conv, + .set_pubkeys = NULL, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { + LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner"); + *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKHolderCommitmentTransaction holder_tx_conv; + holder_tx_conv.inner = untag_ptr(holder_tx); + holder_tx_conv.is_owned = ptr_is_owned(holder_tx); + CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); + holder_tx_conv.is_owned = false; + LDKCVec_PaymentPreimageZ preimages_constr; + preimages_constr.datalen = (*env)->GetArrayLength(env, preimages); + if (preimages_constr.datalen > 0) + preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); + else + preimages_constr.data = NULL; + for (size_t i = 0; i < preimages_constr.datalen; i++) { + int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i); + LDKThirtyTwoBytes preimages_conv_8_ref; + CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32); + (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data); + preimages_constr.data[i] = preimages_conv_8_ref; + } + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKChannelTransactionParameters channel_parameters_conv; + channel_parameters_conv.inner = untag_ptr(channel_parameters); + channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv); + channel_parameters_conv.is_owned = false; + (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); +} + +LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) { + if (this_arg->set_pubkeys != NULL) + this_arg->set_pubkeys(this_arg); + return this_arg->pubkeys; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +typedef struct LDKEcdsaChannelSigner_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + LDKChannelSigner_JCalls* ChannelSigner; + jmethodID sign_counterparty_commitment_meth; + jmethodID validate_counterparty_revocation_meth; + jmethodID sign_holder_commitment_and_htlcs_meth; + jmethodID sign_justice_revoked_output_meth; + jmethodID sign_justice_revoked_htlc_meth; + jmethodID sign_counterparty_htlc_transaction_meth; + jmethodID sign_closing_transaction_meth; + jmethodID sign_holder_anchor_input_meth; + jmethodID sign_channel_announcement_with_funding_key_meth; +} LDKEcdsaChannelSigner_JCalls; +static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5462,7 +5973,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5473,8 +5984,8 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L } return ret_conv; } -LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5490,7 +6001,7 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const vo uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5501,8 +6012,8 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const vo } return ret_conv; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5520,7 +6031,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5531,8 +6042,8 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl } return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5553,7 +6064,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5564,8 +6075,8 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo } return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5591,7 +6102,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5602,8 +6113,8 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void } return ret_conv; } -LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5629,7 +6140,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5640,8 +6151,8 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c } return ret_conv; } -LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5659,7 +6170,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5670,8 +6181,8 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* } return ret_conv; } -LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5689,7 +6200,7 @@ LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -5700,8 +6211,8 @@ LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* } return ret_conv; } -LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_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) { @@ -5716,60 +6227,32 @@ LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSig msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr); + LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -void provide_channel_parameters_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_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); - } - LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; - int64_t channel_parameters_ref = 0; - channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); - channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to provide_channel_parameters in LDKBaseSign from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } +static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release); } -static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { +static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls"); + LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B"); - CHECK(calls->get_per_commitment_point_meth != NULL); - calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B"); - CHECK(calls->release_commitment_secret_meth != NULL); - calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J"); - CHECK(calls->validate_holder_commitment_meth != NULL); - calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B"); - CHECK(calls->channel_keys_id_meth != NULL); calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J"); CHECK(calls->sign_counterparty_commitment_meth != NULL); calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J"); @@ -5786,101 +6269,44 @@ static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, CHECK(calls->sign_closing_transaction_meth != NULL); calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J"); CHECK(calls->sign_holder_anchor_input_meth != NULL); - calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J"); - CHECK(calls->sign_channel_announcement_meth != NULL); - calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V"); - CHECK(calls->provide_channel_parameters_meth != NULL); + calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J"); + CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL); LDKChannelPublicKeys pubkeys_conv; pubkeys_conv.inner = untag_ptr(pubkeys); pubkeys_conv.is_owned = ptr_is_owned(pubkeys); CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); - LDKBaseSign ret = { + LDKEcdsaChannelSigner ret = { .this_arg = (void*) calls, - .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall, - .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall, - .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall, - .channel_keys_id = channel_keys_id_LDKBaseSign_jcall, - .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall, - .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall, - .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall, - .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall, - .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall, - .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall, - .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall, - .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall, - .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall, - .provide_channel_parameters = provide_channel_parameters_LDKBaseSign_jcall, - .free = LDKBaseSign_JCalls_free, - .pubkeys = pubkeys_conv, - .set_pubkeys = NULL, + .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall, + .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall, + .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall, + .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall, + .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall, + .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall, + .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall, + .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall, + .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall, + .free = LDKEcdsaChannelSigner_JCalls_free, + .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys), }; + calls->ChannelSigner = ret.ChannelSigner.this_arg; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { - LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); - *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) { + LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner"); + *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys); return tag_ptr(res_ptr, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); - return ret_arr; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - LDKHolderCommitmentTransaction holder_tx_conv; - holder_tx_conv.inner = untag_ptr(holder_tx); - holder_tx_conv.is_owned = ptr_is_owned(holder_tx); - CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); - holder_tx_conv.is_owned = false; - LDKCVec_PaymentPreimageZ preimages_constr; - preimages_constr.datalen = (*env)->GetArrayLength(env, preimages); - if (preimages_constr.datalen > 0) - preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); - else - preimages_constr.data = NULL; - for (size_t i = 0; i < preimages_constr.datalen; i++) { - int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i); - LDKThirtyTwoBytes preimages_conv_8_ref; - CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32); - (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data); - preimages_constr.data[i] = preimages_conv_8_ref; - } - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data); - return ret_arr; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) { + LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg); + return tag_ptr(&inp->ChannelSigner, false); } - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = untag_ptr(commitment_tx); commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); @@ -5904,23 +6330,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterpart return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - unsigned char secret_arr[32]; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; + uint8_t secret_arr[32]; CHECK((*env)->GetArrayLength(env, secret) == 32); (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr); - unsigned char (*secret_ref)[32] = &secret_arr; + uint8_t (*secret_ref)[32] = &secret_arr; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKHolderCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = untag_ptr(commitment_tx); commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); @@ -5931,37 +6357,37 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1com return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx); justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data); justice_tx_ref.data_is_owned = true; - unsigned char per_commitment_key_arr[32]; + uint8_t per_commitment_key_arr[32]; CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32); (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr); - unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr; + uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr; LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx); justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data); justice_tx_ref.data_is_owned = true; - unsigned char per_commitment_key_arr[32]; + uint8_t per_commitment_key_arr[32]; CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32); (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr); - unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr; + uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr; LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = untag_ptr(htlc); htlc_conv.is_owned = ptr_is_owned(htlc); @@ -5972,10 +6398,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1re return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction htlc_tx_ref; htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx); htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes"); @@ -5994,10 +6420,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterpart return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKClosingTransaction closing_tx_conv; closing_tx_conv.inner = untag_ptr(closing_tx); closing_tx_conv.is_owned = ptr_is_owned(closing_tx); @@ -6008,10 +6434,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1tr return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction anchor_tx_ref; anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx); anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes"); @@ -6022,57 +6448,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1anc return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1channel_1announcement_1with_1funding_1key(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKUnsignedChannelAnnouncement msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv); + LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - LDKChannelTransactionParameters channel_parameters_conv; - channel_parameters_conv.inner = untag_ptr(channel_parameters); - channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); - CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv); - channel_parameters_conv.is_owned = false; - (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); -} - -LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) { - if (this_arg->set_pubkeys != NULL) - this_arg->set_pubkeys(this_arg); - return this_arg->pubkeys; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; - LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -typedef struct LDKSign_JCalls { +typedef struct LDKWriteableEcdsaChannelSigner_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; - LDKBaseSign_JCalls* BaseSign; + LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner; + LDKChannelSigner_JCalls* ChannelSigner; jmethodID write_meth; -} LDKSign_JCalls; -static void LDKSign_JCalls_free(void* this_arg) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; +} LDKWriteableEcdsaChannelSigner_JCalls; +static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -6088,8 +6487,8 @@ static void LDKSign_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; +LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_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) { @@ -6102,7 +6501,7 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception."); + (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception."); } LDKCVec_u8Z ret_ref; ret_ref.datalen = (*env)->GetArrayLength(env, ret); @@ -6113,15 +6512,16 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { } return ret_ref; } -static void LDKSign_JCalls_cloned(LDKSign* new_obj) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg; +static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); - atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release); } -static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) { +static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls"); + LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); @@ -6133,29 +6533,34 @@ static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject pubkeys_conv.is_owned = ptr_is_owned(pubkeys); CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); - LDKSign ret = { + LDKWriteableEcdsaChannelSigner ret = { .this_arg = (void*) calls, - .write = write_LDKSign_jcall, - .cloned = LDKSign_JCalls_cloned, - .free = LDKSign_JCalls_free, - .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys), + .write = write_LDKWriteableEcdsaChannelSigner_jcall, + .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned, + .free = LDKWriteableEcdsaChannelSigner_JCalls_free, + .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys), }; - calls->BaseSign = ret.BaseSign.this_arg; + calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg; + calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) { - LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign"); - *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) { + LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) { - LDKSign *inp = (LDKSign *)untag_ptr(arg); - return tag_ptr(&inp->BaseSign, false); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) { + LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg); + return tag_ptr(&inp->EcdsaChannelSigner, false); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) { + LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg); + return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr; + LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr; LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); @@ -6163,49 +6568,29 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env return ret_arr; } -static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return Sign_clone(&*owner->contents.result); + return WriteableEcdsaChannelSigner_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner); - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv); return tag_ptr(ret_ret, true); } -static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); - int8_tArray ret_arr = (*env)->NewByteArray(env, 68); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form); - return ret_arr; -} - -static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); - CResult_RecoverableSignatureNoneZ_get_err(owner_conv); -} - static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) { LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -6388,122 +6773,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from default: abort(); } } -static jclass LDKAPIError_APIMisuseError_class = NULL; -static jmethodID LDKAPIError_APIMisuseError_meth = NULL; -static jclass LDKAPIError_FeeRateTooHigh_class = NULL; -static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL; -static jclass LDKAPIError_InvalidRoute_class = NULL; -static jmethodID LDKAPIError_InvalidRoute_meth = NULL; -static jclass LDKAPIError_ChannelUnavailable_class = NULL; -static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL; -static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL; -static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL; -static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL; -static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) { - LDKAPIError_APIMisuseError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError")); - CHECK(LDKAPIError_APIMisuseError_class != NULL); - LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(Ljava/lang/String;)V"); - CHECK(LDKAPIError_APIMisuseError_meth != NULL); - LDKAPIError_FeeRateTooHigh_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh")); - CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); - LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(Ljava/lang/String;I)V"); - CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); - LDKAPIError_InvalidRoute_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute")); - CHECK(LDKAPIError_InvalidRoute_class != NULL); - LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "", "(Ljava/lang/String;)V"); - CHECK(LDKAPIError_InvalidRoute_meth != NULL); - LDKAPIError_ChannelUnavailable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable")); - CHECK(LDKAPIError_ChannelUnavailable_class != NULL); - LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(Ljava/lang/String;)V"); - CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); - LDKAPIError_MonitorUpdateInProgress_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress")); - CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL); - LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "", "()V"); - CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL); - LDKAPIError_IncompatibleShutdownScript_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript")); - CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL); - LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "", "(J)V"); - CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - switch(obj->tag) { - case LDKAPIError_APIMisuseError: { - LDKStr err_str = obj->api_misuse_error.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv); - } - case LDKAPIError_FeeRateTooHigh: { - LDKStr err_str = obj->fee_rate_too_high.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - int32_t feerate_conv = obj->fee_rate_too_high.feerate; - return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv); - } - case LDKAPIError_InvalidRoute: { - LDKStr err_str = obj->invalid_route.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv); - } - case LDKAPIError_ChannelUnavailable: { - LDKStr err_str = obj->channel_unavailable.err; - jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); - return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv); - } - case LDKAPIError_MonitorUpdateInProgress: { - return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth); - } - case LDKAPIError_IncompatibleShutdownScript: { - LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; - int64_t script_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var); - script_ref = tag_ptr(script_var.inner, false); - return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref); - } - default: abort(); - } -} -static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); - CResult_NoneAPIErrorZ_get_ok(owner_conv); -} - -static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return APIError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); - LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); - *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { - LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); - } - return ret; -} -static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { - LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = APIError_clone(&orig->data[i]); - } - return ret; -} static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return ThirtyTwoBytes_clone(&*owner->contents.result); @@ -6527,6 +6796,58 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1g return ret_ref; } +static jclass LDKRecentPaymentDetails_Pending_class = NULL; +static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL; +static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL; +static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL; +static jclass LDKRecentPaymentDetails_Abandoned_class = NULL; +static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) { + LDKRecentPaymentDetails_Pending_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending")); + CHECK(LDKRecentPaymentDetails_Pending_class != NULL); + LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "", "([BJ)V"); + CHECK(LDKRecentPaymentDetails_Pending_meth != NULL); + LDKRecentPaymentDetails_Fulfilled_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled")); + CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL); + LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "", "([B)V"); + CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL); + LDKRecentPaymentDetails_Abandoned_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned")); + CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL); + LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "", "([B)V"); + CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + switch(obj->tag) { + case LDKRecentPaymentDetails_Pending: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data); + int64_t total_msat_conv = obj->pending.total_msat; + return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_hash_arr, total_msat_conv); + } + case LDKRecentPaymentDetails_Fulfilled: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->fulfilled.payment_hash.data); + return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_hash_arr); + } + case LDKRecentPaymentDetails_Abandoned: { + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data); + return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_hash_arr); + } + default: abort(); + } +} +static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) { + LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]); + } + return ret; +} static jclass LDKPaymentSendFailure_ParameterError_class = NULL; static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL; static jclass LDKPaymentSendFailure_PathParameterError_class = NULL; @@ -6644,6 +6965,25 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai return ret_ref; } +static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner); + CResult_NoneRetryableSendFailureZ_get_ok(owner_conv); +} + +static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return RetryableSendFailure_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner); + jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return ThirtyTwoBytes_clone(&*owner->contents.result); @@ -6667,6 +7007,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPayment return ret_ref; } +static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ThirtyTwoBytes_clone(&*owner->contents.result); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data); + return ret_arr; +} + +static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return RetryableSendFailure_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner); + jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){ return ThirtyTwoBytes_clone(&owner->a); } @@ -7012,7 +7373,7 @@ LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, } return ret_conv; } -LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { +LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) { 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); @@ -7025,8 +7386,9 @@ LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg int64_t funding_txo_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var); funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned); - LDKChannelMonitorUpdate update_var = update; + LDKChannelMonitorUpdate update_var = *update; int64_t update_ref = 0; + update_var = ChannelMonitorUpdate_clone(&update_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); update_ref = tag_ptr(update_var.inner, update_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); @@ -7142,8 +7504,8 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEn update_conv.inner = untag_ptr(update); update_conv.is_owned = ptr_is_owned(update); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv); - update_conv = ChannelMonitorUpdate_clone(&update_conv); - jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv)); + update_conv.is_owned = false; + jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv)); return ret_conv; } @@ -7250,24 +7612,150 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcas (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref); } -typedef struct LDKKeysInterface_JCalls { +typedef struct LDKEntropySource_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; - jmethodID get_node_secret_meth; + jmethodID get_secure_random_bytes_meth; +} LDKEntropySource_JCalls; +static void LDKEntropySource_JCalls_free(void* this_arg) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_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); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception."); + } + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_ref; +} +static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B"); + CHECK(calls->get_secure_random_bytes_meth != NULL); + + LDKEntropySource ret = { + .this_arg = (void*) calls, + .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall, + .free = LDKEntropySource_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) { + LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *res_ptr = LDKEntropySource_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); + return ret_arr; +} + +static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL; +static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL; +static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL; +static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL; +static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL; +static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) { + LDKUnsignedGossipMessage_ChannelAnnouncement_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement")); + CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL); + LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "", "(J)V"); + CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL); + LDKUnsignedGossipMessage_ChannelUpdate_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate")); + CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL); + LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "", "(J)V"); + CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL); + LDKUnsignedGossipMessage_NodeAnnouncement_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement")); + CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL); + LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "", "(J)V"); + CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr); + switch(obj->tag) { + case LDKUnsignedGossipMessage_ChannelAnnouncement: { + LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement; + int64_t channel_announcement_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var); + channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false); + return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref); + } + case LDKUnsignedGossipMessage_ChannelUpdate: { + LDKUnsignedChannelUpdate channel_update_var = obj->channel_update; + int64_t channel_update_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var); + channel_update_ref = tag_ptr(channel_update_var.inner, false); + return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref); + } + case LDKUnsignedGossipMessage_NodeAnnouncement: { + LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement; + int64_t node_announcement_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var); + node_announcement_ref = tag_ptr(node_announcement_var.inner, false); + return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref); + } + default: abort(); + } +} +typedef struct LDKNodeSigner_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID get_inbound_payment_key_material_meth; jmethodID get_node_id_meth; jmethodID ecdh_meth; - jmethodID get_destination_script_meth; - jmethodID get_shutdown_scriptpubkey_meth; - jmethodID generate_channel_keys_id_meth; - jmethodID derive_channel_signer_meth; - jmethodID get_secure_random_bytes_meth; - jmethodID read_chan_signer_meth; jmethodID sign_invoice_meth; - jmethodID get_inbound_payment_key_material_meth; -} LDKKeysInterface_JCalls; -static void LDKKeysInterface_JCalls_free(void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + jmethodID sign_gossip_message_meth; +} LDKNodeSigner_JCalls; +static void LDKNodeSigner_JCalls_free(void* this_arg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -7283,8 +7771,8 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7292,25 +7780,23 @@ LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* thi } else { DO_ASSERT(get_jenv_res == JNI_OK); } - jclass recipient_conv = LDKRecipient_to_java(env, recipient); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception."); } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr); - FREE(untag_ptr(ret)); + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_conv; + return ret_ref; } -LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7324,7 +7810,7 @@ LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_ar uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_node_id in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -7335,8 +7821,8 @@ LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_ar } return ret_conv; } -LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7355,7 +7841,7 @@ LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, L uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to ecdh in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -7366,8 +7852,8 @@ LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, L } return ret_conv; } -LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7375,24 +7861,38 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKu8slice hrp_bytes_var = hrp_bytes; + int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen); + (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data); + LDKCVec_U5Z invoice_data_var = invoice_data; + jobjectArray invoice_data_arr = NULL; + invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen); + int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL); + for (size_t h = 0; h < invoice_data_var.datalen; h++) { + uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0; + invoice_data_arr_ptr[h] = invoice_data_conv_7_val; + } + (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0); + FREE(invoice_data_var.data); + jclass recipient_conv = LDKRecipient_to_java(env, recipient); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception."); } - LDKCVec_u8Z ret_ref; - ret_ref.datalen = (*env)->GetArrayLength(env, ret); - ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr); + FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_ref; + return ret_conv; } -LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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) { @@ -7400,24 +7900,168 @@ LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* t } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *msg_copy = msg; + int64_t msg_ref = tag_ptr(msg_copy, true); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception."); } - LDKShutdownScript ret_conv; - ret_conv.inner = untag_ptr(ret); - ret_conv.is_owned = ptr_is_owned(ret); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); + FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B"); + CHECK(calls->get_inbound_payment_key_material_meth != NULL); + calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J"); + CHECK(calls->get_node_id_meth != NULL); + calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J"); + CHECK(calls->ecdh_meth != NULL); + calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J"); + CHECK(calls->sign_invoice_meth != NULL); + calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J"); + CHECK(calls->sign_gossip_message_meth != NULL); + + LDKNodeSigner ret = { + .this_arg = (void*) calls, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall, + .get_node_id = get_node_id_LDKNodeSigner_jcall, + .ecdh = ecdh_LDKNodeSigner_jcall, + .sign_invoice = sign_invoice_LDKNodeSigner_jcall, + .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall, + .free = LDKNodeSigner_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) { + LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *res_ptr = LDKNodeSigner_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); + LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ"); + *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); + LDKPublicKey other_key_ref; + CHECK((*env)->GetArrayLength(env, other_key) == 33); + (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form); + void* tweak_ptr = untag_ptr(tweak); + CHECK_ACCESS(tweak_ptr); + LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ + LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); + *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass recipient) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKu8slice hrp_bytes_ref; + hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes); + hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL); + LDKCVec_U5Z invoice_data_constr; + invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data); + if (invoice_data_constr.datalen > 0) + invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); + else + invoice_data_constr.data = NULL; + int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL); + for (size_t h = 0; h < invoice_data_constr.datalen; h++) { + int8_t invoice_data_conv_7 = invoice_data_vals[h]; + + invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 }; + } + (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0); + LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); + LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv); + (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + void* msg_ptr = untag_ptr(msg); + CHECK_ACCESS(msg_ptr); + LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr); + msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg)); + LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv); + return tag_ptr(ret_conv, true); +} + +typedef struct LDKSignerProvider_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID generate_channel_keys_id_meth; + jmethodID derive_channel_signer_meth; + jmethodID read_chan_signer_meth; + jmethodID get_destination_script_meth; + jmethodID get_shutdown_scriptpubkey_meth; +} LDKSignerProvider_JCalls; +static void LDKSignerProvider_JCalls_free(void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7434,7 +8078,7 @@ LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* th int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception."); } LDKThirtyTwoBytes ret_ref; CHECK((*env)->GetArrayLength(env, ret) == 32); @@ -7444,8 +8088,8 @@ LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* th } return ret_ref; } -LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7461,43 +8105,19 @@ LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint6 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to derive_channel_signer in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKSign ret_conv = *(LDKSign*)(ret_ptr); + LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception."); - } - LDKThirtyTwoBytes ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 32); - (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_ref; -} -LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7513,19 +8133,19 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient receipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7533,38 +8153,24 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKu8slice hrp_bytes_var = hrp_bytes; - int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen); - (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data); - LDKCVec_U5Z invoice_data_var = invoice_data; - jobjectArray invoice_data_arr = NULL; - invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen); - int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL); - for (size_t h = 0; h < invoice_data_var.datalen; h++) { - uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0; - invoice_data_arr_ptr[h] = invoice_data_conv_7_val; - } - (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0); - FREE(invoice_data_var.data); - jclass receipient_conv = LDKRecipient_to_java(env, receipient); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception."); } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr); - FREE(untag_ptr(ret)); + LDKCVec_u8Z ret_ref; + ret_ref.datalen = (*env)->GetArrayLength(env, ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_conv; + return ret_ref; } -LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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) { @@ -7574,138 +8180,62 @@ LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception."); + (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception."); } - LDKThirtyTwoBytes ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 32); - (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + LDKShutdownScript ret_conv; + ret_conv.inner = untag_ptr(ret); + ret_conv.is_owned = ptr_is_owned(ret); + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_ref; + return ret_conv; } -static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; +static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls"); + LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J"); - CHECK(calls->get_node_secret_meth != NULL); - calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J"); - CHECK(calls->get_node_id_meth != NULL); - calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J"); - CHECK(calls->ecdh_meth != NULL); - calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B"); - CHECK(calls->get_destination_script_meth != NULL); - calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J"); - CHECK(calls->get_shutdown_scriptpubkey_meth != NULL); calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B"); CHECK(calls->generate_channel_keys_id_meth != NULL); calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J"); CHECK(calls->derive_channel_signer_meth != NULL); - calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B"); - CHECK(calls->get_secure_random_bytes_meth != NULL); calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J"); CHECK(calls->read_chan_signer_meth != NULL); - calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J"); - CHECK(calls->sign_invoice_meth != NULL); - calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B"); - CHECK(calls->get_inbound_payment_key_material_meth != NULL); + calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B"); + CHECK(calls->get_destination_script_meth != NULL); + calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J"); + CHECK(calls->get_shutdown_scriptpubkey_meth != NULL); - LDKKeysInterface ret = { + LDKSignerProvider ret = { .this_arg = (void*) calls, - .get_node_secret = get_node_secret_LDKKeysInterface_jcall, - .get_node_id = get_node_id_LDKKeysInterface_jcall, - .ecdh = ecdh_LDKKeysInterface_jcall, - .get_destination_script = get_destination_script_LDKKeysInterface_jcall, - .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall, - .generate_channel_keys_id = generate_channel_keys_id_LDKKeysInterface_jcall, - .derive_channel_signer = derive_channel_signer_LDKKeysInterface_jcall, - .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, - .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, - .sign_invoice = sign_invoice_LDKKeysInterface_jcall, - .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, - .free = LDKKeysInterface_JCalls_free, + .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall, + .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall, + .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall, + .get_destination_script = get_destination_script_LDKSignerProvider_jcall, + .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall, + .free = LDKSignerProvider_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) { - LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *res_ptr = LDKKeysInterface_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) { + LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *res_ptr = LDKSignerProvider_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); - LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ"); - *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient); - LDKPublicKey other_key_ref; - CHECK((*env)->GetArrayLength(env, other_key) == 33); - (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form); - void* tweak_ptr = untag_ptr(tweak); - CHECK_ACCESS(tweak_ptr); - LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ - LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); - *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); - 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_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKU128 user_channel_id_ref; CHECK((*env)->GetArrayLength(env, user_channel_id) == 16); (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes); @@ -7714,74 +8244,51 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1generate return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKThirtyTwoBytes channel_keys_id_ref; CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data); - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref); return tag_ptr(ret_ret, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKu8slice reader_ref; reader_ref.datalen = (*env)->GetArrayLength(env, reader); reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref); (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass receipient) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKu8slice hrp_bytes_ref; - hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes); - hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL); - LDKCVec_U5Z invoice_data_constr; - invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data); - if (invoice_data_constr.datalen > 0) - invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); - else - invoice_data_constr.data = NULL; - int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL); - for (size_t h = 0; h < invoice_data_constr.datalen; h++) { - int8_t invoice_data_conv_7 = invoice_data_vals[h]; - - invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 }; - } - (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0); - LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient); - LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ"); - *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv); - (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0); - return tag_ptr(ret_conv, true); + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; + LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); + 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 int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data); - return ret_arr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; + LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } typedef struct LDKFeeEstimator_JCalls { @@ -7864,6 +8371,261 @@ JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat return ret_conv; } +typedef struct LDKRouter_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID find_route_meth; + jmethodID find_route_with_id_meth; +} LDKRouter_JCalls; +static void LDKRouter_JCalls_free(void* this_arg) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + 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); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs) { + LDKRouter_JCalls *j_calls = (LDKRouter_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); + } + int8_tArray payer_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); + LDKRouteParameters route_params_var = *route_params; + int64_t route_params_ref = 0; + route_params_var = RouteParameters_clone(&route_params_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); + LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; + int64_tArray first_hops_arr = NULL; + if (first_hops != NULL) { + LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; + first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); + int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); + for (size_t q = 0; q < first_hops_var.datalen; q++) { + LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; + int64_t first_hops_conv_16_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); + first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); + first_hops_arr_ptr[q] = first_hops_conv_16_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); + } + LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs; + int64_t inflight_htlcs_ref = 0; + inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); + inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); + } + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); + FREE(untag_ptr(ret)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const LDKInFlightHtlcs * inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) { + LDKRouter_JCalls *j_calls = (LDKRouter_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); + } + int8_tArray payer_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); + LDKRouteParameters route_params_var = *route_params; + int64_t route_params_ref = 0; + route_params_var = RouteParameters_clone(&route_params_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); + LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; + int64_tArray first_hops_arr = NULL; + if (first_hops != NULL) { + LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; + first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); + int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); + for (size_t q = 0; q < first_hops_var.datalen; q++) { + LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; + int64_t first_hops_conv_16_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); + first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); + first_hops_arr_ptr[q] = first_hops_conv_16_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); + } + LDKInFlightHtlcs inflight_htlcs_var = *inflight_htlcs; + int64_t inflight_htlcs_ref = 0; + inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); + inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); + int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data); + int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception."); + } + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); + FREE(untag_ptr(ret)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); + CHECK(calls->find_route_meth != NULL); + calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J"); + CHECK(calls->find_route_with_id_meth != NULL); + + LDKRouter ret = { + .this_arg = (void*) calls, + .find_route = find_route_LDKRouter_jcall, + .find_route_with_id = find_route_with_id_LDKRouter_jcall, + .free = LDKRouter_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) { + LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); + *res_ptr = LDKRouter_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; + LDKPublicKey payer_ref; + CHECK((*env)->GetArrayLength(env, payer) == 33); + (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv.is_owned = false; + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); + first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); + first_hops_conv_16_conv.is_owned = false; + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKInFlightHtlcs inflight_htlcs_conv; + inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); + inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); + inflight_htlcs_conv.is_owned = false; + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; + LDKPublicKey payer_ref; + CHECK((*env)->GetArrayLength(env, payer) == 33); + (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv.is_owned = false; + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); + first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); + first_hops_conv_16_conv.is_owned = false; + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKInFlightHtlcs inflight_htlcs_conv; + inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); + inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); + inflight_htlcs_conv.is_owned = false; + LDKThirtyTwoBytes _payment_hash_ref; + CHECK((*env)->GetArrayLength(env, _payment_hash) == 32); + (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data); + LDKThirtyTwoBytes _payment_id_ref; + CHECK((*env)->GetArrayLength(env, _payment_id) == 32); + (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, &inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return tag_ptr(ret_conv, true); +} + static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ return ThirtyTwoBytes_clone(&owner->a); } @@ -7936,6 +8698,59 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecod return ret_ref; } +static jclass LDKCOption_APIErrorZ_Some_class = NULL; +static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL; +static jclass LDKCOption_APIErrorZ_None_class = NULL; +static jmethodID LDKCOption_APIErrorZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) { + LDKCOption_APIErrorZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some")); + CHECK(LDKCOption_APIErrorZ_Some_class != NULL); + LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_APIErrorZ_Some_meth != NULL); + LDKCOption_APIErrorZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None")); + CHECK(LDKCOption_APIErrorZ_None_class != NULL); + LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "", "()V"); + CHECK(LDKCOption_APIErrorZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_APIErrorZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref); + } + case LDKCOption_APIErrorZ_None: { + return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth); + } + default: abort(); + } +} +static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_APIErrorZ_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){ LDKOutPoint ret = *owner->contents.result; ret.is_owned = false; @@ -8173,8 +8988,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDeco static jclass LDKPaymentError_Invoice_class = NULL; static jmethodID LDKPaymentError_Invoice_meth = NULL; -static jclass LDKPaymentError_Routing_class = NULL; -static jmethodID LDKPaymentError_Routing_meth = NULL; static jclass LDKPaymentError_Sending_class = NULL; static jmethodID LDKPaymentError_Sending_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) { @@ -8183,15 +8996,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNI CHECK(LDKPaymentError_Invoice_class != NULL); LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "", "(Ljava/lang/String;)V"); CHECK(LDKPaymentError_Invoice_meth != NULL); - LDKPaymentError_Routing_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing")); - CHECK(LDKPaymentError_Routing_class != NULL); - LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "", "(J)V"); - CHECK(LDKPaymentError_Routing_meth != NULL); LDKPaymentError_Sending_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending")); CHECK(LDKPaymentError_Sending_class != NULL); - LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(J)V"); + LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(Lorg/ldk/enums/RetryableSendFailure;)V"); CHECK(LDKPaymentError_Sending_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { @@ -8202,16 +9010,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_ jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len); return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv); } - case LDKPaymentError_Routing: { - LDKLightningError routing_var = obj->routing; - int64_t routing_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var); - routing_ref = tag_ptr(routing_var.inner, false); - return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref); - } case LDKPaymentError_Sending: { - int64_t sending_ref = tag_ptr(&obj->sending, false); - return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref); + jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending); + return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv); } default: abort(); } @@ -8903,6 +9704,34 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1re default: abort(); } } +static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){ + return owner->a; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form); + return ret_arr; +} + +static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){ + return COption_NetAddressZ_clone(&owner->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) { + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]); + } + return ret; +} static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return CVec_u8Z_clone(&*owner->contents.result); @@ -10728,10 +11557,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *e void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK((*env)->GetArrayLength(env, txid) == 32); (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; LDKu8slice script_pubkey_ref; script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey); script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL); @@ -11630,10 +12459,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1filtered_1block_1conne void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -11668,10 +12497,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JN void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height); } @@ -11856,10 +12685,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirm void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -11883,10 +12712,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfir void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK((*env)->GetArrayLength(env, txid) == 32); (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref); } @@ -11894,10 +12723,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated( void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height); } @@ -11978,7 +12807,7 @@ LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* t } return ret_conv; } -LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { +LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -11991,9 +12820,8 @@ LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const vo int64_t channel_id_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var); channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned); - LDKChannelMonitorUpdate update_var = *update; + LDKChannelMonitorUpdate update_var = update; int64_t update_ref = 0; - update_var = ChannelMonitorUpdate_clone(&update_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); update_ref = tag_ptr(update_var.inner, update_var.is_owned); LDKChannelMonitor data_var = *data; @@ -12083,7 +12911,7 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1 update_conv.inner = untag_ptr(update); update_conv.is_owned = ptr_is_owned(update); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv); - update_conv.is_owned = false; + update_conv = ChannelMonitorUpdate_clone(&update_conv); LDKChannelMonitor data_conv; data_conv.inner = untag_ptr(data); data_conv.is_owned = ptr_is_owned(data); @@ -12094,10 +12922,40 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1 update_id_conv.is_owned = ptr_is_owned(update_id); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv); update_id_conv = MonitorUpdateId_clone(&update_id_conv); - jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv)); + jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv)); return ret_conv; } +static jclass LDKRetry_Attempts_class = NULL; +static jmethodID LDKRetry_Attempts_meth = NULL; +static jclass LDKRetry_Timeout_class = NULL; +static jmethodID LDKRetry_Timeout_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) { + LDKRetry_Attempts_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts")); + CHECK(LDKRetry_Attempts_class != NULL); + LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "", "(J)V"); + CHECK(LDKRetry_Attempts_meth != NULL); + LDKRetry_Timeout_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout")); + CHECK(LDKRetry_Timeout_class != NULL); + LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "", "(J)V"); + CHECK(LDKRetry_Timeout_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); + switch(obj->tag) { + case LDKRetry_Attempts: { + int64_t attempts_conv = obj->attempts; + return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv); + } + case LDKRetry_Timeout: { + int64_t timeout_conv = obj->timeout; + return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv); + } + default: abort(); + } +} typedef struct LDKChannelMessageHandler_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -12143,7 +13001,7 @@ static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { +void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12154,10 +13012,6 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - LDKInitFeatures their_features_var = their_features; - int64_t their_features_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKOpenChannel msg_var = *msg; int64_t msg_ref = 0; msg_var = OpenChannel_clone(&msg_var); @@ -12165,7 +13019,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref); + (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception."); @@ -12174,7 +13028,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { +void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12185,10 +13039,6 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - LDKInitFeatures their_features_var = their_features; - int64_t their_features_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKAcceptChannel msg_var = *msg; int64_t msg_ref = 0; msg_var = AcceptChannel_clone(&msg_var); @@ -12196,7 +13046,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref); + (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception."); @@ -12286,7 +13136,7 @@ void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, L DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { +void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12297,11 +13147,6 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - LDKInitFeatures their_features_var = *their_features; - int64_t their_features_ref = 0; - their_features_var = InitFeatures_clone(&their_features_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKShutdown msg_var = *msg; int64_t msg_ref = 0; msg_var = Shutdown_clone(&msg_var); @@ -12309,7 +13154,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); + (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception."); @@ -12561,7 +13406,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12572,10 +13417,9 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jboolean no_connection_possible_conv = no_connection_possible; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv); + (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception."); @@ -12584,7 +13428,7 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { +LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12600,9 +13444,10 @@ LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* t msg_var = Init_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); + jboolean inbound_conv = inbound; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception."); @@ -12761,9 +13606,9 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V"); + calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V"); CHECK(calls->handle_open_channel_meth != NULL); - calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V"); + calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V"); CHECK(calls->handle_accept_channel_meth != NULL); calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V"); CHECK(calls->handle_funding_created_meth != NULL); @@ -12771,7 +13616,7 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->handle_funding_signed_meth != NULL); calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V"); CHECK(calls->handle_channel_ready_meth != NULL); - calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V"); + calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V"); CHECK(calls->handle_shutdown_meth != NULL); calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V"); CHECK(calls->handle_closing_signed_meth != NULL); @@ -12791,9 +13636,9 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->handle_update_fee_meth != NULL); calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V"); CHECK(calls->handle_announcement_signatures_meth != NULL); - calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V"); + calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V"); CHECK(calls->peer_disconnected_meth != NULL); - calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)J"); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V"); CHECK(calls->handle_channel_reestablish_meth != NULL); @@ -12845,44 +13690,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1g LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg); return tag_ptr(&inp->MessageSendEventsProvider, false); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv = InitFeatures_clone(&their_features_conv); LDKOpenChannel msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv = InitFeatures_clone(&their_features_conv); LDKAcceptChannel msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -12930,24 +13765,19 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv.is_owned = false; LDKShutdown msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv); + (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -13085,17 +13915,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); + (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; @@ -13108,7 +13938,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound); return tag_ptr(ret_conv, true); } @@ -13197,6 +14027,7 @@ typedef struct LDKRoutingMessageHandler_JCalls { jmethodID handle_reply_short_channel_ids_end_meth; jmethodID handle_query_channel_range_meth; jmethodID handle_query_short_channel_ids_meth; + jmethodID processing_queue_high_meth; jmethodID provided_node_features_meth; jmethodID provided_init_features_meth; } LDKRoutingMessageHandler_JCalls; @@ -13333,7 +14164,7 @@ LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_chan } return ret_conv; } -LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) { +LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13342,11 +14173,13 @@ LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(co } else { DO_ASSERT(get_jenv_res == JNI_OK); } - int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form); + LDKNodeId starting_point_var = starting_point; + int64_t starting_point_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var); + starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_arr); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception."); @@ -13360,7 +14193,7 @@ LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(co } return ret_conv; } -LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13376,9 +14209,10 @@ LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* t init_var = Init_clone(&init_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); init_ref = tag_ptr(init_var.inner, init_var.is_owned); + jboolean inbound_conv = inbound; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception."); @@ -13516,6 +14350,27 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH } return ret_conv; } +bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret; +} LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; @@ -13588,9 +14443,9 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en CHECK(calls->handle_channel_update_meth != NULL); calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J"); CHECK(calls->get_next_channel_announcement_meth != NULL); - calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "([B)J"); + calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J"); CHECK(calls->get_next_node_announcement_meth != NULL); - calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)J"); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J"); CHECK(calls->handle_reply_channel_range_meth != NULL); @@ -13600,6 +14455,8 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en CHECK(calls->handle_query_channel_range_meth != NULL); calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J"); CHECK(calls->handle_query_short_channel_ids_meth != NULL); + calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z"); + CHECK(calls->processing_queue_high_meth != NULL); calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J"); CHECK(calls->provided_node_features_meth != NULL); calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J"); @@ -13617,6 +14474,7 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall, + .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall, .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall, .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall, .free = LDKRoutingMessageHandler_JCalls_free, @@ -13686,21 +14544,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_ return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; - LDKPublicKey starting_point_ref; - CHECK((*env)->GetArrayLength(env, starting_point) == 33); - (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form); - LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref); + LDKNodeId starting_point_conv; + starting_point_conv.inner = untag_ptr(starting_point); + starting_point_conv.is_owned = ptr_is_owned(starting_point); + CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv); + starting_point_conv = NodeId_clone(&starting_point_conv); + LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; @@ -13713,7 +14573,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); init_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound); return tag_ptr(ret_conv, true); } @@ -13785,6 +14645,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1hand return tag_ptr(ret_conv, true); } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; + jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } @@ -13865,7 +14733,7 @@ void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDK DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } -LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13881,9 +14749,10 @@ LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* thi init_var = Init_clone(&init_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); init_ref = tag_ptr(init_var.inner, init_var.is_owned); + jboolean inbound_conv = inbound; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception."); @@ -13897,7 +14766,7 @@ LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* thi } return ret_conv; } -void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -13908,10 +14777,9 @@ void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPub } int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); - jboolean no_connection_possible_conv = no_connection_possible; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv); + (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception."); @@ -13986,9 +14854,9 @@ static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, j calls->o = (*env)->NewWeakGlobalRef(env, o); calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V"); CHECK(calls->handle_onion_message_meth != NULL); - calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)J"); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); - calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V"); + calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V"); CHECK(calls->peer_disconnected_meth != NULL); calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J"); CHECK(calls->provided_node_features_meth != NULL); @@ -14032,7 +14900,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1o (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; @@ -14045,18 +14913,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); init_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound); return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); - (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); + (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -14710,505 +15578,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1 default: abort(); } } -typedef struct LDKRouter_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - jmethodID find_route_meth; - jmethodID find_route_with_id_meth; - jmethodID notify_payment_path_failed_meth; - jmethodID notify_payment_path_successful_meth; - jmethodID notify_payment_probe_successful_meth; - jmethodID notify_payment_probe_failed_meth; -} LDKRouter_JCalls; -static void LDKRouter_JCalls_free(void* this_arg) { - LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - 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); - } - (*env)->DeleteWeakGlobalRef(env, j_calls->o); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - FREE(j_calls); - } -} -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) { - LDKRouter_JCalls *j_calls = (LDKRouter_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); - } - int8_tArray payer_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); - LDKRouteParameters route_params_var = *route_params; - int64_t route_params_ref = 0; - route_params_var = RouteParameters_clone(&route_params_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); - route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); - LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; - int64_tArray first_hops_arr = NULL; - if (first_hops != NULL) { - LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; - first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); - int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); - for (size_t q = 0; q < first_hops_var.datalen; q++) { - LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; - int64_t first_hops_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); - first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); - first_hops_arr_ptr[q] = first_hops_conv_16_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); - } - LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs; - int64_t inflight_htlcs_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); - inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_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); - } - int8_tArray payer_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); - LDKRouteParameters route_params_var = *route_params; - int64_t route_params_ref = 0; - route_params_var = RouteParameters_clone(&route_params_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); - route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); - LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; - int64_tArray first_hops_arr = NULL; - if (first_hops != NULL) { - LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; - first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen); - int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL); - for (size_t q = 0; q < first_hops_var.datalen; q++) { - LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; - int64_t first_hops_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); - first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); - first_hops_arr_ptr[q] = first_hops_conv_16_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0); - } - LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs; - int64_t inflight_htlcs_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); - inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); - int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data); - int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_path_failed_meth, path_arr, short_channel_id_conv); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_path_failed in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_path_successful_meth, path_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_path_successful in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_probe_successful_meth, path_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_probe_successful in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_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_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - 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->notify_payment_probe_failed_meth, path_arr, short_channel_id_conv); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to notify_payment_probe_failed in LDKRouter from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { - LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { - jclass c = (*env)->GetObjectClass(env, o); - CHECK(c != NULL); - LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); - atomic_init(&calls->refcnt, 1); - DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); - calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); - CHECK(calls->find_route_meth != NULL); - calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J"); - CHECK(calls->find_route_with_id_meth != NULL); - calls->notify_payment_path_failed_meth = (*env)->GetMethodID(env, c, "notify_payment_path_failed", "([JJ)V"); - CHECK(calls->notify_payment_path_failed_meth != NULL); - calls->notify_payment_path_successful_meth = (*env)->GetMethodID(env, c, "notify_payment_path_successful", "([J)V"); - CHECK(calls->notify_payment_path_successful_meth != NULL); - calls->notify_payment_probe_successful_meth = (*env)->GetMethodID(env, c, "notify_payment_probe_successful", "([J)V"); - CHECK(calls->notify_payment_probe_successful_meth != NULL); - calls->notify_payment_probe_failed_meth = (*env)->GetMethodID(env, c, "notify_payment_probe_failed", "([JJ)V"); - CHECK(calls->notify_payment_probe_failed_meth != NULL); - - LDKRouter ret = { - .this_arg = (void*) calls, - .find_route = find_route_LDKRouter_jcall, - .find_route_with_id = find_route_with_id_LDKRouter_jcall, - .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall, - .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall, - .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall, - .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall, - .free = LDKRouter_JCalls_free, - }; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) { - LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); - *res_ptr = LDKRouter_init(env, clz, o); - return tag_ptr(res_ptr, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; - LDKPublicKey payer_ref; - CHECK((*env)->GetArrayLength(env, payer) == 33); - (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); - LDKRouteParameters route_params_conv; - route_params_conv.inner = untag_ptr(route_params); - route_params_conv.is_owned = ptr_is_owned(route_params); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); - route_params_conv.is_owned = false; - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); - first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); - first_hops_conv_16_conv.is_owned = false; - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKInFlightHtlcs inflight_htlcs_conv; - inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); - inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; - LDKPublicKey payer_ref; - CHECK((*env)->GetArrayLength(env, payer) == 33); - (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form); - LDKRouteParameters route_params_conv; - route_params_conv.inner = untag_ptr(route_params); - route_params_conv.is_owned = ptr_is_owned(route_params); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); - route_params_conv.is_owned = false; - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); - first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); - first_hops_conv_16_conv.is_owned = false; - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKInFlightHtlcs inflight_htlcs_conv; - inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); - inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); - CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); - LDKThirtyTwoBytes _payment_hash_ref; - CHECK((*env)->GetArrayLength(env, _payment_hash) == 32); - (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data); - LDKThirtyTwoBytes _payment_id_ref; - CHECK((*env)->GetArrayLength(env, _payment_id) == 32); - (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKRouter* this_arg_conv = (LDKRouter*)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 = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - 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->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); -} - static jclass LDKDestination_Node_class = NULL; static jmethodID LDKDestination_Node_meth = NULL; static jclass LDKDestination_BlindedPath_class = NULL; @@ -15355,429 +15724,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr default: abort(); } } -typedef struct LDKPayer_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - jmethodID node_id_meth; - jmethodID first_hops_meth; - jmethodID send_payment_meth; - jmethodID send_spontaneous_payment_meth; - jmethodID retry_payment_meth; - jmethodID abandon_payment_meth; - jmethodID inflight_htlcs_meth; -} LDKPayer_JCalls; -static void LDKPayer_JCalls_free(void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - 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); - } - (*env)->DeleteWeakGlobalRef(env, j_calls->o); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - FREE(j_calls); - } -} -LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception."); - } - LDKPublicKey ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 33); - (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_ref; -} -LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception."); - } - LDKCVec_ChannelDetailsZ ret_constr; - ret_constr.datalen = (*env)->GetArrayLength(env, ret); - if (ret_constr.datalen > 0) - ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - ret_constr.data = NULL; - int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); - for (size_t q = 0; q < ret_constr.datalen; q++) { - int64_t ret_conv_16 = ret_vals[q]; - LDKChannelDetails ret_conv_16_conv; - ret_conv_16_conv.inner = untag_ptr(ret_conv_16); - ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv); - ret_constr.data[q] = ret_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_constr; -} -LDKCResult_NonePaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - LDKRoute route_var = *route; - int64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data); - int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data); - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -LDKCResult_NonePaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - LDKRoute route_var = *route; - int64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data); - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - LDKRoute route_var = *route; - int64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception."); - } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception."); - } - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } -} -LDKInFlightHtlcs inflight_htlcs_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_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); - } - jobject obj = (*env)->NewLocalRef(env, j_calls->o); - CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->inflight_htlcs_meth); - if (UNLIKELY((*env)->ExceptionCheck(env))) { - (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to inflight_htlcs in LDKPayer from rust threw an exception."); - } - LDKInFlightHtlcs ret_conv; - ret_conv.inner = untag_ptr(ret); - ret_conv.is_owned = ptr_is_owned(ret); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - return ret_conv; -} -static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) { - jclass c = (*env)->GetObjectClass(env, o); - CHECK(c != NULL); - LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls"); - atomic_init(&calls->refcnt, 1); - DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); - calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B"); - CHECK(calls->node_id_meth != NULL); - calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J"); - CHECK(calls->first_hops_meth != NULL); - calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B[B)J"); - CHECK(calls->send_payment_meth != NULL); - calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B[B)J"); - CHECK(calls->send_spontaneous_payment_meth != NULL); - calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J"); - CHECK(calls->retry_payment_meth != NULL); - calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V"); - CHECK(calls->abandon_payment_meth != NULL); - calls->inflight_htlcs_meth = (*env)->GetMethodID(env, c, "inflight_htlcs", "()J"); - CHECK(calls->inflight_htlcs_meth != NULL); - - LDKPayer ret = { - .this_arg = (void*) calls, - .node_id = node_id_LDKPayer_jcall, - .first_hops = first_hops_LDKPayer_jcall, - .send_payment = send_payment_LDKPayer_jcall, - .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, - .retry_payment = retry_payment_LDKPayer_jcall, - .abandon_payment = abandon_payment_LDKPayer_jcall, - .inflight_htlcs = inflight_htlcs_LDKPayer_jcall, - .free = LDKPayer_JCalls_free, - }; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) { - LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer"); - *res_ptr = LDKPayer_init(env, clz, o); - return tag_ptr(res_ptr, true); -} -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form); - return ret_arr; -} - -JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(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 q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails ret_conv_16_var = ret_var.data[q]; - int64_t ret_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var); - ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned); - ret_arr_ptr[q] = ret_conv_16_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); - FREE(ret_var.data); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_hash_ref; - CHECK((*env)->GetArrayLength(env, payment_hash) == 32); - (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); - LDKThirtyTwoBytes payment_secret_ref; - CHECK((*env)->GetArrayLength(env, payment_secret) == 32); - (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_preimage_ref; - CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); - (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKInFlightHtlcs ret_var = (this_arg_conv->inflight_htlcs)(this_arg_conv->this_arg); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static jclass LDKRetry_Attempts_class = NULL; -static jmethodID LDKRetry_Attempts_meth = NULL; -static jclass LDKRetry_Timeout_class = NULL; -static jmethodID LDKRetry_Timeout_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) { - LDKRetry_Attempts_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts")); - CHECK(LDKRetry_Attempts_class != NULL); - LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "", "(J)V"); - CHECK(LDKRetry_Attempts_meth != NULL); - LDKRetry_Timeout_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout")); - CHECK(LDKRetry_Timeout_class != NULL); - LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "", "(J)V"); - CHECK(LDKRetry_Timeout_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); - switch(obj->tag) { - case LDKRetry_Attempts: { - int64_t attempts_conv = obj->attempts; - return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv); - } - case LDKRetry_Timeout: { - int64_t timeout_conv = obj->timeout; - return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv); - } - default: abort(); - } -} JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) { LDKStr ret_str = _ldk_get_compiled_version(); jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); @@ -15908,6 +15854,95 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass Str_free(dummy); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_ok(); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)untag_ptr(e)); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_CResult_NoneAPIErrorZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t w = 0; w < _res_constr.datalen; w++) { + int64_t _res_conv_22 = _res_vals[w]; + void* _res_conv_22_ptr = untag_ptr(_res_conv_22); + CHECK_ACCESS(_res_conv_22_ptr); + LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr); + FREE(untag_ptr(_res_conv_22)); + _res_constr.data[w] = _res_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_CResult_NoneAPIErrorZZ_free(_res_constr); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_APIErrorZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t k = 0; k < _res_constr.datalen; k++) { + int64_t _res_conv_10 = _res_vals[k]; + void* _res_conv_10_ptr = untag_ptr(_res_conv_10); + CHECK_ACCESS(_res_conv_10_ptr); + LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr); + FREE(untag_ptr(_res_conv_10)); + _res_constr.data[k] = _res_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_APIErrorZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) { LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o); LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ"); @@ -17677,6 +17712,153 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDeco return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr); + o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o)); + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_NetworkUpdateZ_free(_res_conv); +} + +static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) { + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg); + int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig); + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr); + o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o)); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_PathFailureZ_free(_res_conv); +} + +static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) { + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg); + int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr); + o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o)); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); @@ -17923,53 +18105,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr); - o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o)); - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_some(o_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) { - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_none(); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr); - FREE(untag_ptr(_res)); - COption_NetworkUpdateZ_free(_res_conv); -} - -static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) { - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_clone(arg); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg); - int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig); - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_clone(orig_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_SpendableOutputDescriptorZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -18110,56 +18245,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free( CVec_MessageSendEventZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKTxOut o_conv = *(LDKTxOut*)(o_ptr); - o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o)); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { - LDKAccessError e_conv = LDKAccessError_from_java(env, e); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_TxOutAccessErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) { - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) { LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ"); *ret_conv = C2Tuple_usizeTransactionZ_clone(arg); @@ -18508,6 +18593,131 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_ return ret_ref; } +static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) { + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig); + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) { + LDKEightU16s a_ref; + CHECK((*env)->GetArrayLength(env, a) == 8); + (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data); + LDKEightU16s b_ref; + CHECK((*env)->GetArrayLength(env, b) == 8); + (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data); + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_Z_free(_res_conv); +} + +static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) { + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg); + int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig); + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) { + LDKEightU16s a_ref; + CHECK((*env)->GetArrayLength(env, a) == 8); + (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data); + LDKEightU16s b_ref; + CHECK((*env)->GetArrayLength(env, b) == 8); + (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data); + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple__u168_u168Z_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr); + o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o)); + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv); +} + +static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg); + int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig); + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_NodeIdZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -18781,6 +18991,60 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDec return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKBlindedHopFeatures o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = BlindedHopFeatures_clone(&o_conv); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKChannelTypeFeatures o_conv; o_conv.inner = untag_ptr(o); @@ -18835,114 +19099,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeature return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKOfferFeatures o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = OfferFeatures_clone(&o_conv); - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_OfferFeaturesDecodeErrorZ* o_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_OfferFeaturesDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_OfferFeaturesDecodeErrorZ _res_conv = *(LDKCResult_OfferFeaturesDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_OfferFeaturesDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_OfferFeaturesDecodeErrorZ_clone_ptr(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_OfferFeaturesDecodeErrorZ* arg_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_OfferFeaturesDecodeErrorZ* orig_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(orig); - LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInvoiceRequestFeatures o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InvoiceRequestFeatures_clone(&o_conv); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(orig); - LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKNodeId o_conv; o_conv.inner = untag_ptr(o); @@ -19050,34 +19206,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUp return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); - LDKAccess o_conv = *(LDKAccess*)(o_ptr); - if (o_conv.free == LDKAccess_JCalls_free) { + LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr); + if (o_conv.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&o_conv); + LDKUtxoLookup_JCalls_cloned(&o_conv); } - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_some(o_conv); + LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ"); + *ret_copy = COption_UtxoLookupZ_some(o_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) { - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_none(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ"); + *ret_copy = COption_UtxoLookupZ_none(); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr); + LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_AccessZ_free(_res_conv); + COption_UtxoLookupZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) { @@ -20039,142 +20195,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1cl return tag_ptr(ret_conv, true); } -static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) { - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg); - int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) { - LDKSignature a_ref; - CHECK((*env)->GetArrayLength(env, a) == 64); - (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form); - LDKSignature b_ref; - CHECK((*env)->GetArrayLength(env, b) == 64); - (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr); - FREE(untag_ptr(_res)); - C2Tuple_SignatureSignatureZ_free(_res_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr); - o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o)); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv); -} - -static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg); - int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { - LDKSecretKey o_ref; - CHECK((*env)->GetArrayLength(env, o) == 32); - (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_SecretKeyNoneZ_free(_res_conv); -} - -static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) { - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKPublicKey o_ref; CHECK((*env)->GetArrayLength(env, o) == 33); @@ -20298,62 +20318,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_ return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKSign o_conv = *(LDKSign*)(o_ptr); - if (o_conv.free == LDKSign_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKSign_JCalls_cloned(&o_conv); - } - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_SignDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) { LDKCVec_U5Z _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -20419,6 +20383,62 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatu return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr); + if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv); + } + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) { LDKCVec_u8Z _res_ref; _res_ref.datalen = (*env)->GetArrayLength(env, _res); @@ -20794,95 +20814,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) { - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_ok(); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); - e_conv = APIError_clone((LDKAPIError*)untag_ptr(e)); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_NoneAPIErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_CResult_NoneAPIErrorZZ _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t w = 0; w < _res_constr.datalen; w++) { - int64_t _res_conv_22 = _res_vals[w]; - void* _res_conv_22_ptr = untag_ptr(_res_conv_22); - CHECK_ACCESS(_res_conv_22_ptr); - LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr); - FREE(untag_ptr(_res_conv_22)); - _res_constr.data[w] = _res_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_CResult_NoneAPIErrorZZ_free(_res_constr); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { - LDKCVec_APIErrorZ _res_constr; - _res_constr.datalen = (*env)->GetArrayLength(env, _res); - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); - else - _res_constr.data = NULL; - int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); - for (size_t k = 0; k < _res_constr.datalen; k++) { - int64_t _res_conv_10 = _res_vals[k]; - void* _res_conv_10_ptr = untag_ptr(_res_conv_10); - CHECK_ACCESS(_res_conv_10_ptr); - LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr); - FREE(untag_ptr(_res_conv_10)); - _res_constr.data[k] = _res_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); - CVec_APIErrorZ_free(_res_constr); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -20935,6 +20866,26 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1c return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_RecentPaymentDetailsZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t w = 0; w < _res_constr.datalen; w++) { + int64_t _res_conv_22 = _res_vals[w]; + void* _res_conv_22_ptr = untag_ptr(_res_conv_22); + CHECK_ACCESS(_res_conv_22_ptr); + LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr); + FREE(untag_ptr(_res_conv_22)); + _res_constr.data[w] = _res_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_RecentPaymentDetailsZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_ok(); @@ -20984,6 +20935,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_ok(); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneRetryableSendFailureZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) { + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -21036,6 +21033,55 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPayment return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_PaymentHashRetryableSendFailureZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) { + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) { LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg); @@ -21787,6 +21833,106 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecod return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKAPIError o_conv = *(LDKAPIError*)(o_ptr); + o_conv = APIError_clone((LDKAPIError*)untag_ptr(o)); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_APIErrorZ_free(_res_conv); +} + +static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) { + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg); + int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr); + o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o)); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKOutPoint o_conv; o_conv.inner = untag_ptr(o); @@ -22974,6 +23120,66 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone return ret_ref; } +static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKPublicKey a_ref; + CHECK((*env)->GetArrayLength(env, a) == 33); + (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form); + void* b_ptr = untag_ptr(b); + CHECK_ACCESS(b_ptr); + LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr); + b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b)); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1NetAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t o = 0; o < _res_constr.datalen; o++) { + int64_t _res_conv_40 = _res_vals[o]; + void* _res_conv_40_ptr = untag_ptr(_res_conv_40); + CHECK_ACCESS(_res_conv_40_ptr); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr); + FREE(untag_ptr(_res_conv_40)); + _res_constr.data[o] = _res_conv_40_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKCVec_u8Z o_ref; o_ref.datalen = (*env)->GetArrayLength(env, o); @@ -23128,6 +23334,56 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErro return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKTxOut o_conv = *(LDKTxOut*)(o_ptr); + o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o)); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_TxOutUtxoLookupErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) { + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); *ret_conv = CResult_NoneSendErrorZ_ok(); @@ -25988,6 +26244,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a); + LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b); + jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv); + return ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj); LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv); @@ -26007,6 +26270,83 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PathFailure_free(this_ptr_conv); +} + +static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) { + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg); + int64_t ret_conv = PathFailure_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) { + void* err_ptr = untag_ptr(err); + CHECK_ACCESS(err_ptr); + LDKAPIError err_conv = *(LDKAPIError*)(err_ptr); + err_conv = APIError_clone((LDKAPIError*)untag_ptr(err)); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_initial_send(err_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) { + void* network_update_ptr = untag_ptr(network_update); + CHECK_ACCESS(network_update_ptr); + LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr); + network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update)); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_on_path(network_update_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a); + LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b); + jboolean ret_conv = PathFailure_eq(a_conv, b_conv); + return ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj); + LDKCVec_u8Z ret_var = PathFailure_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_PathFailure_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_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = PathFailure_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return tag_ptr(ret_conv, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -26365,17 +26705,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1succe return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_tArray path, int64_t short_channel_id, int64_t retry) { 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); - void* network_update_ptr = untag_ptr(network_update); - CHECK_ACCESS(network_update_ptr); - LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr); - network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update)); + void* failure_ptr = untag_ptr(failure); + CHECK_ACCESS(failure_ptr); + LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr); + failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure)); LDKCVec_RouteHopZ path_constr; path_constr.datalen = (*env)->GetArrayLength(env, path); if (path_constr.datalen > 0) @@ -26403,7 +26743,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv); retry_conv = RouteParameters_clone(&retry_conv); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv); + *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_constr, short_channel_id_conv, retry_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -26617,6 +26957,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKEvent* a_conv = (LDKEvent*)untag_ptr(a); + LDKEvent* b_conv = (LDKEvent*)untag_ptr(b); + jboolean ret_conv = Event_eq(a_conv, b_conv); + return ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj); LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -26879,6 +27226,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) { + LDKNodeAnnouncement msg_conv; + msg_conv.inner = untag_ptr(msg); + msg_conv.is_owned = ptr_is_owned(msg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = NodeAnnouncement_clone(&msg_conv); + LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) { LDKPublicKey node_id_ref; CHECK((*env)->GetArrayLength(env, node_id) == 33); @@ -27091,6 +27450,25 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, return ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj); + LDKCVec_u8Z ret_var = APIError_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_APIError_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_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = APIError_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return tag_ptr(ret_conv, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKBigSize this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -27193,10 +27571,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass cl LDKu8slice msg_ref; msg_ref.datalen = (*env)->GetArrayLength(env, msg); msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL); - unsigned char sk_arr[32]; + uint8_t sk_arr[32]; CHECK((*env)->GetArrayLength(env, sk) == 32); (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr); - unsigned char (*sk_ref)[32] = &sk_arr; + uint8_t (*sk_ref)[32] = &sk_arr; LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); *ret_conv = sign(msg_ref, sk_ref); (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0); @@ -28455,9 +28833,9 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) { LDKNetwork network_conv = LDKNetwork_from_java(env, network); - LDKBestBlock ret_var = BestBlock_from_genesis(network_conv); + LDKBestBlock ret_var = BestBlock_from_network(network_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -28496,31 +28874,6 @@ JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *e return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig); - jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv)); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain()); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx()); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Access_free(this_ptr_conv); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -29645,10 +29998,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_ this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -29706,10 +30059,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconn this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -29740,10 +30093,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transa this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = (*env)->GetArrayLength(env, txdata); if (txdata_constr.datalen > 0) @@ -29801,10 +30154,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1u this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK((*env)->GetArrayLength(env, txid) == 32); (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -29835,10 +30188,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1 this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK((*env)->GetArrayLength(env, header) == 80); (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -29928,15 +30281,18 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1c return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - void* arg_ptr = untag_ptr(arg); - if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); } - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr; + void* arg_a_ptr = untag_ptr(arg_a); + if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); } + LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr; + void* arg_b_ptr = untag_ptr(arg_b); + if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); } + LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr; LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ"); - *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv); + *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } @@ -30635,44 +30991,53 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1 return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr); + LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - BaseSign_free(this_ptr_conv); + ChannelSigner_free(this_ptr_conv); } -static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) { - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = Sign_clone(arg); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + EcdsaChannelSigner_free(this_ptr_conv); +} + +static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) { + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = WriteableEcdsaChannelSigner_clone(arg); return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { void* arg_ptr = untag_ptr(arg); if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); } - LDKSign* arg_conv = (LDKSign*)arg_ptr; - int64_t ret_conv = Sign_clone_ptr(arg_conv); + LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr; + int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) { void* orig_ptr = untag_ptr(orig); if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); } - LDKSign* orig_conv = (LDKSign*)orig_ptr; - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = Sign_clone(orig_conv); + LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr; + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv); return tag_ptr(ret_ret, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr); + LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - Sign_free(this_ptr_conv); + WriteableEcdsaChannelSigner_free(this_ptr_conv); } JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) { @@ -30691,13 +31056,31 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNI return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + EntropySource_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr); + LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - KeysInterface_free(this_ptr_conv); + NodeSigner_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + SignerProvider_free(this_ptr_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) { @@ -30876,10 +31259,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray node_secret, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { - LDKSecretKey node_secret_ref; - CHECK((*env)->GetArrayLength(env, node_secret) == 32); - (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { LDKSecretKey funding_key_ref; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes); @@ -30901,7 +31281,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv LDKThirtyTwoBytes channel_keys_id_ref; CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32); (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data); - LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); + LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -31029,25 +31409,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynam return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner"); + *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); - *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv); + LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner"); + *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv); return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = InMemorySigner_as_Sign(&this_arg_conv); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv); return tag_ptr(ret_ret, true); } @@ -31064,15 +31455,12 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(J return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_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); - LDKSecretKey arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 32); - (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes); LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); - *ret_conv = InMemorySigner_read(ser_ref, arg_ref); + *ret_conv = InMemorySigner_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } @@ -31086,10 +31474,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) { - unsigned char seed_arr[32]; + uint8_t seed_arr[32]; CHECK((*env)->GetArrayLength(env, seed) == 32); (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr); - unsigned char (*seed_ref)[32] = &seed_arr; + uint8_t (*seed_ref)[32] = &seed_arr; LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31097,16 +31485,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *en return ret_ref; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { LDKKeysManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char params_arr[32]; + uint8_t params_arr[32]; CHECK((*env)->GetArrayLength(env, params) == 32); (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); - unsigned char (*params_ref)[32] = ¶ms_arr; + uint8_t (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31161,14 +31560,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendab return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *ret_ret = KeysManager_as_EntropySource(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv); + LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv); return tag_ptr(ret_ret, true); } @@ -31180,26 +31601,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEn PhantomKeysManager_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPhantomKeysManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv); + LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv); return tag_ptr(ret_ret, true); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) { - unsigned char seed_arr[32]; + uint8_t seed_arr[32]; CHECK((*env)->GetArrayLength(env, seed) == 32); (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr); - unsigned char (*seed_ref)[32] = &seed_arr; - unsigned char cross_node_seed_arr[32]; + uint8_t (*seed_ref)[32] = &seed_arr; + uint8_t cross_node_seed_arr[32]; CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32); (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr); - unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr; + uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr; LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31260,10 +31703,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_ this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char params_arr[32]; + uint8_t params_arr[32]; CHECK((*env)->GetArrayLength(env, params) == 32); (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); - unsigned char (*params_ref)[32] = ¶ms_arr; + uint8_t (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -31271,6 +31714,49 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_ return ret_ref; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes); + return ret_arr; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig); + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_temporary_node_failure()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_required_node_feature_missing()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_incorrect_or_unknown_payment_details()); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -32375,125 +32861,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbou return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); CHECK_ACCESS(this_ptr_ptr); - LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr); + LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - PaymentSendFailure_free(this_ptr_conv); + RecentPaymentDetails_free(this_ptr_conv); } -static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) { - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_clone(arg); +static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) { + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_clone(arg); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg); - int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg); + int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_clone(orig_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) { - void* a_ptr = untag_ptr(a); - CHECK_ACCESS(a_ptr); - LDKAPIError a_conv = *(LDKAPIError*)(a_ptr); - a_conv = APIError_clone((LDKAPIError*)untag_ptr(a)); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_parameter_error(a_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) { - LDKCVec_CResult_NoneAPIErrorZZ a_constr; - a_constr.datalen = (*env)->GetArrayLength(env, a); - if (a_constr.datalen > 0) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - a_constr.data = NULL; - int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); - for (size_t w = 0; w < a_constr.datalen; w++) { - int64_t a_conv_22 = a_vals[w]; - void* a_conv_22_ptr = untag_ptr(a_conv_22); - CHECK_ACCESS(a_conv_22_ptr); - LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); - a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22)); - a_constr.data[w] = a_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_path_parameter_error(a_constr); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) { - LDKCVec_APIErrorZ a_constr; - a_constr.datalen = (*env)->GetArrayLength(env, a); - if (a_constr.datalen > 0) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); - else - a_constr.data = NULL; - int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); - for (size_t k = 0; k < a_constr.datalen; k++) { - int64_t a_conv_10 = a_vals[k]; - void* a_conv_10_ptr = untag_ptr(a_conv_10); - CHECK_ACCESS(a_conv_10_ptr); - LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr); - a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10)); - a_constr.data[k] = a_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t total_msat) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) { - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_duplicate_payment(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(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); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) { - LDKCVec_CResult_NoneAPIErrorZZ results_constr; - results_constr.datalen = (*env)->GetArrayLength(env, results); - if (results_constr.datalen > 0) - results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - results_constr.data = NULL; - int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL); - for (size_t w = 0; w < results_constr.datalen; w++) { - int64_t results_conv_22 = results_vals[w]; - void* results_conv_22_ptr = untag_ptr(results_conv_22); - CHECK_ACCESS(results_conv_22_ptr); - LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); - results_constr.data[w] = results_conv_22_conv; - } - (*env)->ReleaseLongArrayElements(env, results, results_vals, 0); - LDKRouteParameters failed_paths_retry_conv; - failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry); - failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry); - CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv); - failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(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); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -32654,7 +33076,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t config, int64_t params) { void* fee_est_ptr = untag_ptr(fee_est); CHECK_ACCESS(fee_est_ptr); LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr); @@ -32676,6 +33098,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv); } + void* router_ptr = untag_ptr(router); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -32683,12 +33112,26 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + void* signer_provider_ptr = untag_ptr(signer_provider); + CHECK_ACCESS(signer_provider_ptr); + LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr); + if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKSignerProvider_JCalls_cloned(&signer_provider_conv); } LDKUserConfig config_conv; config_conv.inner = untag_ptr(config); @@ -32700,7 +33143,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv params_conv.is_owned = ptr_is_owned(params); CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); params_conv = ChainParameters_clone(¶ms_conv); - LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv); + LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -32786,16 +33229,37 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1 return ret_arr; } +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_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); + for (size_t w = 0; w < ret_var.datalen; w++) { + LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_conv_22_copy = ret_var.data[w]; + int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true); + ret_arr_ptr[w] = ret_conv_22_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32810,10 +33274,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1chan this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32828,10 +33292,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1clos this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32846,10 +33310,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1clos this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -32901,22 +33365,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); LDKThirtyTwoBytes payment_id_ref; CHECK((*env)->GetArrayLength(env, payment_id) == 32); (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv = RouteParameters_clone(&route_params_conv); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = ChannelManager_send_payment_with_retry(&this_arg_conv, payment_hash_ref, payment_secret_ref, payment_id_ref, route_params_conv, retry_strategy_conv); return tag_ptr(ret_conv, true); } @@ -32954,6 +33428,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spont return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKThirtyTwoBytes payment_preimage_ref; + CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); + (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv = RouteParameters_clone(&route_params_conv); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, payment_id_ref, route_params_conv, retry_strategy_conv); + return tag_ptr(ret_conv, true); +} + 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 = untag_ptr(this_arg); @@ -32988,10 +33488,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1tr this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -33037,7 +33537,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1cha return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray _next_node_id, int64_t amt_to_forward_msat) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -33046,15 +33546,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1in LDKThirtyTwoBytes intercept_id_ref; CHECK((*env)->GetArrayLength(env, intercept_id) == 32); (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data); - unsigned char next_hop_channel_id_arr[32]; + uint8_t next_hop_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32); (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr); - unsigned char (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr; - LDKPublicKey _next_node_id_ref; - CHECK((*env)->GetArrayLength(env, _next_node_id) == 33); - (*env)->GetByteArrayRegion(env, _next_node_id, 0, 33, _next_node_id_ref.compressed_form); + uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr; + LDKPublicKey next_node_id_ref; + CHECK((*env)->GetArrayLength(env, next_node_id) == 33); + (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form); LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, _next_node_id_ref, amt_to_forward_msat); + *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat); return tag_ptr(ret_conv, true); } @@ -33096,13 +33596,27 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1ba this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char payment_hash_arr[32]; + uint8_t payment_hash_arr[32]; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); - unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; + uint8_t (*payment_hash_ref)[32] = &payment_hash_arr; ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards_1with_1reason(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, jclass failure_code) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + uint8_t payment_hash_arr[32]; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); + uint8_t (*payment_hash_ref)[32] = &payment_hash_arr; + LDKFailureCode failure_code_conv = LDKFailureCode_from_java(env, failure_code); + ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -33132,10 +33646,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -33153,10 +33667,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); @@ -33168,7 +33682,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -33178,8 +33692,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } @@ -33198,7 +33716,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -33211,8 +33729,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); + void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry); + CHECK_ACCESS(min_final_cltv_expiry_ptr); + LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr); + min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry)); LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv); return tag_ptr(ret_conv, true); } @@ -33386,35 +33908,76 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1be return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); - *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); + LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1node_1features(JNIEnv *env, jclass clz) { - LDKNodeFeatures ret_var = provided_node_features(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1channel_1features(JNIEnv *env, jclass clz) { - LDKChannelFeatures ret_var = provided_channel_features(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz) { - LDKInitFeatures ret_var = provided_init_features(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); + *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t _config) { + LDKUserConfig _config_conv; + _config_conv.inner = untag_ptr(_config); + _config_conv.is_owned = ptr_is_owned(_config); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv); + _config_conv.is_owned = false; + LDKInitFeatures ret_var = provided_init_features(&_config_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -33534,18 +34097,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(J ChannelManagerReadArgs_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; // WARNING: This object doesn't live past this scope, needs clone! - int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false); + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false); return ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); @@ -33553,12 +34116,66 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1k this_ptr_conv.is_owned = false; void* val_ptr = untag_ptr(val); CHECK_ACCESS(val_ptr); - LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr); - if (val_conv.free == LDKKeysInterface_JCalls_free) { + LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr); + if (val_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&val_conv); + LDKEntropySource_JCalls_cloned(&val_conv); } - ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv); + ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + // WARNING: This object doesn't live past this scope, needs clone! + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false); + return ret_ret; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr); + if (val_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + // WARNING: This object doesn't live past this scope, needs clone! + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false); + return ret_ret; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr); + if (val_conv.free == LDKSignerProvider_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKSignerProvider_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -33642,6 +34259,33 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1t ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + // WARNING: This object doesn't live past this scope, needs clone! + int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false); + return ret_ret; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelManagerReadArgs this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKRouter val_conv = *(LDKRouter*)(val_ptr); + if (val_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -33696,13 +34340,27 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1d ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) { - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t default_config, int64_tArray channel_monitors) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + void* signer_provider_ptr = untag_ptr(signer_provider); + CHECK_ACCESS(signer_provider_ptr); + LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr); + if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKSignerProvider_JCalls_cloned(&signer_provider_conv); } void* fee_estimator_ptr = untag_ptr(fee_estimator); CHECK_ACCESS(fee_estimator_ptr); @@ -33725,6 +34383,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv); } + void* router_ptr = untag_ptr(router); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -33754,7 +34419,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new channel_monitors_constr.data[q] = channel_monitors_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0); - LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr); + LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -33786,10 +34451,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) { - unsigned char key_material_arr[32]; + uint8_t key_material_arr[32]; CHECK((*env)->GetArrayLength(env, key_material) == 32); (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr); - unsigned char (*key_material_ref)[32] = &key_material_arr; + uint8_t (*key_material_ref)[32] = &key_material_arr; LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -33797,7 +34462,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *en return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t keys_manager, int64_t current_time) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t entropy_source, int64_t current_time, int64_t min_final_cltv_expiry_delta) { LDKExpandedKey keys_conv; keys_conv.inner = untag_ptr(keys); keys_conv.is_owned = ptr_is_owned(keys); @@ -33807,15 +34472,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); - void* keys_manager_ptr = untag_ptr(keys_manager); - if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); } - LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr; + void* entropy_source_ptr = untag_ptr(entropy_source); + if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); } + LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr; + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); - *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time); + *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time, int64_t min_final_cltv_expiry_delta) { LDKExpandedKey keys_conv; keys_conv.inner = untag_ptr(keys); keys_conv.is_owned = ptr_is_owned(keys); @@ -33828,8 +34497,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv * LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); - *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time); + *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } @@ -37537,6 +38210,80 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *en return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UnsignedGossipMessage_free(this_ptr_conv); +} + +static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) { + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg); + int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) { + LDKUnsignedChannelAnnouncement a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UnsignedChannelAnnouncement_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) { + LDKUnsignedChannelUpdate a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UnsignedChannelUpdate_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_channel_update(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) { + LDKUnsignedNodeAnnouncement a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UnsignedNodeAnnouncement_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_node_announcement(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj); + LDKCVec_u8Z ret_var = UnsignedGossipMessage_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 void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKUnsignedNodeAnnouncement this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -37591,27 +38338,31 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_ UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv); } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -37947,96 +38698,112 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1s UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv); } static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) { @@ -41047,27 +41814,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * PeerHandleError_free(this_obj_conv); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPeerHandleError this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { - LDKPeerHandleError this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - PeerHandleError_set_no_connection_possible(&this_ptr_conv, val); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) { - LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) { + LDKPeerHandleError ret_var = PeerHandleError_new(); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -41112,20 +41860,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, PeerManager_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler, int64_t node_signer) { LDKMessageHandler message_handler_conv; message_handler_conv.inner = untag_ptr(message_handler); message_handler_conv.is_owned = ptr_is_owned(message_handler); CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv); // WARNING: we need a move here but no clone is available for LDKMessageHandler - LDKSecretKey our_node_secret_ref; - CHECK((*env)->GetArrayLength(env, our_node_secret) == 32); - (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes); - unsigned char ephemeral_random_data_arr[32]; + uint8_t ephemeral_random_data_arr[32]; CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32); (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr); - unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; + uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -41140,29 +41885,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *en // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv); } - LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv); + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPeerManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv); - jobjectArray ret_arr = NULL; - ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); - ; - for (size_t i = 0; i < ret_var.datalen; i++) { - int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form); - (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_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); + for (size_t o = 0; o < ret_var.datalen; o++) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv_40_conv = ret_var.data[o]; + ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true); } - + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); return ret_arr; } @@ -41265,7 +42017,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnec PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) { LDKPeerManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -41274,7 +42026,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1n LDKPublicKey node_id_ref; CHECK((*env)->GetArrayLength(env, node_id) == 33); (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); - PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible); + PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -41386,10 +42138,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JN } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) { - unsigned char commitment_seed_arr[32]; + uint8_t commitment_seed_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_seed) == 32); (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr); - unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr; + uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data); return ret_arr; @@ -41524,10 +42276,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JN LDKPublicKey per_commitment_point_ref; CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33); (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form); - unsigned char base_secret_arr[32]; + uint8_t base_secret_arr[32]; CHECK((*env)->GetArrayLength(env, base_secret) == 32); (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr); - unsigned char (*base_secret_ref)[32] = &base_secret_arr; + uint8_t (*base_secret_ref)[32] = &base_secret_arr; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes); return ret_arr; @@ -41546,14 +42298,14 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNI } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) { - unsigned char per_commitment_secret_arr[32]; + uint8_t per_commitment_secret_arr[32]; CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32); (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr); - unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr; - unsigned char countersignatory_revocation_base_secret_arr[32]; + uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr; + uint8_t countersignatory_revocation_base_secret_arr[32]; CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32); (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr); - unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr; + uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes); return ret_arr; @@ -42286,10 +43038,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemsc } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, jboolean opt_anchors, jboolean use_non_zero_fee_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { - unsigned char commitment_txid_arr[32]; + uint8_t commitment_txid_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_txid) == 32); (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr); - unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr; + uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr; LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = untag_ptr(htlc); htlc_conv.is_owned = ptr_is_owned(htlc); @@ -43152,10 +43904,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransact this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char funding_key_arr[32]; + uint8_t funding_key_arr[32]; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr); - unsigned char (*funding_key_ref)[32] = &funding_key_arr; + uint8_t (*funding_key_ref)[32] = &funding_key_arr; LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript); funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL); @@ -43364,10 +44116,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransacti this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char funding_key_arr[32]; + uint8_t funding_key_arr[32]; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr); - unsigned char (*funding_key_ref)[32] = &funding_key_arr; + uint8_t (*funding_key_ref)[32] = &funding_key_arr; LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript); funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL); @@ -43578,10 +44330,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransactio this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - unsigned char htlc_base_key_arr[32]; + uint8_t htlc_base_key_arr[32]; CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32); (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr); - unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr; + uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr; LDKDirectedChannelTransactionParameters channel_parameters_conv; channel_parameters_conv.inner = untag_ptr(channel_parameters); channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); @@ -43693,6 +44445,36 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq return ret_conv; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKBolt12InvoiceFeatures a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKBolt12InvoiceFeatures b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKBlindedHopFeatures a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKBlindedHopFeatures b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { LDKChannelTypeFeatures a_conv; a_conv.inner = untag_ptr(a); @@ -43888,6 +44670,66 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clo return ret_ref; } +static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) { + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKBolt12InvoiceFeatures arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKBolt12InvoiceFeatures orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) { + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKBlindedHopFeatures arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKBlindedHopFeatures orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); int64_t ret_ref = 0; @@ -43966,6 +44808,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(J InvoiceRequestFeatures_free(this_obj_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKBolt12InvoiceFeatures this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + Bolt12InvoiceFeatures_free(this_obj_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKBlindedHopFeatures this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + BlindedHopFeatures_free(this_obj_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelTypeFeatures this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -44082,6 +44940,42 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1re return ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) { + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty(); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) { + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty(); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBlindedHopFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) { LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); int64_t ret_ref = 0; @@ -44192,71 +45086,48 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEn return tag_ptr(ret_conv, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKChannelTypeFeatures obj_conv; - obj_conv.inner = untag_ptr(obj); - obj_conv.is_owned = ptr_is_owned(obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = ChannelTypeFeatures_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_ChannelTypeFeatures_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_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = ChannelTypeFeatures_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKOfferFeatures obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKBlindedHopFeatures obj_conv; obj_conv.inner = untag_ptr(obj); obj_conv.is_owned = ptr_is_owned(obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = OfferFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = BlindedHopFeatures_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_OfferFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_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_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); - *ret_conv = OfferFeatures_read(ser_ref); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = BlindedHopFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKInvoiceRequestFeatures obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelTypeFeatures obj_conv; obj_conv.inner = untag_ptr(obj); obj_conv.is_owned = ptr_is_owned(obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = InvoiceRequestFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_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_InvoiceRequestFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_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_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); - *ret_conv = InvoiceRequestFeatures_read(ser_ref); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } @@ -44943,6 +45814,34 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_ return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -44973,6 +45872,16 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_ return ret_conv; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKBolt12InvoiceFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -45049,6 +45958,120 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wu return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInitFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -45695,10 +46718,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; + uint8_t pubkey_hash_arr[20]; CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20); (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; + uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -45707,10 +46730,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) { - unsigned char script_hash_arr[32]; + uint8_t script_hash_arr[32]; CHECK((*env)->GetArrayLength(env, script_hash) == 32); (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr); - unsigned char (*script_hash_ref)[32] = &script_hash_arr; + uint8_t (*script_hash_ref)[32] = &script_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -45768,6 +46791,206 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compat return ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + Retry_free(this_ptr_conv); +} + +static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg); + int64_t ret_conv = Retry_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig); + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_attempts(a); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_timeout(a); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRetry* a_conv = (LDKRetry*)untag_ptr(a); + LDKRetry* b_conv = (LDKRetry*)untag_ptr(b); + jboolean ret_conv = Retry_eq(a_conv, b_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRetry* o_conv = (LDKRetry*)untag_ptr(o); + int64_t ret_conv = Retry_hash(o_conv); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig); + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment()); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PaymentSendFailure_free(this_ptr_conv); +} + +static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) { + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg); + int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKAPIError a_conv = *(LDKAPIError*)(a_ptr); + a_conv = APIError_clone((LDKAPIError*)untag_ptr(a)); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_parameter_error(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) { + LDKCVec_CResult_NoneAPIErrorZZ a_constr; + a_constr.datalen = (*env)->GetArrayLength(env, a); + if (a_constr.datalen > 0) + a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + a_constr.data = NULL; + int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); + for (size_t w = 0; w < a_constr.datalen; w++) { + int64_t a_conv_22 = a_vals[w]; + void* a_conv_22_ptr = untag_ptr(a_conv_22); + CHECK_ACCESS(a_conv_22_ptr); + LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); + a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22)); + a_constr.data[w] = a_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_path_parameter_error(a_constr); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) { + LDKCVec_APIErrorZ a_constr; + a_constr.datalen = (*env)->GetArrayLength(env, a); + if (a_constr.datalen > 0) + a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); + else + a_constr.data = NULL; + int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL); + for (size_t k = 0; k < a_constr.datalen; k++) { + int64_t a_conv_10 = a_vals[k]; + void* a_conv_10_ptr = untag_ptr(a_conv_10); + CHECK_ACCESS(a_conv_10_ptr); + LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr); + a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10)); + a_constr.data[k] = a_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, a, a_vals, 0); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) { + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_duplicate_payment(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) { + LDKCVec_CResult_NoneAPIErrorZZ results_constr; + results_constr.datalen = (*env)->GetArrayLength(env, results); + if (results_constr.datalen > 0) + results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + results_constr.data = NULL; + int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL); + for (size_t w = 0; w < results_constr.datalen; w++) { + int64_t results_conv_22 = results_vals[w]; + void* results_conv_22_ptr = untag_ptr(results_conv_22); + CHECK_ACCESS(results_conv_22_ptr); + LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); + results_constr.data[w] = results_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, results, results_vals, 0); + LDKRouteParameters failed_paths_retry_conv; + failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry); + failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry); + CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv); + failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -45808,6 +47031,168 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass Type_free(this_ptr_conv); } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig); + jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx()); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UtxoResult_free(this_ptr_conv); +} + +static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) { + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg); + int64_t ret_conv = UtxoResult_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr); + a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a)); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_sync(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) { + LDKUtxoFuture a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = UtxoFuture_clone(&a_conv); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_async(a_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UtxoLookup_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKUtxoFuture this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + UtxoFuture_free(this_obj_conv); +} + +static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) { + LDKUtxoFuture ret_var = UtxoFuture_clone(arg); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKUtxoFuture arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKUtxoFuture orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) { + LDKUtxoFuture ret_var = UtxoFuture_new(); + int64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve_1without_1forwarding(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t result) { + LDKUtxoFuture this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNetworkGraph graph_conv; + graph_conv.inner = untag_ptr(graph); + graph_conv.is_owned = ptr_is_owned(graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv); + graph_conv.is_owned = false; + void* result_ptr = untag_ptr(result); + CHECK_ACCESS(result_ptr); + LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr); + UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) { + LDKUtxoFuture this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNetworkGraph graph_conv; + graph_conv.inner = untag_ptr(graph); + graph_conv.is_owned = ptr_is_owned(graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv); + graph_conv.is_owned = false; + LDKP2PGossipSync gossip_conv; + gossip_conv.inner = untag_ptr(gossip); + gossip_conv.is_owned = ptr_is_owned(gossip); + CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv); + gossip_conv.is_owned = false; + void* result_ptr = untag_ptr(result); + CHECK_ACCESS(result_ptr); + LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr); + UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -46010,21 +47395,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *en P2PGossipSync_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t utxo_lookup, int64_t logger) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = untag_ptr(network_graph); network_graph_conv.is_owned = ptr_is_owned(network_graph); CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); network_graph_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } void* logger_ptr = untag_ptr(logger); @@ -46034,31 +47419,31 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv * // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv); + LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) { LDKP2PGossipSync this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } - P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv); + P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) { @@ -47331,33 +48716,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv NodeInfo_set_channels(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKNodeInfo this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKNodeInfo this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; - val_conv.inner = untag_ptr(val); - val_conv.is_owned = ptr_is_owned(val); - CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = RoutingFees_clone(&val_conv); - NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -47385,7 +48743,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1i NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) { LDKCVec_u64Z channels_arg_constr; channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg); if (channels_arg_constr.datalen > 0) @@ -47398,17 +48756,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, channels_arg_constr.data[g] = channels_arg_conv_6; } (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0); - LDKRoutingFees lowest_inbound_channel_fees_arg_conv; - lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg); - lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv); - lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); LDKNodeAnnouncementInfo announcement_info_arg_conv; announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg); announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv); announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); - LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); + LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -47513,10 +48866,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) { - LDKThirtyTwoBytes genesis_hash_ref; - CHECK((*env)->GetArrayLength(env, genesis_hash) == 32); - (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) { + LDKNetwork network_conv = LDKNetwork_from_java(env, network); void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -47524,7 +48875,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *e // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv); + LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -47597,7 +48948,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_ return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t utxo_lookup) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -47608,23 +48959,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t utxo_lookup) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -47635,19 +48986,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv); return tag_ptr(ret_conv, true); } @@ -47909,8 +49260,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlight inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); - LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, inflight_htlcs_conv); + inflight_htlcs_conv.is_owned = false; + LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -48567,32 +49918,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1v RouteParameters_set_final_value_msat(&this_ptr_conv, val); } -JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteParameters this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKRouteParameters this_ptr_conv; - this_ptr_conv.inner = untag_ptr(this_ptr); - this_ptr_conv.is_owned = ptr_is_owned(this_ptr); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - this_ptr_conv.is_owned = false; - RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg) { LDKPaymentParameters payment_params_arg_conv; payment_params_arg_conv.inner = untag_ptr(payment_params_arg); payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv); payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv); - LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg); + LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -48629,6 +49961,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIE return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteParameters a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKRouteParameters b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv); + return ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKRouteParameters obj_conv; obj_conv.inner = untag_ptr(obj); @@ -48880,7 +50227,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previo 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) { +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + PaymentParameters_set_final_cltv_expiry_delta(&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_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int32_t final_cltv_expiry_delta_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); @@ -48922,7 +50288,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIE 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); + 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, final_cltv_expiry_delta_arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -48997,32 +50363,32 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1writ return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); - *ret_conv = PaymentParameters_read(ser_ref); + *ret_conv = PaymentParameters_read(ser_ref, arg); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) { LDKPublicKey payee_pubkey_ref; CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33); (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form); - LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref); + LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) { LDKPublicKey payee_pubkey_ref; CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33); (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form); - LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref); + LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -49481,10 +50847,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc void* scorer_ptr = untag_ptr(scorer); if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; - unsigned char random_seed_bytes_arr[32]; + uint8_t random_seed_bytes_arr[32]; CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr); - unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; + uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } @@ -49525,10 +50891,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_build_1route_1from_1hops(JN // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - unsigned char random_seed_bytes_arr[32]; + uint8_t random_seed_bytes_arr[32]; CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr); - unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; + uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref); return tag_ptr(ret_conv, true); @@ -50131,6 +51497,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estima return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1channel_1liquidity_1probabilities(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) { + LDKProbabilisticScorer this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeId target_conv; + target_conv.inner = untag_ptr(target); + target_conv.is_owned = ptr_is_owned(target); + CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); + target_conv.is_owned = false; + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) { LDKProbabilisticScorer this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -50357,7 +51740,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *e return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t keys_manager) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) { LDKCVec_PublicKeyZ node_pks_constr; node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks); if (node_pks_constr.datalen > 0) @@ -50371,11 +51754,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *en (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form); node_pks_constr.data[i] = node_pks_conv_8_ref; } - void* keys_manager_ptr = untag_ptr(keys_manager); - if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); } - LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr; + void* entropy_source_ptr = untag_ptr(entropy_source); + if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); } + LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr; LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); - *ret_conv = BlindedPath_new(node_pks_constr, keys_manager_conv); + *ret_conv = BlindedPath_new(node_pks_constr, entropy_source_conv); return tag_ptr(ret_conv, true); } @@ -50586,13 +51969,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1fre CustomOnionMessageHandler_free(this_ptr_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t logger, int64_t custom_handler) { - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t custom_handler) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -50608,7 +51998,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv); } - LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_conv); + LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -50777,21 +52167,24 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1d return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t entropy_source, int64_t signer_provider) { LDKFilesystemPersister this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); } + void* signer_provider_ptr = untag_ptr(signer_provider); + if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); } + LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr; LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ"); - *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv); + *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, entropy_source_conv, signer_provider_conv); return tag_ptr(ret_conv, true); } @@ -51895,93 +53288,93 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKMinFinalCltvExpiry this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKMinFinalCltvExpiryDelta this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); this_obj_conv.is_owned = ptr_is_owned(this_obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - MinFinalCltvExpiry_free(this_obj_conv); + MinFinalCltvExpiryDelta_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKMinFinalCltvExpiry this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKMinFinalCltvExpiryDelta this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv); return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKMinFinalCltvExpiry this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKMinFinalCltvExpiryDelta this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - MinFinalCltvExpiry_set_a(&this_ptr_conv, val); + MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) { - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) { + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) { - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg); +static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) { + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKMinFinalCltvExpiry arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKMinFinalCltvExpiryDelta arg_conv; arg_conv.inner = untag_ptr(arg); arg_conv.is_owned = ptr_is_owned(arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); arg_conv.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKMinFinalCltvExpiry orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKMinFinalCltvExpiryDelta orig_conv; orig_conv.inner = untag_ptr(orig); orig_conv.is_owned = ptr_is_owned(orig); CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); orig_conv.is_owned = false; - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv); + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKMinFinalCltvExpiry o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKMinFinalCltvExpiryDelta o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); o_conv.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv); return ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKMinFinalCltvExpiry a_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKMinFinalCltvExpiryDelta a_conv; a_conv.inner = untag_ptr(a); a_conv.is_owned = ptr_is_owned(a); CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); a_conv.is_owned = false; - LDKMinFinalCltvExpiry b_conv; + LDKMinFinalCltvExpiryDelta b_conv; b_conv.inner = untag_ptr(b); b_conv.is_owned = ptr_is_owned(b); CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); b_conv.is_owned = false; - jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv); + jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv); return ret_conv; } @@ -52330,13 +53723,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) { LDKRawInvoice this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv); + LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&this_arg_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -52601,13 +53994,13 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNI return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv); + int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv); return ret_conv; } @@ -52787,6 +54180,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1rout return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short()); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a); LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b); @@ -52932,77 +54330,90 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1st return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKInvoicePayer this_obj_conv; - this_obj_conv.inner = untag_ptr(this_obj); - this_obj_conv.is_owned = ptr_is_owned(this_obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - InvoicePayer_free(this_obj_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Payer_free(this_ptr_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Retry_free(this_ptr_conv); -} - -static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_clone(arg); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg); - int64_t ret_conv = Retry_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig); - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_clone(orig_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_attempts(a); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_timeout(a); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRetry* a_conv = (LDKRetry*)untag_ptr(a); - LDKRetry* b_conv = (LDKRetry*)untag_ptr(b); - jboolean ret_conv = Retry_eq(a_conv, b_conv); - return ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRetry* o_conv = (LDKRetry*)untag_ptr(o); - int64_t ret_conv = Retry_hash(o_conv); - return ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) { + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -53042,201 +54453,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) { - LDKLightningError a_conv; - a_conv.inner = untag_ptr(a); - a_conv.is_owned = ptr_is_owned(a); - CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - a_conv = LightningError_clone(&a_conv); - LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); - *ret_copy = PaymentError_routing(a_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) { - void* a_ptr = untag_ptr(a); - CHECK_ACCESS(a_ptr); - LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr); - a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a)); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) { + LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a); LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); *ret_copy = PaymentError_sending(a_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t logger, int64_t event_handler, int64_t retry) { - void* payer_ptr = untag_ptr(payer); - CHECK_ACCESS(payer_ptr); - LDKPayer payer_conv = *(LDKPayer*)(payer_ptr); - if (payer_conv.free == LDKPayer_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKPayer_JCalls_cloned(&payer_conv); - } - void* router_ptr = untag_ptr(router); - CHECK_ACCESS(router_ptr); - LDKRouter router_conv = *(LDKRouter*)(router_ptr); - if (router_conv.free == LDKRouter_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKRouter_JCalls_cloned(&router_conv); - } - void* logger_ptr = untag_ptr(logger); - CHECK_ACCESS(logger_ptr); - LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - void* event_handler_ptr = untag_ptr(event_handler); - CHECK_ACCESS(event_handler_ptr); - LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr); - if (event_handler_conv.free == LDKEventHandler_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKEventHandler_JCalls_cloned(&event_handler_conv); - } - void* retry_ptr = untag_ptr(retry); - CHECK_ACCESS(retry_ptr); - LDKRetry retry_conv = *(LDKRetry*)(retry_ptr); - retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry)); - LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv); - int64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int8_tArray payment_id) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); - *ret_conv = InvoicePayer_pay_invoice_with_id(&this_arg_conv, &invoice_conv, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats, int8_tArray payment_id) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKInvoice invoice_conv; - invoice_conv.inner = untag_ptr(invoice); - invoice_conv.is_owned = ptr_is_owned(invoice); - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); - invoice_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); - *ret_conv = InvoicePayer_pay_zero_value_invoice_with_id(&this_arg_conv, &invoice_conv, amount_msats, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKThirtyTwoBytes payment_preimage_ref; - CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); - (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int8_tArray payment_id, int64_t amount_msats, int32_t final_cltv_expiry_delta) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKThirtyTwoBytes payment_preimage_ref; - CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); - (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKThirtyTwoBytes payment_id_ref; - CHECK((*env)->GetArrayLength(env, payment_id) == 32); - (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); - LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); - *ret_conv = InvoicePayer_pay_pubkey_with_id(&this_arg_conv, pubkey_ref, payment_preimage_ref, payment_id_ref, amount_msats, final_cltv_expiry_delta); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - unsigned char payment_hash_arr[32]; - CHECK((*env)->GetArrayLength(env, payment_hash) == 32); - (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); - unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; - InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInvoicePayer this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t keys_manager, int64_t logger, jclass network) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) { void* amt_msat_ptr = untag_ptr(amt_msat); CHECK_ACCESS(amt_msat_ptr); LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); @@ -53262,12 +54487,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JN phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0); - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53277,12 +54509,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JN LDKLogger_JCalls_cloned(&logger_conv); } LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, keys_manager_conv, logger_conv, network_conv); + *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t keys_manager, int64_t logger, jclass network) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) { void* amt_msat_ptr = untag_ptr(amt_msat); CHECK_ACCESS(amt_msat_ptr); LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); @@ -53312,12 +54548,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1w phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0); - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53327,23 +54570,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1w LDKLogger_JCalls_cloned(&logger_conv); } LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, keys_manager_conv, logger_conv, network_conv); + *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53358,23 +54605,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat)); LDKStr description_conv = java_to_owned_str(env, description); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53393,23 +54644,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan description_hash_conv.is_owned = ptr_is_owned(description_hash); CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); description_hash_conv = Sha256_clone(&description_hash_conv); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53428,23 +54683,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan description_hash_conv.is_owned = ptr_is_owned(description_hash); CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); description_hash_conv = Sha256_clone(&description_hash_conv); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53459,23 +54718,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat)); LDKStr description_conv = java_to_owned_str(env, description); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash, int64_t min_final_cltv_expiry_delta) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); channelmanager_conv.is_owned = ptr_is_owned(channelmanager); CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); channelmanager_conv.is_owned = false; - void* keys_manager_ptr = untag_ptr(keys_manager); - CHECK_ACCESS(keys_manager_ptr); - LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); - if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -53493,22 +54756,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKChannelManager this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer"); - *ret_ret = ChannelManager_as_Payer(&this_arg_conv); - return tag_ptr(ret_ret, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); @@ -53594,13 +54850,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv * RapidGossipSync_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = untag_ptr(network_graph); network_graph_conv.is_owned = ptr_is_owned(network_graph); CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); network_graph_conv.is_owned = false; - LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv); + void* logger_ptr = untag_ptr(logger); + CHECK_ACCESS(logger_ptr); + LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv); int64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -53622,6 +54885,25 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1ne return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) { + LDKRapidGossipSync this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKu8slice update_data_ref; + update_data_ref.datalen = (*env)->GetArrayLength(env, update_data); + update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL); + void* current_time_unix_ptr = untag_ptr(current_time_unix); + CHECK_ACCESS(current_time_unix_ptr); + LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr); + current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix)); + LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); + *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv); + (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0); + return tag_ptr(ret_conv, true); +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) { LDKRapidGossipSync this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); diff --git a/src/main/jni/org_ldk_enums_AccessError.h b/src/main/jni/org_ldk_enums_AccessError.h deleted file mode 100644 index e896e96b..00000000 --- a/src/main/jni/org_ldk_enums_AccessError.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_ldk_enums_AccessError */ - -#ifndef _Included_org_ldk_enums_AccessError -#define _Included_org_ldk_enums_AccessError -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_ldk_enums_AccessError - * Method: init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/main/jni/org_ldk_enums_FailureCode.h b/src/main/jni/org_ldk_enums_FailureCode.h new file mode 100644 index 00000000..ce947c83 --- /dev/null +++ b/src/main/jni/org_ldk_enums_FailureCode.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_enums_FailureCode */ + +#ifndef _Included_org_ldk_enums_FailureCode +#define _Included_org_ldk_enums_FailureCode +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_enums_FailureCode + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_enums_FailureCode_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_enums_RetryableSendFailure.h b/src/main/jni/org_ldk_enums_RetryableSendFailure.h new file mode 100644 index 00000000..2a93cf18 --- /dev/null +++ b/src/main/jni/org_ldk_enums_RetryableSendFailure.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_enums_RetryableSendFailure */ + +#ifndef _Included_org_ldk_enums_RetryableSendFailure +#define _Included_org_ldk_enums_RetryableSendFailure +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_enums_RetryableSendFailure + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_enums_UtxoLookupError.h b/src/main/jni/org_ldk_enums_UtxoLookupError.h new file mode 100644 index 00000000..0913647c --- /dev/null +++ b/src/main/jni/org_ldk_enums_UtxoLookupError.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_enums_UtxoLookupError */ + +#ifndef _Included_org_ldk_enums_UtxoLookupError +#define _Included_org_ldk_enums_UtxoLookupError +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_enums_UtxoLookupError + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index 2a330111..c9fb168d 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -87,6 +87,30 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubk JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKAPIError_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKAPIError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneAPIErrorZ_get_ok + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneAPIErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCOption_HTLCClaimZ_ref_from_ptr @@ -679,6 +703,54 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecode JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKNetworkUpdate_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKNetworkUpdate; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_NetworkUpdateZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_NetworkUpdateZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKPathFailure_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKPathFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_PathFailureZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_PathFailureZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKClosureReason_ref_from_ptr @@ -751,22 +823,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestina JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u128Z_1ref_1from_1ptr (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: LDKNetworkUpdate_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKNetworkUpdate; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LDKCOption_NetworkUpdateZ_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_NetworkUpdateZ; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: LDKSpendableOutputDescriptor_ref_from_ptr @@ -823,22 +879,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_get_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_get_err - * Signature: (J)Lorg/ldk/enums/AccessError; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: C2Tuple_usizeTransactionZ_get_a @@ -943,6 +983,46 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_Z_get_a + * Signature: (J)[S + */ +JNIEXPORT jshortArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_Z_get_b + * Signature: (J)[S + */ +JNIEXPORT jshortArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple__u168_u168Z_get_a + * Signature: (J)[S + */ +JNIEXPORT jshortArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1a + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple__u168_u168Z_get_b + * Signature: (J)[S + */ +JNIEXPORT jshortArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_C2Tuple_EightU16sEightU16sZZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_C2Tuple_EightU16sEightU16sZZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKLogger_new @@ -1033,106 +1113,114 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecod /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_get_err + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_get_ok + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_get_err + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok + * Method: CResult_NodeIdDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err + * Method: CResult_NodeIdDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NodeIdDecodeErrorZ_get_ok + * Method: CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NodeIdDecodeErrorZ_get_err + * Method: CResult_COption_NetworkUpdateZDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok + * Method: CResult_TxOutUtxoLookupErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_NetworkUpdateZDecodeErrorZ_get_err - * Signature: (J)J + * Method: CResult_TxOutUtxoLookupErrorZ_get_err + * Signature: (J)Lorg/ldk/enums/UtxoLookupError; */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKUtxoResult_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKUtxoResult; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKAccess_new - * Signature: (Lorg/ldk/impl/bindings/LDKAccess;)J + * Method: LDKUtxoLookup_new + * Signature: (Lorg/ldk/impl/bindings/LDKUtxoLookup;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: Access_get_utxo + * Method: UtxoLookup_get_utxo * Signature: (J[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCOption_AccessZ_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_AccessZ; + * Method: LDKCOption_UtxoLookupZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_UtxoLookupZ; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* @@ -1425,274 +1513,250 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1 /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_SignatureSignatureZ_get_a - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_SignatureSignatureZ_get_b + * Method: CResult_PublicKeyNoneZ_get_ok * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok - * Signature: (J)J + * Method: CResult_PublicKeyNoneZ_get_err + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_get_err - * Signature: (J)V + * Method: LDKCOption_ScalarZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_ScalarZ; */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScalarZ_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_get_ok + * Method: CResult_SharedSecretNoneZ_get_ok * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_get_err + * Method: CResult_SharedSecretNoneZ_get_err * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_get_ok + * Method: CResult_RecoverableSignatureNoneZ_get_ok * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_get_err + * Method: CResult_RecoverableSignatureNoneZ_get_err * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCOption_ScalarZ_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_ScalarZ; + * Method: LDKChannelSigner_new + * Signature: (Lorg/ldk/impl/bindings/LDKChannelSigner;J)J */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScalarZ_1ref_1from_1ptr - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new + (JNIEnv *, jclass, jobject, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SharedSecretNoneZ_get_ok - * Signature: (J)[B + * Method: ChannelSigner_get_per_commitment_point + * Signature: (JJ)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1ok - (JNIEnv *, jclass, jlong); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1per_1commitment_1point + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SharedSecretNoneZ_get_err - * Signature: (J)V + * Method: ChannelSigner_release_commitment_secret + * Signature: (JJ)[B */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1err - (JNIEnv *, jclass, jlong); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKBaseSign_new - * Signature: (Lorg/ldk/impl/bindings/LDKBaseSign;J)J + * Method: ChannelSigner_validate_holder_commitment + * Signature: (JJ[[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new - (JNIEnv *, jclass, jobject, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment + (JNIEnv *, jclass, jlong, jlong, jobjectArray); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_get_per_commitment_point - * Signature: (JJ)[B + * Method: ChannelSigner_channel_keys_id + * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_release_commitment_secret - * Signature: (JJ)[B + * Method: ChannelSigner_provide_channel_parameters + * Signature: (JJ)V */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_validate_holder_commitment - * Signature: (JJ[[B)J + * Method: ChannelSigner_get_pubkeys + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment - (JNIEnv *, jclass, jlong, jlong, jobjectArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_channel_keys_id - * Signature: (J)[B + * Method: LDKEcdsaChannelSigner_new + * Signature: (Lorg/ldk/impl/bindings/LDKEcdsaChannelSigner;Lorg/ldk/impl/bindings/LDKChannelSigner;J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new + (JNIEnv *, jclass, jobject, jobject, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKEcdsaChannelSigner_get_ChannelSigner + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_counterparty_commitment + * Method: EcdsaChannelSigner_sign_counterparty_commitment * Signature: (JJ[[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment (JNIEnv *, jclass, jlong, jlong, jobjectArray); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_validate_counterparty_revocation + * Method: EcdsaChannelSigner_validate_counterparty_revocation * Signature: (JJ[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation (JNIEnv *, jclass, jlong, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_holder_commitment_and_htlcs + * Method: EcdsaChannelSigner_sign_holder_commitment_and_htlcs * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_justice_revoked_output + * Method: EcdsaChannelSigner_sign_justice_revoked_output * Signature: (J[BJJ[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1output (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_justice_revoked_htlc + * Method: EcdsaChannelSigner_sign_justice_revoked_htlc * Signature: (J[BJJ[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1htlc (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_counterparty_htlc_transaction + * Method: EcdsaChannelSigner_sign_counterparty_htlc_transaction * Signature: (J[BJJ[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1htlc_1transaction (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_closing_transaction + * Method: EcdsaChannelSigner_sign_closing_transaction * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1closing_1transaction (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_holder_anchor_input + * Method: EcdsaChannelSigner_sign_holder_anchor_input * Signature: (J[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1anchor_1input +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1anchor_1input (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_sign_channel_announcement + * Method: EcdsaChannelSigner_sign_channel_announcement_with_funding_key * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1channel_1announcement_1with_1funding_1key (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_provide_channel_parameters - * Signature: (JJ)V + * Method: LDKWriteableEcdsaChannelSigner_new + * Signature: (Lorg/ldk/impl/bindings/LDKWriteableEcdsaChannelSigner;Lorg/ldk/impl/bindings/LDKEcdsaChannelSigner;Lorg/ldk/impl/bindings/LDKChannelSigner;J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1provide_1channel_1parameters - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new + (JNIEnv *, jclass, jobject, jobject, jobject, jlong); /* * Class: org_ldk_impl_bindings - * Method: BaseSign_get_pubkeys + * Method: LDKWriteableEcdsaChannelSigner_get_EcdsaChannelSigner * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKSign_new - * Signature: (Lorg/ldk/impl/bindings/LDKSign;Lorg/ldk/impl/bindings/LDKBaseSign;J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSign_1new - (JNIEnv *, jclass, jobject, jobject, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LDKSign_get_BaseSign + * Method: LDKWriteableEcdsaChannelSigner_get_ChannelSigner * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Sign_write + * Method: WriteableEcdsaChannelSigner_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Sign_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_get_ok + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_get_err + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_get_ok - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_get_err - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -1785,66 +1849,66 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from /* * Class: org_ldk_impl_bindings - * Method: LDKAPIError_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKAPIError; + * Method: CResult__u832APIErrorZ_get_ok + * Signature: (J)[B */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_get_ok - * Signature: (J)V + * Method: CResult__u832APIErrorZ_get_err + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_get_err - * Signature: (J)J + * Method: LDKRecentPaymentDetails_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKRecentPaymentDetails; */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_get_ok - * Signature: (J)[B + * Method: LDKPaymentSendFailure_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKPaymentSendFailure; */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_get_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err + * Method: CResult_NonePaymentSendFailureZ_get_ok + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKPaymentSendFailure_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKPaymentSendFailure; + * Method: CResult_NonePaymentSendFailureZ_get_err + * Signature: (J)J */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_get_ok + * Method: CResult_NoneRetryableSendFailureZ_get_ok * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_get_err - * Signature: (J)J + * Method: CResult_NoneRetryableSendFailureZ_get_err + * Signature: (J)Lorg/ldk/enums/RetryableSendFailure; */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -1863,6 +1927,22 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaym JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentHashRetryableSendFailureZ_get_ok + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentHashRetryableSendFailureZ_get_err + * Signature: (J)Lorg/ldk/enums/RetryableSendFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: C2Tuple_PaymentHashPaymentIdZ_get_a @@ -2105,98 +2185,122 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcas /* * Class: org_ldk_impl_bindings - * Method: LDKKeysInterface_new - * Signature: (Lorg/ldk/impl/bindings/LDKKeysInterface;)J + * Method: LDKEntropySource_new + * Signature: (Lorg/ldk/impl/bindings/LDKEntropySource;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_node_secret - * Signature: (JLorg/ldk/enums/Recipient;)J + * Method: EntropySource_get_secure_random_bytes + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret - (JNIEnv *, jclass, jlong, jobject); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKUnsignedGossipMessage_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKUnsignedGossipMessage; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKNodeSigner_new + * Signature: (Lorg/ldk/impl/bindings/LDKNodeSigner;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeSigner_get_inbound_payment_key_material + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_node_id + * Method: NodeSigner_get_node_id * Signature: (JLorg/ldk/enums/Recipient;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1id +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id (JNIEnv *, jclass, jlong, jobject); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_ecdh + * Method: NodeSigner_ecdh * Signature: (JLorg/ldk/enums/Recipient;[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1ecdh +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh (JNIEnv *, jclass, jlong, jobject, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_destination_script - * Signature: (J)[B + * Method: NodeSigner_sign_invoice + * Signature: (J[B[BLorg/ldk/enums/Recipient;)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1invoice + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jobject); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_shutdown_scriptpubkey - * Signature: (J)J + * Method: NodeSigner_sign_gossip_message + * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_generate_channel_keys_id - * Signature: (JZJ[B)[B + * Method: LDKSignerProvider_new + * Signature: (Lorg/ldk/impl/bindings/LDKSignerProvider;)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1generate_1channel_1keys_1id - (JNIEnv *, jclass, jlong, jboolean, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new + (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_derive_channel_signer - * Signature: (JJ[B)J + * Method: SignerProvider_generate_channel_keys_id + * Signature: (JZJ[B)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1derive_1channel_1signer - (JNIEnv *, jclass, jlong, jlong, jbyteArray); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1generate_1channel_1keys_1id + (JNIEnv *, jclass, jlong, jboolean, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_secure_random_bytes - * Signature: (J)[B + * Method: SignerProvider_derive_channel_signer + * Signature: (JJ[B)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SignerProvider_1derive_1channel_1signer + (JNIEnv *, jclass, jlong, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_read_chan_signer + * Method: SignerProvider_read_chan_signer * Signature: (J[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_sign_invoice - * Signature: (J[B[BLorg/ldk/enums/Recipient;)J + * Method: SignerProvider_get_destination_script + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice - (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jobject); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_inbound_payment_key_material - * Signature: (J)[B + * Method: SignerProvider_get_shutdown_scriptpubkey + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey (JNIEnv *, jclass, jlong); /* @@ -2215,6 +2319,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight (JNIEnv *, jclass, jlong, jobject); +/* + * Class: org_ldk_impl_bindings + * Method: LDKRouter_new + * Signature: (Lorg/ldk/impl/bindings/LDKRouter;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: Router_find_route + * Signature: (J[BJ[JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Router_1find_1route + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlongArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Router_find_route_with_id + * Signature: (J[BJ[JJ[B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlongArray, jlong, jbyteArray, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: C2Tuple_BlockHashChannelManagerZ_get_a @@ -2263,6 +2391,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeE JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_APIErrorZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_APIErrorZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_OutPointDecodeErrorZ_get_ok @@ -2639,6 +2791,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnion JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PublicKeyCOption_NetAddressZZ_get_a + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1a + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PublicKeyCOption_NetAddressZZ_get_b + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1b + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_CVec_u8ZPeerHandleErrorZ_get_ok @@ -3775,6 +3943,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1chan JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKRetry_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKRetry; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKChannelMessageHandler_new @@ -3794,18 +3970,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_handle_open_channel - * Signature: (J[BJJ)V + * Signature: (J[BJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_handle_accept_channel - * Signature: (J[BJJ)V + * Signature: (J[BJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -3834,10 +4010,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_handle_shutdown - * Signature: (J[BJJ)V + * Signature: (J[BJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -3914,18 +4090,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_peer_disconnected - * Signature: (J[BZ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected - (JNIEnv *, jclass, jlong, jbyteArray, jboolean); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_peer_connected - * Signature: (J[BJ)J + * Signature: (J[BJZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected - (JNIEnv *, jclass, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jboolean); /* * Class: org_ldk_impl_bindings @@ -4018,18 +4194,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1n /* * Class: org_ldk_impl_bindings * Method: RoutingMessageHandler_get_next_node_announcement - * Signature: (J[B)J + * Signature: (JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: RoutingMessageHandler_peer_connected - * Signature: (J[BJ)J + * Signature: (J[BJZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected - (JNIEnv *, jclass, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jboolean); /* * Class: org_ldk_impl_bindings @@ -4063,6 +4239,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids (JNIEnv *, jclass, jlong, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: RoutingMessageHandler_processing_queue_high + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: RoutingMessageHandler_provided_node_features @@ -4106,18 +4290,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1o /* * Class: org_ldk_impl_bindings * Method: OnionMessageHandler_peer_connected - * Signature: (J[BJ)J + * Signature: (J[BJZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected - (JNIEnv *, jclass, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jboolean); /* * Class: org_ldk_impl_bindings * Method: OnionMessageHandler_peer_disconnected - * Signature: (J[BZ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected - (JNIEnv *, jclass, jlong, jbyteArray, jboolean); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -4247,62 +4431,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: LDKRouter_new - * Signature: (Lorg/ldk/impl/bindings/LDKRouter;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new - (JNIEnv *, jclass, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: Router_find_route - * Signature: (J[BJ[JJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Router_1find_1route - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlongArray, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Router_find_route_with_id - * Signature: (J[BJ[JJ[B[B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlongArray, jlong, jbyteArray, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: Router_notify_payment_path_failed - * Signature: (J[JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1failed - (JNIEnv *, jclass, jlong, jlongArray, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Router_notify_payment_path_successful - * Signature: (J[J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1successful - (JNIEnv *, jclass, jlong, jlongArray); - -/* - * Class: org_ldk_impl_bindings - * Method: Router_notify_payment_probe_successful - * Signature: (J[J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1successful - (JNIEnv *, jclass, jlong, jlongArray); - -/* - * Class: org_ldk_impl_bindings - * Method: Router_notify_payment_probe_failed - * Signature: (J[JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1failed - (JNIEnv *, jclass, jlong, jlongArray, jlong); - /* * Class: org_ldk_impl_bindings * Method: LDKDestination_ref_from_ptr @@ -4337,195 +4465,187 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr /* * Class: org_ldk_impl_bindings - * Method: LDKPayer_new - * Signature: (Lorg/ldk/impl/bindings/LDKPayer;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new - (JNIEnv *, jclass, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: Payer_node_id - * Signature: (J)[B + * Method: _ldk_get_compiled_version + * Signature: ()Ljava/lang/String; */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id - (JNIEnv *, jclass, jlong); +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: Payer_first_hops - * Signature: (J)[J + * Method: _ldk_c_bindings_get_compiled_version + * Signature: ()Ljava/lang/String; */ -JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops - (JNIEnv *, jclass, jlong); +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: Payer_send_payment - * Signature: (JJ[B[B[B)J + * Method: U128_le_bytes + * Signature: ([B)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment - (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray, jbyteArray); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: Payer_send_spontaneous_payment - * Signature: (JJ[B[B)J + * Method: U128_new + * Signature: ([B)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment - (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_U128_1new + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: Payer_retry_payment - * Signature: (JJ[B)J + * Method: BigEndianScalar_new + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment - (JNIEnv *, jclass, jlong, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: Payer_abandon_payment - * Signature: (J[B)V + * Method: Bech32Error_clone_ptr + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment - (JNIEnv *, jclass, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payer_inflight_htlcs + * Method: Bech32Error_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1inflight_1htlcs +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKRetry_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKRetry; + * Method: Bech32Error_free + * Signature: (J)V */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: _ldk_get_compiled_version - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: _ldk_c_bindings_get_compiled_version - * Signature: ()Ljava/lang/String; + * Method: Transaction_free + * Signature: ([B)V */ -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version - (JNIEnv *, jclass); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: U128_le_bytes - * Signature: ([B)[B + * Method: Witness_free + * Signature: ([B)V */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: U128_new - * Signature: ([B)[B + * Method: TxOut_new + * Signature: ([BJ)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_U128_1new - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1new + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: BigEndianScalar_new - * Signature: ([B)J + * Method: TxOut_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Bech32Error_clone_ptr + * Method: TxOut_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Bech32Error_clone + * Method: TxOut_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Bech32Error_free - * Signature: (J)V + * Method: Str_free + * Signature: (Ljava/lang/String;)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free + (JNIEnv *, jclass, jstring); /* * Class: org_ldk_impl_bindings - * Method: Transaction_free - * Signature: ([B)V + * Method: CResult_NoneAPIErrorZ_ok + * Signature: ()J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: Witness_free - * Signature: ([B)V + * Method: CResult_NoneAPIErrorZ_err + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: TxOut_new - * Signature: ([BJ)J + * Method: CResult_NoneAPIErrorZ_is_ok + * Signature: (J)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1new - (JNIEnv *, jclass, jbyteArray, jlong); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: TxOut_free + * Method: CResult_NoneAPIErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: TxOut_clone_ptr + * Method: CResult_NoneAPIErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: TxOut_clone + * Method: CResult_NoneAPIErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Str_free - * Signature: (Ljava/lang/String;)V + * Method: CVec_CResult_NoneAPIErrorZZ_free + * Signature: ([J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free - (JNIEnv *, jclass, jstring); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_APIErrorZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free + (JNIEnv *, jclass, jlongArray); /* * Class: org_ldk_impl_bindings @@ -6055,6 +6175,134 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecode JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetworkUpdateZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetworkUpdateZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetworkUpdateZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetworkUpdateZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetworkUpdateZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_PathFailureZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_PathFailureZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_PathFailureZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_PathFailureZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_PathFailureZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_PathFailureZDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: COption_ClosureReasonZ_some @@ -6273,103 +6521,63 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone /* * Class: org_ldk_impl_bindings - * Method: COption_NetworkUpdateZ_some + * Method: CVec_SpendableOutputDescriptorZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_EventZ_some * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_NetworkUpdateZ_none + * Method: COption_EventZ_none * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: COption_NetworkUpdateZ_free + * Method: COption_EventZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_NetworkUpdateZ_clone_ptr + * Method: COption_EventZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_NetworkUpdateZ_clone + * Method: COption_EventZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CVec_SpendableOutputDescriptorZ_free - * Signature: ([J)V + * Method: CResult_COption_EventZDecodeErrorZ_ok + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free - (JNIEnv *, jclass, jlongArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_EventZ_some - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: COption_EventZ_none - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: COption_EventZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: COption_EventZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: COption_EventZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_COption_EventZDecodeErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_COption_EventZDecodeErrorZ_err + * Method: CResult_COption_EventZDecodeErrorZ_err * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err @@ -6415,54 +6623,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecod JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free (JNIEnv *, jclass, jlongArray); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_err - * Signature: (Lorg/ldk/enums/AccessError;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err - (JNIEnv *, jclass, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_TxOutAccessErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: C2Tuple_usizeTransactionZ_clone_ptr @@ -6711,6 +6871,110 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1c JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_Z_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_Z_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_Z_new + * Signature: ([S[S)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new + (JNIEnv *, jclass, jshortArray, jshortArray); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_Z_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple__u168_u168Z_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple__u168_u168Z_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple__u168_u168Z_new + * Signature: ([S[S)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1new + (JNIEnv *, jclass, jshortArray, jshortArray); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple__u168_u168Z_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_C2Tuple_EightU16sEightU16sZZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_C2Tuple_EightU16sEightU16sZZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_C2Tuple_EightU16sEightU16sZZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_C2Tuple_EightU16sEightU16sZZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CVec_NodeIdZ_free @@ -6945,146 +7209,98 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecod /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_ok + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_err + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_is_ok + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_free + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_clone_ptr + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_OfferFeaturesDecodeErrorZ_clone + * Method: CResult_BlindedHopFeaturesDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OfferFeaturesDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_ok + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_err + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_free + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceRequestFeaturesDecodeErrorZ_clone + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFeaturesDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -7185,26 +7401,26 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpda /* * Class: org_ldk_impl_bindings - * Method: COption_AccessZ_some + * Method: COption_UtxoLookupZ_some * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_AccessZ_none + * Method: COption_UtxoLookupZ_none * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: COption_AccessZ_free + * Method: COption_UtxoLookupZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free (JNIEnv *, jclass, jlong); /* @@ -8025,195 +8241,67 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clon /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_SignatureSignatureZ_clone_ptr - * Signature: (J)J + * Method: CResult_PublicKeyNoneZ_ok + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_SignatureSignatureZ_clone - * Signature: (J)J + * Method: CResult_PublicKeyNoneZ_err + * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_SignatureSignatureZ_new - * Signature: ([B[B)J + * Method: CResult_PublicKeyNoneZ_is_ok + * Signature: (J)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new - (JNIEnv *, jclass, jbyteArray, jbyteArray); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_SignatureSignatureZ_free + * Method: CResult_PublicKeyNoneZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_ok + * Method: CResult_PublicKeyNoneZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_err - * Signature: ()J + * Method: CResult_PublicKeyNoneZ_clone + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok - * Signature: (J)Z + * Method: COption_ScalarZ_some + * Signature: (J)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1some (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_free - * Signature: (J)V + * Method: COption_ScalarZ_none + * Signature: ()J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_ok - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok - (JNIEnv *, jclass, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_err - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyNoneZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_ok - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok - (JNIEnv *, jclass, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_err - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyNoneZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: COption_ScalarZ_some - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1some - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: COption_ScalarZ_none - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings @@ -8273,106 +8361,106 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1c /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_ok - * Signature: (J)J + * Method: CVec_U5Z_free + * Signature: ([B)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_err - * Signature: (J)J + * Method: CResult_RecoverableSignatureNoneZ_ok + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_is_ok - * Signature: (J)Z + * Method: CResult_RecoverableSignatureNoneZ_err + * Signature: ()J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_free - * Signature: (J)V + * Method: CResult_RecoverableSignatureNoneZ_is_ok + * Signature: (J)Z */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_clone_ptr - * Signature: (J)J + * Method: CResult_RecoverableSignatureNoneZ_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_clone + * Method: CResult_RecoverableSignatureNoneZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CVec_U5Z_free - * Signature: ([B)V + * Method: CResult_RecoverableSignatureNoneZ_clone + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_ok - * Signature: ([B)J + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_err - * Signature: ()J + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_is_ok + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_free + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_clone_ptr + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_RecoverableSignatureNoneZ_clone + * Method: CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -8673,210 +8761,250 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_ok - * Signature: ()J + * Method: CResult__u832APIErrorZ_ok + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_err + * Method: CResult__u832APIErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_is_ok + * Method: CResult__u832APIErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_free + * Method: CResult__u832APIErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_clone_ptr + * Method: CResult__u832APIErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneAPIErrorZ_clone + * Method: CResult__u832APIErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CVec_CResult_NoneAPIErrorZZ_free + * Method: CVec_RecentPaymentDetailsZ_free * Signature: ([J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free (JNIEnv *, jclass, jlongArray); /* * Class: org_ldk_impl_bindings - * Method: CVec_APIErrorZ_free - * Signature: ([J)V + * Method: CResult_NonePaymentSendFailureZ_ok + * Signature: ()J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free - (JNIEnv *, jclass, jlongArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_ok - * Signature: ([B)J + * Method: CResult_NonePaymentSendFailureZ_err + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_err + * Method: CResult_NonePaymentSendFailureZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NonePaymentSendFailureZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NonePaymentSendFailureZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_is_ok + * Method: CResult_NonePaymentSendFailureZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneRetryableSendFailureZ_ok + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneRetryableSendFailureZ_err + * Signature: (Lorg/ldk/enums/RetryableSendFailure;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneRetryableSendFailureZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_free + * Method: CResult_NoneRetryableSendFailureZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_clone_ptr + * Method: CResult_NoneRetryableSendFailureZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult__u832APIErrorZ_clone + * Method: CResult_NoneRetryableSendFailureZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_ok - * Signature: ()J + * Method: CResult_PaymentHashPaymentSendFailureZ_ok + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_err + * Method: CResult_PaymentHashPaymentSendFailureZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_is_ok + * Method: CResult_PaymentHashPaymentSendFailureZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_free + * Method: CResult_PaymentHashPaymentSendFailureZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_clone_ptr + * Method: CResult_PaymentHashPaymentSendFailureZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_clone + * Method: CResult_PaymentHashPaymentSendFailureZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_ok + * Method: CResult_PaymentHashRetryableSendFailureZ_ok * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1ok (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_err - * Signature: (J)J + * Method: CResult_PaymentHashRetryableSendFailureZ_err + * Signature: (Lorg/ldk/enums/RetryableSendFailure;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1err + (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_is_ok + * Method: CResult_PaymentHashRetryableSendFailureZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_free + * Method: CResult_PaymentHashRetryableSendFailureZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_clone_ptr + * Method: CResult_PaymentHashRetryableSendFailureZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_clone + * Method: CResult_PaymentHashRetryableSendFailureZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone (JNIEnv *, jclass, jlong); /* @@ -9535,6 +9663,94 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeE JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: COption_APIErrorZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_APIErrorZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_APIErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_APIErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_APIErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_COption_APIErrorZDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_OutPointDecodeErrorZ_ok @@ -10479,6 +10695,46 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PublicKeyCOption_NetAddressZZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PublicKeyCOption_NetAddressZZ_new + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1new + (JNIEnv *, jclass, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PublicKeyCOption_NetAddressZZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1NetAddressZZZ_1free + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: CResult_CVec_u8ZPeerHandleErrorZ_ok @@ -10623,6 +10879,54 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxOutUtxoLookupErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxOutUtxoLookupErrorZ_err + * Signature: (Lorg/ldk/enums/UtxoLookupError;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxOutUtxoLookupErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxOutUtxoLookupErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxOutUtxoLookupErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxOutUtxoLookupErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_NoneSendErrorZ_ok @@ -13079,6 +13383,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1paym JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: PaymentPurpose_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: PaymentPurpose_write @@ -13095,6 +13407,70 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_initial_send + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_on_path + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PathFailure_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PathFailure_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: ClosureReason_free @@ -13362,10 +13738,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1success /* * Class: org_ldk_impl_bindings * Method: Event_payment_path_failed - * Signature: ([B[BZJZ[JJJ)J + * Signature: ([B[BZJ[JJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed - (JNIEnv *, jclass, jbyteArray, jbyteArray, jboolean, jlong, jboolean, jlongArray, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jboolean, jlong, jlongArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -13455,6 +13831,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed (JNIEnv *, jclass, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Event_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: Event_write @@ -13607,6 +13991,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: MessageSendEvent_broadcast_node_announcement + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: MessageSendEvent_send_channel_update @@ -13767,6 +14159,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutd JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: APIError_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_APIError_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: APIError_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: BigSize_free @@ -14825,10 +15233,10 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq /* * Class: org_ldk_impl_bindings - * Method: BestBlock_from_genesis + * Method: BestBlock_from_network * Signature: (Lorg/ldk/enums/Network;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network (JNIEnv *, jclass, jobject); /* @@ -14855,38 +15263,6 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_BestBlock_1height (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: AccessError_clone - * Signature: (J)Lorg/ldk/enums/AccessError; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_AccessError_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: AccessError_unknown_chain - * Signature: ()Lorg/ldk/enums/AccessError; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: AccessError_unknown_tx - * Signature: ()Lorg/ldk/enums/AccessError; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: Access_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: Listen_free @@ -15698,10 +16074,10 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1cla /* * Class: org_ldk_impl_bindings * Method: C2Tuple_BlockHashChannelMonitorZ_read - * Signature: ([BJ)J + * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read - (JNIEnv *, jclass, jbyteArray, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -16169,34 +16545,42 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1re /* * Class: org_ldk_impl_bindings - * Method: BaseSign_free + * Method: ChannelSigner_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Sign_clone_ptr + * Method: EcdsaChannelSigner_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: WriteableEcdsaChannelSigner_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Sign_clone + * Method: WriteableEcdsaChannelSigner_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Sign_free + * Method: WriteableEcdsaChannelSigner_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free (JNIEnv *, jclass, jlong); /* @@ -16225,10 +16609,26 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_free + * Method: EntropySource_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeSigner_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: SignerProvider_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free (JNIEnv *, jclass, jlong); /* @@ -16354,10 +16754,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone /* * Class: org_ldk_impl_bindings * Method: InMemorySigner_new - * Signature: ([B[B[B[B[B[B[BJ[B)J + * Signature: ([B[B[B[B[B[BJ[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new - (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jlong, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -16433,18 +16833,26 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic /* * Class: org_ldk_impl_bindings - * Method: InMemorySigner_as_BaseSign + * Method: InMemorySigner_as_ChannelSigner + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InMemorySigner_as_EcdsaChannelSigner * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemorySigner_as_Sign + * Method: InMemorySigner_as_WriteableEcdsaChannelSigner * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner (JNIEnv *, jclass, jlong); /* @@ -16458,10 +16866,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write /* * Class: org_ldk_impl_bindings * Method: InMemorySigner_read - * Signature: ([B[B)J + * Signature: ([B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read - (JNIEnv *, jclass, jbyteArray, jbyteArray); + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -16479,6 +16887,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new (JNIEnv *, jclass, jbyteArray, jlong, jint); +/* + * Class: org_ldk_impl_bindings + * Method: KeysManager_get_node_secret_key + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: KeysManager_derive_channel_keys @@ -16497,10 +16913,26 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable /* * Class: org_ldk_impl_bindings - * Method: KeysManager_as_KeysInterface + * Method: KeysManager_as_EntropySource + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: KeysManager_as_NodeSigner * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: KeysManager_as_SignerProvider + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider (JNIEnv *, jclass, jlong); /* @@ -16513,10 +16945,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free /* * Class: org_ldk_impl_bindings - * Method: PhantomKeysManager_as_KeysInterface + * Method: PhantomKeysManager_as_EntropySource + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_as_NodeSigner + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_as_SignerProvider * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider (JNIEnv *, jclass, jlong); /* @@ -16543,6 +16991,54 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1sp JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys (JNIEnv *, jclass, jlong, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_get_node_secret_key + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_get_phantom_node_secret_key + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FailureCode_clone + * Signature: (J)Lorg/ldk/enums/FailureCode; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FailureCode_temporary_node_failure + * Signature: ()Lorg/ldk/enums/FailureCode; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: FailureCode_required_node_feature_missing + * Signature: ()Lorg/ldk/enums/FailureCode; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: FailureCode_incorrect_or_unknown_payment_details + * Signature: ()Lorg/ldk/enums/FailureCode; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_free @@ -17257,67 +17753,51 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound /* * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_free + * Method: RecentPaymentDetails_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_clone + * Method: RecentPaymentDetails_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_parameter_error + * Method: RecentPaymentDetails_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_path_parameter_error - * Signature: ([J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error - (JNIEnv *, jclass, jlongArray); - -/* - * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_all_failed_resend_safe - * Signature: ([J)J + * Method: RecentPaymentDetails_pending + * Signature: ([BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe - (JNIEnv *, jclass, jlongArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_duplicate_payment - * Signature: ()J + * Method: RecentPaymentDetails_fulfilled + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: PaymentSendFailure_partial_failure - * Signature: ([JJ[B)J + * Method: RecentPaymentDetails_abandoned + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure - (JNIEnv *, jclass, jlongArray, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -17402,10 +17882,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone /* * Class: org_ldk_impl_bindings * Method: ChannelManager_new - * Signature: (JJJJJJJ)J + * Signature: (JJJJJJJJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -17439,6 +17919,14 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1ch JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_list_recent_payments + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_close_channel @@ -17497,11 +17985,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment /* * Class: org_ldk_impl_bindings - * Method: ChannelManager_retry_payment - * Signature: (JJ[B)J + * Method: ChannelManager_send_payment_with_retry + * Signature: (J[B[B[BJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment - (JNIEnv *, jclass, jlong, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1retry + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -17519,6 +18007,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, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_send_spontaneous_payment_with_retry + * Signature: (J[B[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_send_probe @@ -17583,6 +18079,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1o JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards (JNIEnv *, jclass, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_fail_htlc_backwards_with_reason + * Signature: (J[BLorg/ldk/enums/FailureCode;)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards_1with_1reason + (JNIEnv *, jclass, jlong, jbyteArray, jobject); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_claim_funds @@ -17618,10 +18122,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbou /* * Class: org_ldk_impl_bindings * Method: ChannelManager_create_inbound_payment - * Signature: (JJI)J + * Signature: (JJIJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment - (JNIEnv *, jclass, jlong, jlong, jint); + (JNIEnv *, jclass, jlong, jlong, jint, jlong); /* * Class: org_ldk_impl_bindings @@ -17634,10 +18138,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbou /* * Class: org_ldk_impl_bindings * Method: ChannelManager_create_inbound_payment_for_hash - * Signature: (J[BJI)J + * Signature: (J[BJIJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jint); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jint, jlong); /* * Class: org_ldk_impl_bindings @@ -17753,35 +18257,51 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best /* * Class: org_ldk_impl_bindings - * Method: ChannelManager_as_ChannelMessageHandler + * Method: ChannelManager_node_features * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: provided_node_features - * Signature: ()J + * Method: ChannelManager_channel_features + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_provided_1node_1features - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: provided_channel_features - * Signature: ()J + * Method: ChannelManager_channel_type_features + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_provided_1channel_1features - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_init_features + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_as_ChannelMessageHandler + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings * Method: provided_init_features - * Signature: ()J + * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_provided_1init_1features - (JNIEnv *, jclass); + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -17865,18 +18385,50 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free /* * Class: org_ldk_impl_bindings - * Method: ChannelManagerReadArgs_get_keys_manager + * Method: ChannelManagerReadArgs_get_entropy_source + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManagerReadArgs_set_entropy_source + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManagerReadArgs_get_node_signer + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManagerReadArgs_set_node_signer + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManagerReadArgs_get_signer_provider * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelManagerReadArgs_set_keys_manager + * Method: ChannelManagerReadArgs_set_signer_provider * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider (JNIEnv *, jclass, jlong, jlong); /* @@ -17927,6 +18479,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManagerReadArgs_get_router + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManagerReadArgs_set_router + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManagerReadArgs_get_logger @@ -17962,10 +18530,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1d /* * Class: org_ldk_impl_bindings * Method: ChannelManagerReadArgs_new - * Signature: (JJJJJJ[J)J + * Signature: (JJJJJJJJJ[J)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlongArray); + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlongArray); /* * Class: org_ldk_impl_bindings @@ -17994,18 +18562,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new /* * Class: org_ldk_impl_bindings * Method: create - * Signature: (JJIJJ)J + * Signature: (JJIJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create - (JNIEnv *, jclass, jlong, jlong, jint, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jint, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: create_from_hash - * Signature: (JJ[BIJ)J + * Signature: (JJ[BIJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1from_1hash - (JNIEnv *, jclass, jlong, jlong, jbyteArray, jint, jlong); + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jint, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -20540,8 +21108,64 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write * Method: NetAddress_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_channel_announcement + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_channel_update + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_node_announcement + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UnsignedGossipMessage_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -20586,18 +21210,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_ /* * Class: org_ldk_impl_bindings * Method: UnsignedNodeAnnouncement_get_node_id - * Signature: (J)[B + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedNodeAnnouncement_set_node_id - * Signature: (J[B)V + * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -20802,66 +21426,66 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1s /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_get_node_id_1 - * Signature: (J)[B + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11 +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11 (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_set_node_id_1 - * Signature: (J[B)V + * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11 - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_get_node_id_2 - * Signature: (J)[B + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12 +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12 (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_set_node_id_2 - * Signature: (J[B)V + * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12 - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_get_bitcoin_key_1 - * Signature: (J)[B + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11 +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11 (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_set_bitcoin_key_1 - * Signature: (J[B)V + * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11 - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_get_bitcoin_key_2 - * Signature: (J)[B + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12 +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12 (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings * Method: UnsignedChannelAnnouncement_set_bitcoin_key_2 - * Signature: (J[B)V + * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12 - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -22775,29 +23399,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: PeerHandleError_get_no_connection_possible - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: PeerHandleError_set_no_connection_possible - * Signature: (JZ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible - (JNIEnv *, jclass, jlong, jboolean); - /* * Class: org_ldk_impl_bindings * Method: PeerHandleError_new - * Signature: (Z)J + * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new - (JNIEnv *, jclass, jboolean); + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings @@ -22826,17 +23434,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free /* * Class: org_ldk_impl_bindings * Method: PeerManager_new - * Signature: (J[BI[BJJ)J + * Signature: (JI[BJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new - (JNIEnv *, jclass, jlong, jbyteArray, jint, jbyteArray, jlong, jlong); + (JNIEnv *, jclass, jlong, jint, jbyteArray, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: PeerManager_get_peer_node_ids - * Signature: (J)[[B + * Signature: (J)[J */ -JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids (JNIEnv *, jclass, jlong); /* @@ -22890,10 +23498,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnec /* * Class: org_ldk_impl_bindings * Method: PeerManager_disconnect_by_node_id - * Signature: (J[BZ)V + * Signature: (J[B)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id - (JNIEnv *, jclass, jlong, jbyteArray, jboolean); + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -24423,6 +25031,22 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: BlindedHopFeatures_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelTypeFeatures_eq @@ -24527,6 +25151,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: BlindedHopFeatures_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: BlindedHopFeatures_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelTypeFeatures_clone_ptr @@ -24591,6 +25247,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: BlindedHopFeatures_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelTypeFeatures_free @@ -24695,6 +25367,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_empty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_requires_unknown_bits + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: BlindedHopFeatures_empty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: BlindedHopFeatures_requires_unknown_bits + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelTypeFeatures_empty @@ -24777,50 +25481,34 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read /* * Class: org_ldk_impl_bindings - * Method: ChannelTypeFeatures_write - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelTypeFeatures_read - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read - (JNIEnv *, jclass, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: OfferFeatures_write + * Method: BlindedHopFeatures_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: OfferFeatures_read + * Method: BlindedHopFeatures_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InvoiceRequestFeatures_write + * Method: ChannelTypeFeatures_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InvoiceRequestFeatures_read + * Method: ChannelTypeFeatures_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read (JNIEnv *, jclass, jbyteArray); /* @@ -25399,6 +26087,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1m JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_set_basic_mpp_optional + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_set_basic_mpp_required + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_supports_basic_mpp + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: InitFeatures_requires_basic_mpp @@ -25412,79 +26124,183 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1ba * Method: NodeFeatures_requires_basic_mpp * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InvoiceFeatures_requires_basic_mpp + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12InvoiceFeatures_requires_basic_mpp + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InitFeatures_set_wumbo_optional + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InitFeatures_set_wumbo_required + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InitFeatures_supports_wumbo + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeFeatures_set_wumbo_optional + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeFeatures_set_wumbo_required + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeFeatures_supports_wumbo + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InitFeatures_requires_wumbo + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeFeatures_requires_wumbo + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InitFeatures_set_anchors_zero_fee_htlc_tx_optional + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InitFeatures_set_anchors_zero_fee_htlc_tx_required + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InvoiceFeatures_requires_basic_mpp + * Method: InitFeatures_supports_anchors_zero_fee_htlc_tx * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InitFeatures_set_wumbo_optional + * Method: NodeFeatures_set_anchors_zero_fee_htlc_tx_optional * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InitFeatures_set_wumbo_required + * Method: NodeFeatures_set_anchors_zero_fee_htlc_tx_required * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InitFeatures_supports_wumbo + * Method: NodeFeatures_supports_anchors_zero_fee_htlc_tx * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeFeatures_set_wumbo_optional + * Method: ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeFeatures_set_wumbo_required + * Method: ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeFeatures_supports_wumbo + * Method: ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InitFeatures_requires_wumbo + * Method: InitFeatures_requires_anchors_zero_fee_htlc_tx * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeFeatures_requires_wumbo + * Method: NodeFeatures_requires_anchors_zero_fee_htlc_tx * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx (JNIEnv *, jclass, jlong); /* @@ -26017,67 +26833,339 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh /* * Class: org_ldk_impl_bindings - * Method: ShutdownScript_new_witness_program - * Signature: (B[B)J + * Method: ShutdownScript_new_witness_program + * Signature: (B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program + (JNIEnv *, jclass, jbyte, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: ShutdownScript_into_inner + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ShutdownScript_as_legacy_pubkey + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ShutdownScript_is_compatible + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_attempts + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1attempts + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_timeout + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1timeout + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Retry_hash + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1hash + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: RetryableSendFailure_clone + * Signature: (J)Lorg/ldk/enums/RetryableSendFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: RetryableSendFailure_payment_expired + * Signature: ()Lorg/ldk/enums/RetryableSendFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: RetryableSendFailure_route_not_found + * Signature: ()Lorg/ldk/enums/RetryableSendFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: RetryableSendFailure_duplicate_payment + * Signature: ()Lorg/ldk/enums/RetryableSendFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_parameter_error + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_path_parameter_error + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_all_failed_resend_safe + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_duplicate_payment + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentSendFailure_partial_failure + * Signature: ([JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure + (JNIEnv *, jclass, jlongArray, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CustomMessageReader_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Type_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Type_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Type_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Type_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoLookupError_clone + * Signature: (J)Lorg/ldk/enums/UtxoLookupError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoLookupError_unknown_chain + * Signature: ()Lorg/ldk/enums/UtxoLookupError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoLookupError_unknown_tx + * Signature: ()Lorg/ldk/enums/UtxoLookupError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoResult_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoResult_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoResult_clone + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program - (JNIEnv *, jclass, jbyte, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ShutdownScript_into_inner - * Signature: (J)[B + * Method: UtxoResult_sync + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ShutdownScript_as_legacy_pubkey - * Signature: (J)[B + * Method: UtxoResult_async + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ShutdownScript_is_compatible - * Signature: (JJ)Z + * Method: UtxoLookup_free + * Signature: (J)V */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CustomMessageReader_free + * Method: UtxoFuture_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Type_clone_ptr + * Method: UtxoFuture_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Type_clone + * Method: UtxoFuture_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Type_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Type_free - * Signature: (J)V + * Method: UtxoFuture_new + * Signature: ()J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoFuture_resolve_without_forwarding + * Signature: (JJJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve_1without_1forwarding + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UtxoFuture_resolve + * Signature: (JJJJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -26249,10 +27337,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new /* * Class: org_ldk_impl_bindings - * Method: P2PGossipSync_add_chain_access + * Method: P2PGossipSync_add_utxo_lookup * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup (JNIEnv *, jclass, jlong, jlong); /* @@ -27079,22 +28167,6 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels (JNIEnv *, jclass, jlong, jlongArray); -/* - * Class: org_ldk_impl_bindings - * Method: NodeInfo_get_lowest_inbound_channel_fees - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: NodeInfo_set_lowest_inbound_channel_fees - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees - (JNIEnv *, jclass, jlong, jlong); - /* * Class: org_ldk_impl_bindings * Method: NodeInfo_get_announcement_info @@ -27114,10 +28186,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1i /* * Class: org_ldk_impl_bindings * Method: NodeInfo_new - * Signature: ([JJJ)J + * Signature: ([JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new - (JNIEnv *, jclass, jlongArray, jlong, jlong); + (JNIEnv *, jclass, jlongArray, jlong); /* * Class: org_ldk_impl_bindings @@ -27178,10 +28250,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read /* * Class: org_ldk_impl_bindings * Method: NetworkGraph_new - * Signature: ([BJ)J + * Signature: (Lorg/ldk/enums/Network;J)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new - (JNIEnv *, jclass, jbyteArray, jlong); + (JNIEnv *, jclass, jobject, jlong); /* * Class: org_ldk_impl_bindings @@ -27767,29 +28839,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat (JNIEnv *, jclass, jlong, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: RouteParameters_get_final_cltv_expiry_delta - * Signature: (J)I - */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: RouteParameters_set_final_cltv_expiry_delta - * Signature: (JI)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta - (JNIEnv *, jclass, jlong, jint); - /* * Class: org_ldk_impl_bindings * Method: RouteParameters_new - * Signature: (JJI)J + * Signature: (JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new - (JNIEnv *, jclass, jlong, jlong, jint); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -27807,6 +28863,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: RouteParameters_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: RouteParameters_write @@ -27959,13 +29023,29 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels (JNIEnv *, jclass, jlong, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_get_final_cltv_expiry_delta + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1final_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_set_final_cltv_expiry_delta + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1final_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong, jint); + /* * Class: org_ldk_impl_bindings * Method: PaymentParameters_new - * Signature: ([BJ[JJIBB[J)J + * Signature: ([BJ[JJIBB[JI)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlongArray, jlong, jint, jbyte, jbyte, jlongArray); + (JNIEnv *, jclass, jbyteArray, jlong, jlongArray, jlong, jint, jbyte, jbyte, jlongArray, jint); /* * Class: org_ldk_impl_bindings @@ -28010,26 +29090,26 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write /* * Class: org_ldk_impl_bindings * Method: PaymentParameters_read - * Signature: ([B)J + * Signature: ([BI)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read - (JNIEnv *, jclass, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jint); /* * Class: org_ldk_impl_bindings * Method: PaymentParameters_from_node_id - * Signature: ([B)J + * Signature: ([BI)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id - (JNIEnv *, jclass, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jint); /* * Class: org_ldk_impl_bindings * Method: PaymentParameters_for_keysend - * Signature: ([B)J + * Signature: ([BI)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend - (JNIEnv *, jclass, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jint); /* * Class: org_ldk_impl_bindings @@ -28727,6 +29807,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1lo JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estimated_1channel_1liquidity_1range (JNIEnv *, jclass, jlong, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1channel_1liquidity_1probabilities + (JNIEnv *, jclass, jlong, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScorer_add_banned @@ -29050,10 +30138,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1fre /* * Class: org_ldk_impl_bindings * Method: OnionMessenger_new - * Signature: (JJJ)J + * Signature: (JJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new - (JNIEnv *, jclass, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -29162,10 +30250,10 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1d /* * Class: org_ldk_impl_bindings * Method: FilesystemPersister_read_channelmonitors - * Signature: (JJ)J + * Signature: (JJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -30001,66 +31089,66 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_free + * Method: MinFinalCltvExpiryDelta_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_get_a + * Method: MinFinalCltvExpiryDelta_get_a * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_set_a + * Method: MinFinalCltvExpiryDelta_set_a * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_new + * Method: MinFinalCltvExpiryDelta_new * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_clone_ptr + * Method: MinFinalCltvExpiryDelta_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_clone + * Method: MinFinalCltvExpiryDelta_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_hash + * Method: MinFinalCltvExpiryDelta_hash * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: MinFinalCltvExpiry_eq + * Method: MinFinalCltvExpiryDelta_eq * Signature: (JJ)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq (JNIEnv *, jclass, jlong, jlong); /* @@ -30305,10 +31393,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time /* * Class: org_ldk_impl_bindings - * Method: RawInvoice_min_final_cltv_expiry + * Method: RawInvoice_min_final_cltv_expiry_delta * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong); /* @@ -30505,10 +31593,10 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire /* * Class: org_ldk_impl_bindings - * Method: Invoice_min_final_cltv_expiry + * Method: Invoice_min_final_cltv_expiry_delta * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong); /* @@ -30655,6 +31743,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amo JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: CreationError_min_final_cltv_expiry_delta_too_short + * Signature: ()Lorg/ldk/enums/CreationError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: CreationError_eq @@ -30833,75 +31929,35 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1st /* * Class: org_ldk_impl_bindings - * Method: InvoicePayer_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Payer_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Retry_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Retry_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Retry_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: Retry_attempts - * Signature: (J)J + * Method: pay_invoice + * Signature: (JJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1attempts - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_pay_1invoice + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Retry_timeout - * Signature: (J)J + * Method: pay_invoice_with_id + * Signature: (J[BJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1timeout - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Retry_eq - * Signature: (JJ)Z + * Method: pay_zero_value_invoice + * Signature: (JJJJ)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Retry_hash - * Signature: (J)J + * Method: pay_zero_value_invoice_with_id + * Signature: (JJ[BJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Retry_1hash - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -30935,157 +31991,69 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice (JNIEnv *, jclass, jstring); -/* - * Class: org_ldk_impl_bindings - * Method: PaymentError_routing - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: PaymentError_sending - * Signature: (J)J + * Signature: (Lorg/ldk/enums/RetryableSendFailure;)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_new - * Signature: (JJJJJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_pay_invoice - * Signature: (JJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_pay_invoice_with_id - * Signature: (JJ[B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice_1with_1id - (JNIEnv *, jclass, jlong, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_pay_zero_value_invoice - * Signature: (JJJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice - (JNIEnv *, jclass, jlong, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_pay_zero_value_invoice_with_id - * Signature: (JJJ[B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice_1with_1id - (JNIEnv *, jclass, jlong, jlong, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_pay_pubkey - * Signature: (J[B[BJI)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey - (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong, jint); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_pay_pubkey_with_id - * Signature: (J[B[B[BJI)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey_1with_1id - (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jbyteArray, jlong, jint); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_remove_cached_payment - * Signature: (J[B)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment - (JNIEnv *, jclass, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: InvoicePayer_as_EventHandler - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings * Method: create_phantom_invoice - * Signature: (J[BLjava/lang/String;I[JJJLorg/ldk/enums/Currency;)J + * Signature: (J[BLjava/lang/String;I[JJJJLorg/ldk/enums/Currency;JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice - (JNIEnv *, jclass, jlong, jbyteArray, jstring, jint, jlongArray, jlong, jlong, jobject); + (JNIEnv *, jclass, jlong, jbyteArray, jstring, jint, jlongArray, jlong, jlong, jlong, jobject, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: create_phantom_invoice_with_description_hash - * Signature: (J[BIJ[JJJLorg/ldk/enums/Currency;)J + * Signature: (J[BIJ[JJJJLorg/ldk/enums/Currency;JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash - (JNIEnv *, jclass, jlong, jbyteArray, jint, jlong, jlongArray, jlong, jlong, jobject); + (JNIEnv *, jclass, jlong, jbyteArray, jint, jlong, jlongArray, jlong, jlong, jlong, jobject, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager - * Signature: (JJJLorg/ldk/enums/Currency;JLjava/lang/String;I)J + * Signature: (JJJLorg/ldk/enums/Currency;JLjava/lang/String;IJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager - (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jstring, jint); + (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jstring, jint, jlong); /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager_with_description_hash - * Signature: (JJJLorg/ldk/enums/Currency;JJI)J + * Signature: (JJJLorg/ldk/enums/Currency;JJIJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash - (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jlong, jint); + (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jlong, jint, jlong); /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch - * Signature: (JJJLorg/ldk/enums/Currency;JJJI)J + * Signature: (JJJLorg/ldk/enums/Currency;JJJIJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch - (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jlong, jlong, jint); + (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jlong, jlong, jint, jlong); /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager_and_duration_since_epoch - * Signature: (JJJLorg/ldk/enums/Currency;JLjava/lang/String;JI)J + * Signature: (JJJLorg/ldk/enums/Currency;JLjava/lang/String;JIJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch - (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jstring, jlong, jint); + (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jstring, jlong, jint, jlong); /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash - * Signature: (JJJLorg/ldk/enums/Currency;JLjava/lang/String;JI[B)J + * Signature: (JJJLorg/ldk/enums/Currency;JLjava/lang/String;JI[BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash - (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jstring, jlong, jint, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelManager_as_Payer - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong, jobject, jlong, jstring, jlong, jint, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -31170,10 +32138,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free /* * Class: org_ldk_impl_bindings * Method: RapidGossipSync_new - * Signature: (J)J + * Signature: (JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -31183,6 +32151,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph (JNIEnv *, jclass, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: RapidGossipSync_update_network_graph_no_std + * Signature: (J[BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph_1no_1std + (JNIEnv *, jclass, jlong, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: RapidGossipSync_is_initial_sync_complete diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_APIErrorZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_APIErrorZ.h new file mode 100644 index 00000000..27a77828 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_APIErrorZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_APIErrorZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_APIErrorZ +#define _Included_org_ldk_impl_bindings_LDKCOption_APIErrorZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_APIErrorZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_AccessZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_AccessZ.h deleted file mode 100644 index ddc64e37..00000000 --- a/src/main/jni/org_ldk_impl_bindings_LDKCOption_AccessZ.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_ldk_impl_bindings_LDKCOption_AccessZ */ - -#ifndef _Included_org_ldk_impl_bindings_LDKCOption_AccessZ -#define _Included_org_ldk_impl_bindings_LDKCOption_AccessZ -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_ldk_impl_bindings_LDKCOption_AccessZ - * Method: init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ.h new file mode 100644 index 00000000..87ed0a55 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ +#define _Included_org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_C2Tuple_EightU16sEightU16sZZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_PathFailureZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_PathFailureZ.h new file mode 100644 index 00000000..7be55c4e --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_PathFailureZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_PathFailureZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_PathFailureZ +#define _Included_org_ldk_impl_bindings_LDKCOption_PathFailureZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_PathFailureZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_UtxoLookupZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_UtxoLookupZ.h new file mode 100644 index 00000000..a20b439e --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_UtxoLookupZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_UtxoLookupZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_UtxoLookupZ +#define _Included_org_ldk_impl_bindings_LDKCOption_UtxoLookupZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_UtxoLookupZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKPathFailure.h b/src/main/jni/org_ldk_impl_bindings_LDKPathFailure.h new file mode 100644 index 00000000..b994e514 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKPathFailure.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKPathFailure */ + +#ifndef _Included_org_ldk_impl_bindings_LDKPathFailure +#define _Included_org_ldk_impl_bindings_LDKPathFailure +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKPathFailure + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKRecentPaymentDetails.h b/src/main/jni/org_ldk_impl_bindings_LDKRecentPaymentDetails.h new file mode 100644 index 00000000..c4ad7fc4 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKRecentPaymentDetails.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKRecentPaymentDetails */ + +#ifndef _Included_org_ldk_impl_bindings_LDKRecentPaymentDetails +#define _Included_org_ldk_impl_bindings_LDKRecentPaymentDetails +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKRecentPaymentDetails + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKUnsignedGossipMessage.h b/src/main/jni/org_ldk_impl_bindings_LDKUnsignedGossipMessage.h new file mode 100644 index 00000000..b345a6fa --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKUnsignedGossipMessage.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKUnsignedGossipMessage */ + +#ifndef _Included_org_ldk_impl_bindings_LDKUnsignedGossipMessage +#define _Included_org_ldk_impl_bindings_LDKUnsignedGossipMessage +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKUnsignedGossipMessage + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKUtxoResult.h b/src/main/jni/org_ldk_impl_bindings_LDKUtxoResult.h new file mode 100644 index 00000000..324bf986 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKUtxoResult.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKUtxoResult */ + +#ifndef _Included_org_ldk_impl_bindings_LDKUtxoResult +#define _Included_org_ldk_impl_bindings_LDKUtxoResult +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKUtxoResult + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif