From: Matt Corallo Date: Thu, 3 Mar 2022 02:40:37 +0000 (+0000) Subject: [Java] Update auto-generated bindings to 0.0.105.0 X-Git-Tag: v0.0.105.0~1^2~5 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=6fe917116a65d7b62123226c4240d77ea2719783;p=ldk-java [Java] Update auto-generated bindings to 0.0.105.0 --- diff --git a/src/main/java/org/ldk/enums/CreationError.java b/src/main/java/org/ldk/enums/CreationError.java index 97b8d941..958959cc 100644 --- a/src/main/java/org/ldk/enums/CreationError.java +++ b/src/main/java/org/ldk/enums/CreationError.java @@ -13,17 +13,20 @@ public enum CreationError { */ LDKCreationError_RouteTooLong, /** - * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime` + * The Unix timestamp of the supplied date is less than zero or greater than 35-bits */ LDKCreationError_TimestampOutOfBounds, - /** - * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp` - */ - LDKCreationError_ExpiryTimeOutOfBounds, /** * The supplied millisatoshi amount was greater than the total bitcoin supply. */ LDKCreationError_InvalidAmount, + /** + * Route hints were required for this invoice and were missing. Applies to + * [phantom invoices]. + * + * [phantom invoices]: crate::utils::create_phantom_invoice + */ + LDKCreationError_MissingRouteHints, ; 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 49197d37..20b87328 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -75,6 +75,7 @@ public class bindings { 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 { Secp256k1Error.values(); /* Force enum statics to run */ } static { SemanticError.values(); /* Force enum statics to run */ } static { SiPrefix.values(); /* Force enum statics to run */ } @@ -82,6 +83,14 @@ 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); + // void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner); + public static native void CResult_NoneNoneZ_get_ok(long owner); + // void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner); + public static native void CResult_NoneNoneZ_get_err(long owner); + // struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(long owner); // struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner); public static native byte[] CResult_SecretKeyErrorZ_get_ok(long owner); // enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner); @@ -188,10 +197,10 @@ public class bindings { } static { LDKCOption_u64Z.init(); } public static native LDKCOption_u64Z LDKCOption_u64Z_ref_from_ptr(long ptr); - // struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_PayeeDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_PayeeDecodeErrorZ_get_err(long owner); + // struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_PaymentParametersDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_PaymentParametersDecodeErrorZ_get_err(long owner); // struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_RouteHintDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner); @@ -436,6 +445,13 @@ public class bindings { public long[] path; PaymentPathSuccessful(byte[] payment_id, byte[] payment_hash, long[] path) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.path = path; } } + public final static class OpenChannelRequest extends LDKEvent { + public byte[] temporary_channel_id; + public byte[] counterparty_node_id; + public long funding_satoshis; + public long push_msat; + OpenChannelRequest(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat) { this.temporary_channel_id = temporary_channel_id; this.counterparty_node_id = counterparty_node_id; this.funding_satoshis = funding_satoshis; this.push_msat = push_msat; } + } static native void init(); } static { LDKEvent.init(); } @@ -477,6 +493,11 @@ public class bindings { public long msg; SendErrorMessage(long msg) { this.msg = msg; } } + public final static class SendWarningMessage extends LDKErrorAction { + public long msg; + public Level log_level; + SendWarningMessage(long msg, Level log_level) { this.msg = msg; this.log_level = log_level; } + } static native void init(); } static { LDKErrorAction.init(); } @@ -580,7 +601,11 @@ public class bindings { } static { LDKMessageSendEvent.init(); } public static native LDKMessageSendEvent LDKMessageSendEvent_ref_from_ptr(long ptr); - // struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner); + // struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_FixedPenaltyScorerDecodeErrorZ_get_err(long owner); + // struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScoringParametersDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScoringParametersDecodeErrorZ_get_err(long owner); @@ -588,6 +613,10 @@ public class bindings { public static native long CResult_ScorerDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScorerDecodeErrorZ_get_err(long owner); + // struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(long owner); // struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_InitFeaturesDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner); @@ -620,10 +649,6 @@ public class bindings { public static native long CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(long owner); - // void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner); - public static native void CResult_NoneNoneZ_get_ok(long owner); - // void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner); - public static native void CResult_NoneNoneZ_get_err(long owner); // struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner); public static native byte[] C2Tuple_SignatureCVec_SignatureZZ_get_a(long owner); // struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner); @@ -636,12 +661,24 @@ 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); public interface LDKBaseSign { byte[] get_per_commitment_point(long idx); byte[] release_commitment_secret(long idx); - long validate_holder_commitment(long holder_tx); + long validate_holder_commitment(long holder_tx, byte[][] preimages); byte[] channel_keys_id(); - long sign_counterparty_commitment(long commitment_tx); + 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); long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key); @@ -656,12 +693,12 @@ public class bindings { 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 - public static native long BaseSign_validate_holder_commitment(long this_arg, long holder_tx); + // 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 - public static native long BaseSign_sign_counterparty_commitment(long this_arg, long commitment_tx); + // 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 @@ -674,7 +711,7 @@ public class bindings { 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_channel_announcement LDKBaseSign *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg + // 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_ready_channel LDKBaseSign *NONNULL_PTR this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters public static native void BaseSign_ready_channel(long this_arg, long channel_parameters); @@ -857,6 +894,22 @@ public class bindings { public static native byte[] CResult_PaymentPreimageAPIErrorZ_get_ok(long owner); // struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner); public static native long CResult_PaymentPreimageAPIErrorZ_get_err(long owner); + // struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(long owner); + // struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelCounterpartyDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelCounterpartyDecodeErrorZ_get_err(long owner); + // struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelDetailsDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelDetailsDecodeErrorZ_get_err(long owner); + // struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_PhantomRouteHintsDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_PhantomRouteHintsDecodeErrorZ_get_err(long owner); public interface LDKWatch { long watch_channel(long funding_txo, long monitor); long update_channel(long funding_txo, long update); @@ -876,18 +929,18 @@ public class bindings { // 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 { - byte[] get_node_secret(); + long get_node_secret(Recipient recipient); byte[] get_destination_script(); long get_shutdown_scriptpubkey(); long get_channel_signer(boolean inbound, long channel_value_satoshis); byte[] get_secure_random_bytes(); long read_chan_signer(byte[] reader); - long sign_invoice(byte[] invoice_preimage); + long sign_invoice(byte[] hrp_bytes, byte[] invoice_data, Recipient receipient); byte[] get_inbound_payment_key_material(); } public static native long LDKKeysInterface_new(LDKKeysInterface impl); - // LDKSecretKey KeysInterface_get_node_secret LDKKeysInterface *NONNULL_PTR this_arg - public static native byte[] KeysInterface_get_node_secret(long this_arg); + // 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); // 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 @@ -898,8 +951,8 @@ public class bindings { 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 LDKCVec_u8Z invoice_preimage - public static native long KeysInterface_sign_invoice(long this_arg, byte[] invoice_preimage); + // 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 interface LDKFeeEstimator { @@ -1017,10 +1070,6 @@ public class bindings { public static native long CResult_DescriptionCreationErrorZ_get_ok(long owner); // enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner); public static native CreationError CResult_DescriptionCreationErrorZ_get_err(long owner); - // struct LDKExpiryTime CResult_ExpiryTimeCreationErrorZ_get_ok(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner); - public static native long CResult_ExpiryTimeCreationErrorZ_get_ok(long owner); - // enum LDKCreationError CResult_ExpiryTimeCreationErrorZ_get_err(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner); - public static native CreationError CResult_ExpiryTimeCreationErrorZ_get_err(long owner); // struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner); public static native long CResult_PrivateRouteCreationErrorZ_get_ok(long owner); // enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner); @@ -1160,10 +1209,10 @@ public class bindings { } static { LDKCOption_AccessZ.init(); } public static native LDKCOption_AccessZ LDKCOption_AccessZ_ref_from_ptr(long ptr); - // struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_DirectionalChannelInfoDecodeErrorZ_get_err(long owner); + // struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelUpdateInfoDecodeErrorZ_get_err(long owner); // struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ChannelInfoDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner); @@ -1301,6 +1350,10 @@ public class bindings { public static native long CResult_ErrorMessageDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ErrorMessageDecodeErrorZ_get_err(long owner); + // struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_WarningMessageDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_WarningMessageDecodeErrorZ_get_err(long owner); // struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner); @@ -1550,15 +1603,39 @@ public class bindings { public static native void SocketDescriptor_disconnect_socket(long this_arg); // uint64_t SocketDescriptor_hash LDKSocketDescriptor *NONNULL_PTR this_arg public static native long SocketDescriptor_hash(long this_arg); + public static class LDKEffectiveCapacity { + private LDKEffectiveCapacity() {} + public final static class ExactLiquidity extends LDKEffectiveCapacity { + public long liquidity_msat; + ExactLiquidity(long liquidity_msat) { this.liquidity_msat = liquidity_msat; } + } + public final static class MaximumHTLC extends LDKEffectiveCapacity { + public long amount_msat; + MaximumHTLC(long amount_msat) { this.amount_msat = amount_msat; } + } + public final static class Total extends LDKEffectiveCapacity { + public long capacity_msat; + Total(long capacity_msat) { this.capacity_msat = capacity_msat; } + } + public final static class Infinite extends LDKEffectiveCapacity { + Infinite() { } + } + public final static class Unknown extends LDKEffectiveCapacity { + Unknown() { } + } + static native void init(); + } + static { LDKEffectiveCapacity.init(); } + public static native LDKEffectiveCapacity LDKEffectiveCapacity_ref_from_ptr(long ptr); public interface LDKScore { - long channel_penalty_msat(long short_channel_id, long send_amt_msat, long channel_capacity_msat, long source, long target); + long channel_penalty_msat(long short_channel_id, long send_amt_msat, long capacity_msat, long source, long target); void payment_path_failed(long[] path, long short_channel_id); void payment_path_successful(long[] path); byte[] write(); } public static native long LDKScore_new(LDKScore impl); - // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target - public static native long Score_channel_penalty_msat(long this_arg, long short_channel_id, long send_amt_msat, long channel_capacity_msat, long source, long target); + // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target + public static native long Score_channel_penalty_msat(long this_arg, long short_channel_id, long send_amt_msat, long capacity_msat, long source, long target); // void Score_payment_path_failed LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id public static native void Score_payment_path_failed(long this_arg, long[] path, long short_channel_id); // void Score_payment_path_successful LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path @@ -1618,11 +1695,11 @@ public class bindings { // 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); public interface LDKRouter { - long find_route(byte[] payer, long params, byte[] payment_hash, long[] first_hops, long scorer); + long find_route(byte[] payer, long route_params, byte[] payment_hash, long[] first_hops, long scorer); } 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 params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer - public static native long Router_find_route(long this_arg, byte[] payer, long params, byte[] payment_hash, long[] first_hops, long scorer); + // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer + public static native long Router_find_route(long this_arg, byte[] payer, long route_params, byte[] payment_hash, long[] first_hops, long scorer); // struct LDKStr _ldk_get_compiled_version(void); public static native String _ldk_get_compiled_version(); // struct LDKStr _ldk_c_bindings_get_compiled_version(void); @@ -1639,6 +1716,30 @@ 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_NoneNoneZ CResult_NoneNoneZ_ok(void); + public static native long CResult_NoneNoneZ_ok(); + // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); + public static native long CResult_NoneNoneZ_err(); + // bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); + public static native boolean CResult_NoneNoneZ_is_ok(long o); + // void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); + public static native void CResult_NoneNoneZ_free(long _res); + // uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg); + public static native long CResult_NoneNoneZ_clone_ptr(long arg); + // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); + public static native long CResult_NoneNoneZ_clone(long orig); + // struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); + public static native long CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(long o); + // struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(long e); + // bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(long o); + // void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); + public static native void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(long _res); + // uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(long orig); // struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); public static native long CResult_SecretKeyErrorZ_ok(byte[] o); // struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); @@ -1647,6 +1748,10 @@ public class bindings { public static native boolean CResult_SecretKeyErrorZ_is_ok(long o); // void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); public static native void CResult_SecretKeyErrorZ_free(long _res); + // uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg); + public static native long CResult_SecretKeyErrorZ_clone_ptr(long arg); + // struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig); + public static native long CResult_SecretKeyErrorZ_clone(long orig); // struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); public static native long CResult_PublicKeyErrorZ_ok(byte[] o); // struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); @@ -1901,18 +2006,18 @@ public class bindings { public static native long COption_u64Z_clone_ptr(long arg); // struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); public static native long COption_u64Z_clone(long orig); - // struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o); - public static native long CResult_PayeeDecodeErrorZ_ok(long o); - // struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_PayeeDecodeErrorZ_err(long e); - // bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_PayeeDecodeErrorZ_is_ok(long o); - // void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res); - public static native void CResult_PayeeDecodeErrorZ_free(long _res); - // uintptr_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_PayeeDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_PayeeDecodeErrorZ_clone(long orig); + // struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); + public static native long CResult_PaymentParametersDecodeErrorZ_ok(long o); + // struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_PaymentParametersDecodeErrorZ_err(long e); + // bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_PaymentParametersDecodeErrorZ_is_ok(long o); + // void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); + public static native void CResult_PaymentParametersDecodeErrorZ_free(long _res); + // uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_PaymentParametersDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_PaymentParametersDecodeErrorZ_clone(long orig); // void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); public static native void CVec_RouteHintHopZ_free(long[] _res); // struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); @@ -2059,6 +2164,18 @@ 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_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); + public static native long CResult_FixedPenaltyScorerDecodeErrorZ_ok(long o); + // struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_FixedPenaltyScorerDecodeErrorZ_err(long e); + // bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(long o); + // void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); + public static native void CResult_FixedPenaltyScorerDecodeErrorZ_free(long _res); + // uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_FixedPenaltyScorerDecodeErrorZ_clone(long orig); // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); public static native long CResult_ScoringParametersDecodeErrorZ_ok(long o); // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); @@ -2067,6 +2184,10 @@ public class bindings { public static native boolean CResult_ScoringParametersDecodeErrorZ_is_ok(long o); // void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); public static native void CResult_ScoringParametersDecodeErrorZ_free(long _res); + // uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_ScoringParametersDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ScoringParametersDecodeErrorZ_clone(long orig); // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); public static native long CResult_ScorerDecodeErrorZ_ok(long o); // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); @@ -2075,6 +2196,18 @@ public class bindings { public static native boolean CResult_ScorerDecodeErrorZ_is_ok(long o); // void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); public static native void CResult_ScorerDecodeErrorZ_free(long _res); + // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(struct LDKProbabilisticScoringParameters o); + public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(long o); + // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_err(long e); + // bool CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(long o); + // void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res); + public static native void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(long _res); + // uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(long orig); // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); public static native long CResult_InitFeaturesDecodeErrorZ_ok(long o); // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); @@ -2151,18 +2284,8 @@ public class bindings { public static native long CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_SpendableOutputDescriptorDecodeErrorZ_clone(long orig); - // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); - public static native long CResult_NoneNoneZ_ok(); - // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); - public static native long CResult_NoneNoneZ_err(); - // bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); - public static native boolean CResult_NoneNoneZ_is_ok(long o); - // void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); - public static native void CResult_NoneNoneZ_free(long _res); - // uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg); - public static native long CResult_NoneNoneZ_clone_ptr(long arg); - // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); - public static native long CResult_NoneNoneZ_clone(long orig); + // void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res); + public static native void CVec_PaymentPreimageZ_free(byte[][] _res); // uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg); public static native long C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(long arg); // struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); @@ -2195,6 +2318,38 @@ 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); + // uintptr_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); + // uintptr_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); + // uintptr_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_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); @@ -2207,8 +2362,8 @@ public class bindings { 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_u8Z_free(struct LDKCVec_u8Z _res); - public static native void CVec_u8Z_free(byte[] _res); + // 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); public static native long CResult_RecoverableSignatureNoneZ_ok(byte[] o); // struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); @@ -2221,6 +2376,8 @@ 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); + // 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); public static native void CVec_CVec_u8ZZ_free(byte[][] _res); // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); @@ -2435,6 +2592,54 @@ public class bindings { public static native long CResult_PaymentPreimageAPIErrorZ_clone_ptr(long arg); // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); public static native long CResult_PaymentPreimageAPIErrorZ_clone(long orig); + // struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); + public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(long o); + // struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_err(long e); + // bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(long o); + // void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); + public static native void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(long _res); + // uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(long orig); + // struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); + public static native long CResult_ChannelCounterpartyDecodeErrorZ_ok(long o); + // struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ChannelCounterpartyDecodeErrorZ_err(long e); + // bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ChannelCounterpartyDecodeErrorZ_is_ok(long o); + // void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); + public static native void CResult_ChannelCounterpartyDecodeErrorZ_free(long _res); + // uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ChannelCounterpartyDecodeErrorZ_clone(long orig); + // struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); + public static native long CResult_ChannelDetailsDecodeErrorZ_ok(long o); + // struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ChannelDetailsDecodeErrorZ_err(long e); + // bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ChannelDetailsDecodeErrorZ_is_ok(long o); + // void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); + public static native void CResult_ChannelDetailsDecodeErrorZ_free(long _res); + // uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_ChannelDetailsDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ChannelDetailsDecodeErrorZ_clone(long orig); + // struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); + public static native long CResult_PhantomRouteHintsDecodeErrorZ_ok(long o); + // struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_PhantomRouteHintsDecodeErrorZ_err(long e); + // bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_PhantomRouteHintsDecodeErrorZ_is_ok(long o); + // void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); + public static native void CResult_PhantomRouteHintsDecodeErrorZ_free(long _res); + // uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_PhantomRouteHintsDecodeErrorZ_clone(long orig); // void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); public static native void CVec_ChannelMonitorZ_free(long[] _res); // struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); @@ -2613,18 +2818,6 @@ public class bindings { public static native long CResult_DescriptionCreationErrorZ_clone_ptr(long arg); // struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); public static native long CResult_DescriptionCreationErrorZ_clone(long orig); - // struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o); - public static native long CResult_ExpiryTimeCreationErrorZ_ok(long o); - // struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e); - public static native long CResult_ExpiryTimeCreationErrorZ_err(CreationError e); - // bool CResult_ExpiryTimeCreationErrorZ_is_ok(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR o); - public static native boolean CResult_ExpiryTimeCreationErrorZ_is_ok(long o); - // void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res); - public static native void CResult_ExpiryTimeCreationErrorZ_free(long _res); - // uintptr_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg); - public static native long CResult_ExpiryTimeCreationErrorZ_clone_ptr(long arg); - // struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig); - public static native long CResult_ExpiryTimeCreationErrorZ_clone(long orig); // struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); public static native long CResult_PrivateRouteCreationErrorZ_ok(long o); // struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); @@ -2871,18 +3064,18 @@ public class bindings { 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 LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o); - public static native long CResult_DirectionalChannelInfoDecodeErrorZ_ok(long o); - // struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_DirectionalChannelInfoDecodeErrorZ_err(long e); - // bool CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(long o); - // void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res); - public static native void CResult_DirectionalChannelInfoDecodeErrorZ_free(long _res); - // uintptr_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_DirectionalChannelInfoDecodeErrorZ_clone(long orig); + // struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); + public static native long CResult_ChannelUpdateInfoDecodeErrorZ_ok(long o); + // struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ChannelUpdateInfoDecodeErrorZ_err(long e); + // bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(long o); + // void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); + public static native void CResult_ChannelUpdateInfoDecodeErrorZ_free(long _res); + // uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ChannelUpdateInfoDecodeErrorZ_clone(long orig); // struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); public static native long CResult_ChannelInfoDecodeErrorZ_ok(long o); // struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); @@ -3275,6 +3468,18 @@ public class bindings { public static native long CResult_ErrorMessageDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_ErrorMessageDecodeErrorZ_clone(long orig); + // struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); + public static native long CResult_WarningMessageDecodeErrorZ_ok(long o); + // struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_WarningMessageDecodeErrorZ_err(long e); + // bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_WarningMessageDecodeErrorZ_is_ok(long o); + // void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); + public static native void CResult_WarningMessageDecodeErrorZ_free(long _res); + // uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_WarningMessageDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_WarningMessageDecodeErrorZ_clone(long orig); // struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); public static native long CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(long o); // struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); @@ -3359,6 +3564,8 @@ public class bindings { public static native long CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_GossipTimestampFilterDecodeErrorZ_clone(long orig); + // void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); + public static native void CVec_PhantomRouteHintsZ_free(long[] _res); // struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o); public static native long CResult_InvoiceSignOrCreationErrorZ_ok(long o); // struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); @@ -3451,6 +3658,8 @@ public class bindings { public static native long Event_discard_funding(byte[] channel_id, byte[] transaction); // 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_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat); + public static native long Event_open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat); // 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); @@ -3529,6 +3738,8 @@ public class bindings { public static native long recover_pk(byte[] msg, String sig); // bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); public static native boolean verify(byte[] msg, String sig, byte[] pk); + // struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature); + public static native byte[] construct_invoice_preimage(byte[] hrp_bytes, byte[] data_without_signature); // enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); public static native Level Level_clone(long orig); // enum LDKLevel Level_gossip(void); @@ -3705,8 +3916,12 @@ public class bindings { public static native boolean UserConfig_get_accept_inbound_channels(long this_ptr); // void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); public static native void UserConfig_set_accept_inbound_channels(long this_ptr, boolean val); - // MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg); - public static native long UserConfig_new(long own_channel_config_arg, long peer_channel_config_limits_arg, long channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg); + // bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); + public static native boolean UserConfig_get_manually_accept_inbound_channels(long this_ptr); + // void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); + public static native void UserConfig_set_manually_accept_inbound_channels(long this_ptr, boolean val); + // MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg); + public static native long UserConfig_new(long own_channel_config_arg, long peer_channel_config_limits_arg, long channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg, boolean manually_accept_inbound_channels_arg); // uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg); public static native long UserConfig_clone_ptr(long arg); // struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); @@ -4033,6 +4248,12 @@ public class bindings { public static native long Sign_clone(long orig); // void Sign_free(struct LDKSign this_ptr); public static native void Sign_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 InMemorySigner_free(struct LDKInMemorySigner this_obj); @@ -4065,8 +4286,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 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 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 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); @@ -4091,8 +4312,8 @@ public class bindings { public static native long InMemorySigner_as_Sign(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); - public static native long InMemorySigner_read(byte[] ser); + // struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg); + public static native long InMemorySigner_read(byte[] ser, byte[] arg); // 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); @@ -4103,6 +4324,16 @@ public class bindings { 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); + // 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); + // 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); // void ChannelManager_free(struct LDKChannelManager this_obj); public static native void ChannelManager_free(long this_obj); // void ChainParameters_free(struct LDKChainParameters this_obj); @@ -4251,6 +4482,26 @@ public class bindings { public static native long PaymentSendFailure_all_failed_retry_safe(long[] a); // 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 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); + public static native long[] PhantomRouteHints_get_channels(long this_ptr); + // void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); + public static native void PhantomRouteHints_set_channels(long this_ptr, long[] val); + // uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); + public static native long PhantomRouteHints_get_phantom_scid(long this_ptr); + // void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); + public static native void PhantomRouteHints_set_phantom_scid(long this_ptr, long val); + // struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); + public static native byte[] PhantomRouteHints_get_real_node_pubkey(long this_ptr); + // void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void PhantomRouteHints_set_real_node_pubkey(long this_ptr, byte[] val); + // MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); + public static native long PhantomRouteHints_new(long[] channels_arg, long phantom_scid_arg, byte[] real_node_pubkey_arg); + // uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg); + 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 LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -4291,6 +4542,8 @@ public class bindings { public static native boolean 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); public static native byte[] ChannelManager_get_our_node_id(long this_arg); + // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32]); + public static native long ChannelManager_accept_inbound_channel(long this_arg, byte[] temporary_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_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); @@ -4301,6 +4554,10 @@ public class bindings { 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); public static native long ChannelManager_get_payment_preimage(long this_arg, byte[] payment_hash, byte[] payment_secret); + // MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_get_phantom_scid(long this_arg); + // MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_get_phantom_route_hints(long this_arg); // struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_MessageSendEventsProvider(long this_arg); // struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -4317,6 +4574,22 @@ public class bindings { public static native long ChannelManager_current_best_block(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 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); + public static native long CounterpartyForwardingInfo_read(byte[] ser); + // struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); + public static native byte[] ChannelCounterparty_write(long obj); + // struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); + public static native long ChannelCounterparty_read(byte[] ser); + // struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); + public static native byte[] ChannelDetails_write(long obj); + // struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); + public static native long ChannelDetails_read(byte[] ser); + // struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); + public static native byte[] PhantomRouteHints_write(long obj); + // struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); + public static native long PhantomRouteHints_read(byte[] ser); // struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); public static native byte[] ChannelManager_write(long obj); // void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); @@ -4383,6 +4656,22 @@ public class bindings { public static native long ErrorMessage_clone_ptr(long arg); // struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); public static native long ErrorMessage_clone(long orig); + // void WarningMessage_free(struct LDKWarningMessage this_obj); + public static native void WarningMessage_free(long this_obj); + // const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32]; + public static native byte[] WarningMessage_get_channel_id(long this_ptr); + // void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + public static native void WarningMessage_set_channel_id(long this_ptr, byte[] val); + // struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); + public static native String WarningMessage_get_data(long this_ptr); + // void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); + public static native void WarningMessage_set_data(long this_ptr, String val); + // MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); + public static native long WarningMessage_new(byte[] channel_id_arg, String data_arg); + // uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg); + public static native long WarningMessage_clone_ptr(long arg); + // struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); + public static native long WarningMessage_clone(long orig); // void Ping_free(struct LDKPing this_obj); public static native void Ping_free(long this_obj); // uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); @@ -4551,6 +4840,10 @@ public class bindings { public static native byte[] AcceptChannel_get_first_per_commitment_point(long this_ptr); // void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); public static native void AcceptChannel_set_first_per_commitment_point(long this_ptr, byte[] val); + // struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); + public static native long AcceptChannel_get_channel_type(long this_ptr); + // void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); + public static native void AcceptChannel_set_channel_type(long this_ptr, long val); // uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg); public static native long AcceptChannel_clone_ptr(long arg); // struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); @@ -5147,6 +5440,8 @@ public class bindings { public static native long ErrorAction_ignore_duplicate_gossip(); // struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); public static native long ErrorAction_send_error_message(long msg); + // struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); + public static native long ErrorAction_send_warning_message(long msg, Level log_level); // void LightningError_free(struct LDKLightningError this_obj); public static native void LightningError_free(long this_obj); // struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); @@ -5299,6 +5594,10 @@ public class bindings { public static native byte[] ErrorMessage_write(long obj); // struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); public static native long ErrorMessage_read(byte[] ser); + // struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); + public static native byte[] WarningMessage_write(long obj); + // struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); + public static native long WarningMessage_read(byte[] ser); // struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); public static native byte[] UnsignedNodeAnnouncement_write(long obj); // struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); @@ -5413,6 +5712,24 @@ public class bindings { public static native byte[] build_commitment_secret(byte[] commitment_seed, long idx); // struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); public static native byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, long funding_outpoint); + // void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); + public static native void CounterpartyCommitmentSecrets_free(long this_obj); + // uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg); + public static native long CounterpartyCommitmentSecrets_clone_ptr(long arg); + // struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); + public static native long CounterpartyCommitmentSecrets_clone(long orig); + // MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); + public static native long CounterpartyCommitmentSecrets_new(); + // MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); + public static native long CounterpartyCommitmentSecrets_get_min_seen_secret(long this_arg); + // MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); + public static native long CounterpartyCommitmentSecrets_provide_secret(long this_arg, long idx, byte[] secret); + // MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); + public static native byte[] CounterpartyCommitmentSecrets_get_secret(long this_arg, long idx); + // struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); + public static native byte[] CounterpartyCommitmentSecrets_write(long obj); + // struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); + public static native long CounterpartyCommitmentSecrets_read(byte[] ser); // struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); public static native long derive_private_key(byte[] per_commitment_point, byte[] base_secret); // struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); @@ -5899,46 +6216,46 @@ public class bindings { public static native long NetGraphMsgHandler_as_RoutingMessageHandler(long this_arg); // struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); public static native long NetGraphMsgHandler_as_MessageSendEventsProvider(long this_arg); - // void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj); - public static native void DirectionalChannelInfo_free(long this_obj); - // uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native int DirectionalChannelInfo_get_last_update(long this_ptr); - // void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); - public static native void DirectionalChannelInfo_set_last_update(long this_ptr, int val); - // bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native boolean DirectionalChannelInfo_get_enabled(long this_ptr); - // void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); - public static native void DirectionalChannelInfo_set_enabled(long this_ptr, boolean val); - // uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native short DirectionalChannelInfo_get_cltv_expiry_delta(long this_ptr); - // void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); - public static native void DirectionalChannelInfo_set_cltv_expiry_delta(long this_ptr, short val); - // uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native long DirectionalChannelInfo_get_htlc_minimum_msat(long this_ptr); - // void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); - public static native void DirectionalChannelInfo_set_htlc_minimum_msat(long this_ptr, long val); - // struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native long DirectionalChannelInfo_get_htlc_maximum_msat(long this_ptr); - // void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - public static native void DirectionalChannelInfo_set_htlc_maximum_msat(long this_ptr, long val); - // struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native long DirectionalChannelInfo_get_fees(long this_ptr); - // void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - public static native void DirectionalChannelInfo_set_fees(long this_ptr, long val); - // struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - public static native long DirectionalChannelInfo_get_last_update_message(long this_ptr); - // void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); - public static native void DirectionalChannelInfo_set_last_update_message(long this_ptr, long val); - // MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); - public static native long DirectionalChannelInfo_new(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, long fees_arg, long last_update_message_arg); - // uintptr_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg); - public static native long DirectionalChannelInfo_clone_ptr(long arg); - // struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); - public static native long DirectionalChannelInfo_clone(long orig); - // struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); - public static native byte[] DirectionalChannelInfo_write(long obj); - // struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); - public static native long DirectionalChannelInfo_read(byte[] ser); + // void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); + public static native void ChannelUpdateInfo_free(long this_obj); + // uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native int ChannelUpdateInfo_get_last_update(long this_ptr); + // void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val); + public static native void ChannelUpdateInfo_set_last_update(long this_ptr, int val); + // bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native boolean ChannelUpdateInfo_get_enabled(long this_ptr); + // void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); + public static native void ChannelUpdateInfo_set_enabled(long this_ptr, boolean val); + // uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native short ChannelUpdateInfo_get_cltv_expiry_delta(long this_ptr); + // void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val); + public static native void ChannelUpdateInfo_set_cltv_expiry_delta(long this_ptr, short val); + // uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native long ChannelUpdateInfo_get_htlc_minimum_msat(long this_ptr); + // void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); + public static native void ChannelUpdateInfo_set_htlc_minimum_msat(long this_ptr, long val); + // struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native long ChannelUpdateInfo_get_htlc_maximum_msat(long this_ptr); + // void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + public static native void ChannelUpdateInfo_set_htlc_maximum_msat(long this_ptr, long val); + // struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native long ChannelUpdateInfo_get_fees(long this_ptr); + // void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); + public static native void ChannelUpdateInfo_set_fees(long this_ptr, long val); + // struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); + public static native long ChannelUpdateInfo_get_last_update_message(long this_ptr); + // void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); + public static native void ChannelUpdateInfo_set_last_update_message(long this_ptr, long val); + // MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); + public static native long ChannelUpdateInfo_new(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, long fees_arg, long last_update_message_arg); + // uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg); + public static native long ChannelUpdateInfo_clone_ptr(long arg); + // struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); + public static native long ChannelUpdateInfo_clone(long orig); + // struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); + public static native byte[] ChannelUpdateInfo_write(long obj); + // struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); + public static native long ChannelUpdateInfo_read(byte[] ser); // void ChannelInfo_free(struct LDKChannelInfo this_obj); public static native void ChannelInfo_free(long this_obj); // struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); @@ -5949,17 +6266,17 @@ public class bindings { public static native long ChannelInfo_get_node_one(long this_ptr); // void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); public static native void ChannelInfo_set_node_one(long this_ptr, long val); - // struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + // struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); public static native long ChannelInfo_get_one_to_two(long this_ptr); - // void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); + // void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); public static native void ChannelInfo_set_one_to_two(long this_ptr, long val); // struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); public static native long ChannelInfo_get_node_two(long this_ptr); // void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); public static native void ChannelInfo_set_node_two(long this_ptr, long val); - // struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + // struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); public static native long ChannelInfo_get_two_to_one(long this_ptr); - // void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); + // void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); public static native void ChannelInfo_set_two_to_one(long this_ptr, long val); // struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); public static native long ChannelInfo_get_capacity_sats(long this_ptr); @@ -5977,6 +6294,36 @@ public class bindings { public static native byte[] ChannelInfo_write(long obj); // struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); public static native long ChannelInfo_read(byte[] ser); + // void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); + public static native void DirectedChannelInfo_free(long this_obj); + // uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg); + public static native long DirectedChannelInfo_clone_ptr(long arg); + // struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); + public static native long DirectedChannelInfo_clone(long orig); + // MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); + public static native long DirectedChannelInfo_channel(long this_arg); + // MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); + public static native long DirectedChannelInfo_direction(long this_arg); + // MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); + public static native long DirectedChannelInfo_effective_capacity(long this_arg); + // void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); + public static native void EffectiveCapacity_free(long this_ptr); + // uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg); + public static native long EffectiveCapacity_clone_ptr(long arg); + // struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); + public static native long EffectiveCapacity_clone(long orig); + // struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); + public static native long EffectiveCapacity_exact_liquidity(long liquidity_msat); + // struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat); + public static native long EffectiveCapacity_maximum_htlc(long amount_msat); + // struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat); + public static native long EffectiveCapacity_total(long capacity_msat); + // struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); + public static native long EffectiveCapacity_infinite(); + // struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); + public static native long EffectiveCapacity_unknown(); + // MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); + public static native long EffectiveCapacity_as_msat(long this_arg); // void RoutingFees_free(struct LDKRoutingFees this_obj); public static native void RoutingFees_free(long this_obj); // uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); @@ -6077,6 +6424,8 @@ public class bindings { public static native void NetworkGraph_close_channel_from_update(long this_arg, long short_channel_id, boolean is_permanent); // void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); public static native void NetworkGraph_fail_node(long this_arg, byte[] _node_id, boolean is_permanent); + // void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg); + public static native void NetworkGraph_remove_stale_channels(long this_arg); // void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); public static native void NetworkGraph_remove_stale_channels_with_time(long this_arg, long current_time_unix); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); @@ -6131,12 +6480,12 @@ public class bindings { public static native long[][] Route_get_paths(long this_ptr); // void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); public static native void Route_set_paths(long this_ptr, long[][] val); - // struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr); - public static native long Route_get_payee(long this_ptr); - // void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val); - public static native void Route_set_payee(long this_ptr, long val); - // MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg); - public static native long Route_new(long[][] paths_arg, long payee_arg); + // struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr); + public static native long Route_get_payment_params(long this_ptr); + // void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); + public static native void Route_set_payment_params(long this_ptr, long val); + // MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg); + public static native long Route_new(long[][] paths_arg, long payment_params_arg); // uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg); public static native long Route_clone_ptr(long arg); // struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); @@ -6155,10 +6504,10 @@ public class bindings { public static native long Route_read(byte[] ser); // void RouteParameters_free(struct LDKRouteParameters this_obj); public static native void RouteParameters_free(long this_obj); - // struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr); - public static native long RouteParameters_get_payee(long this_ptr); - // void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val); - public static native void RouteParameters_set_payee(long this_ptr, long val); + // struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); + public static native long RouteParameters_get_payment_params(long this_ptr); + // void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); + public static native void RouteParameters_set_payment_params(long this_ptr, long val); // uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); 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); @@ -6167,8 +6516,8 @@ public class bindings { 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 LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg); - public static native long RouteParameters_new(long payee_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, 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); // uintptr_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); @@ -6177,42 +6526,46 @@ public class bindings { public static native byte[] RouteParameters_write(long obj); // struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); public static native long RouteParameters_read(byte[] ser); - // void Payee_free(struct LDKPayee this_obj); - public static native void Payee_free(long this_obj); - // struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr); - public static native byte[] Payee_get_pubkey(long this_ptr); - // void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void Payee_set_pubkey(long this_ptr, byte[] val); - // struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr); - public static native long Payee_get_features(long this_ptr); - // void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val); - public static native void Payee_set_features(long this_ptr, long val); - // struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr); - public static native long[] Payee_get_route_hints(long this_ptr); - // void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val); - public static native void Payee_set_route_hints(long this_ptr, long[] val); - // struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr); - public static native long Payee_get_expiry_time(long this_ptr); - // void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - public static native void Payee_set_expiry_time(long this_ptr, long val); - // MUST_USE_RES struct LDKPayee Payee_new(struct LDKPublicKey pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg); - public static native long Payee_new(byte[] pubkey_arg, long features_arg, long[] route_hints_arg, long expiry_time_arg); - // uintptr_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg); - public static native long Payee_clone_ptr(long arg); - // struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); - public static native long Payee_clone(long orig); - // uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); - public static native long Payee_hash(long o); - // bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); - public static native boolean Payee_eq(long a, long b); - // struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj); - public static native byte[] Payee_write(long obj); - // struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser); - public static native long Payee_read(byte[] ser); - // MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey); - public static native long Payee_from_node_id(byte[] pubkey); - // MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey); - public static native long Payee_for_keysend(byte[] pubkey); + // void PaymentParameters_free(struct LDKPaymentParameters this_obj); + public static native void PaymentParameters_free(long this_obj); + // struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native byte[] PaymentParameters_get_payee_pubkey(long this_ptr); + // void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void PaymentParameters_set_payee_pubkey(long this_ptr, byte[] val); + // struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native long PaymentParameters_get_features(long this_ptr); + // void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val); + public static native void PaymentParameters_set_features(long this_ptr, long val); + // struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native long[] PaymentParameters_get_route_hints(long this_ptr); + // void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val); + public static native void PaymentParameters_set_route_hints(long this_ptr, long[] val); + // struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native long PaymentParameters_get_expiry_time(long this_ptr); + // void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + public static native void PaymentParameters_set_expiry_time(long this_ptr, long val); + // uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + public static native int PaymentParameters_get_max_total_cltv_expiry_delta(long this_ptr); + // void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); + public static native void PaymentParameters_set_max_total_cltv_expiry_delta(long this_ptr, int val); + // 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); + 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); + // uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg); + public static native long PaymentParameters_clone_ptr(long arg); + // struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); + public static native long PaymentParameters_clone(long orig); + // uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); + public static native long PaymentParameters_hash(long o); + // bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); + 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); // 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); @@ -6273,8 +6626,8 @@ public class bindings { public static native byte[] RouteHintHop_write(long obj); // struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); public static native long RouteHintHop_read(byte[] ser); - // struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); - public static native long find_route(byte[] our_node_pubkey, long params, long network, long[] first_hops, long logger, long scorer); + // struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); + public static native long find_route(byte[] our_node_pubkey, long route_params, long network, long[] first_hops, long logger, long scorer); // void Score_free(struct LDKScore this_ptr); public static native void Score_free(long this_ptr); // void LockableScore_free(struct LDKLockableScore this_ptr); @@ -6283,6 +6636,20 @@ public class bindings { public static native void MultiThreadedLockableScore_free(long this_obj); // MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); public static native long MultiThreadedLockableScore_new(long score); + // void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); + public static native void FixedPenaltyScorer_free(long this_obj); + // uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg); + public static native long FixedPenaltyScorer_clone_ptr(long arg); + // struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); + public static native long FixedPenaltyScorer_clone(long orig); + // struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); + public static native byte[] FixedPenaltyScorer_write(long obj); + // struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser); + public static native long FixedPenaltyScorer_read(byte[] ser); + // MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); + public static native long FixedPenaltyScorer_with_penalty(long penalty_msat); + // struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); + public static native long FixedPenaltyScorer_as_Score(long this_arg); // void Scorer_free(struct LDKScorer this_obj); public static native void Scorer_free(long this_obj); // void ScoringParameters_free(struct LDKScoringParameters this_obj); @@ -6309,6 +6676,10 @@ public class bindings { public static native void ScoringParameters_set_failure_penalty_half_life(long this_ptr, long val); // MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg); public static native long ScoringParameters_new(long base_penalty_msat_arg, long failure_penalty_msat_arg, short overuse_penalty_start_1024th_arg, long overuse_penalty_msat_per_1024th_arg, long failure_penalty_half_life_arg); + // uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg); + public static native long ScoringParameters_clone_ptr(long arg); + // struct LDKScoringParameters ScoringParameters_clone(const struct LDKScoringParameters *NONNULL_PTR orig); + public static native long ScoringParameters_clone(long orig); // struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj); public static native byte[] ScoringParameters_write(long obj); // struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser); @@ -6325,6 +6696,28 @@ public class bindings { public static native byte[] Scorer_write(long obj); // struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser); public static native long Scorer_read(byte[] ser); + // void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj); + public static native void ProbabilisticScoringParameters_free(long this_obj); + // uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(long this_ptr); + // void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(long this_ptr, long val); + // uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_liquidity_offset_half_life(long this_ptr); + // void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_liquidity_offset_half_life(long this_ptr, long val); + // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg); + public static native long ProbabilisticScoringParameters_new(long liquidity_penalty_multiplier_msat_arg, long liquidity_offset_half_life_arg); + // uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg); + public static native long ProbabilisticScoringParameters_clone_ptr(long arg); + // struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig); + public static native long ProbabilisticScoringParameters_clone(long orig); + // struct LDKCVec_u8Z ProbabilisticScoringParameters_write(const struct LDKProbabilisticScoringParameters *NONNULL_PTR obj); + public static native byte[] ProbabilisticScoringParameters_write(long obj); + // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ ProbabilisticScoringParameters_read(struct LDKu8slice ser); + public static native long ProbabilisticScoringParameters_read(byte[] ser); + // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void); + public static native long ProbabilisticScoringParameters_default(); // void FilesystemPersister_free(struct LDKFilesystemPersister this_obj); public static native void FilesystemPersister_free(long this_obj); // MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data); @@ -6347,8 +6740,6 @@ public class bindings { public static native long BackgroundProcessor_join(long this_arg); // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); public static native long BackgroundProcessor_stop(long this_arg); - // void check_platform(void); - public static native void check_platform(); // void Invoice_free(struct LDKInvoice this_obj); public static native void Invoice_free(long this_obj); // bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b); @@ -6563,8 +6954,12 @@ public class bindings { public static native long PositiveTimestamp_from_unix_timestamp(long unix_seconds); // MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time); public static native long PositiveTimestamp_from_system_time(long time); + // MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration); + public static native long PositiveTimestamp_from_duration_since_epoch(long duration); // MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); public static native long PositiveTimestamp_as_unix_timestamp(long this_arg); + // MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); + public static native long PositiveTimestamp_as_duration_since_epoch(long this_arg); // MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); public static native long PositiveTimestamp_as_time(long this_arg); // MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg); @@ -6575,6 +6970,8 @@ public class bindings { public static native long Invoice_from_signed(long signed_invoice); // MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg); public static native long Invoice_timestamp(long this_arg); + // MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg); + public static native long Invoice_duration_since_epoch(long this_arg); // MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32]; public static native byte[] Invoice_payment_hash(long this_arg); // MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg); @@ -6589,6 +6986,8 @@ public class bindings { public static native long Invoice_expiry_time(long this_arg); // MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg); 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 struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg); @@ -6603,9 +7002,9 @@ public class bindings { public static native long Description_new(String description); // MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg); public static native String Description_into_inner(long this_arg); - // MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds); + // MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds); public static native long ExpiryTime_from_seconds(long seconds); - // MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration); + // MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration); public static native long ExpiryTime_from_duration(long duration); // MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg); public static native long ExpiryTime_as_seconds(long this_arg); @@ -6623,10 +7022,10 @@ public class bindings { public static native CreationError CreationError_route_too_long(); // enum LDKCreationError CreationError_timestamp_out_of_bounds(void); public static native CreationError CreationError_timestamp_out_of_bounds(); - // enum LDKCreationError CreationError_expiry_time_out_of_bounds(void); - public static native CreationError CreationError_expiry_time_out_of_bounds(); // enum LDKCreationError CreationError_invalid_amount(void); public static native CreationError CreationError_invalid_amount(); + // enum LDKCreationError CreationError_missing_route_hints(void); + public static native CreationError CreationError_missing_route_hints(); // 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); @@ -6717,8 +7116,12 @@ public class bindings { 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 LDKStr description, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); + public static native long create_phantom_invoice(long amt_msat, String description, byte[] payment_hash, byte[] payment_secret, long[] phantom_route_hints, long keys_manager, Currency network); // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description); public static native long create_invoice_from_channelmanager(long channelmanager, long keys_manager, Currency network, long amt_msat, String description); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch); + public static native long create_invoice_from_channelmanager_and_duration_since_epoch(long channelmanager, long keys_manager, Currency network, long amt_msat, String description, long duration_since_epoch); // void DefaultRouter_free(struct LDKDefaultRouter this_obj); public static native void DefaultRouter_free(long this_obj); // MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); diff --git a/src/main/java/org/ldk/structs/AcceptChannel.java b/src/main/java/org/ldk/structs/AcceptChannel.java index 70157f07..94399e61 100644 --- a/src/main/java/org/ldk/structs/AcceptChannel.java +++ b/src/main/java/org/ldk/structs/AcceptChannel.java @@ -272,6 +272,40 @@ public class AcceptChannel extends CommonBase { Reference.reachabilityFence(val); } + /** + * 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. + * + * 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 + */ + @Nullable + public ChannelTypeFeatures get_channel_type() { + long ret = bindings.AcceptChannel_get_channel_type(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * 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. + * + * 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 + */ + public void set_channel_type(@Nullable ChannelTypeFeatures val) { + bindings.AcceptChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + long clone_ptr() { long ret = bindings.AcceptChannel_clone_ptr(this.ptr); Reference.reachabilityFence(this); diff --git a/src/main/java/org/ldk/structs/Access.java b/src/main/java/org/ldk/structs/Access.java index b80661ba..a244405e 100644 --- a/src/main/java/org/ldk/structs/Access.java +++ b/src/main/java/org/ldk/structs/Access.java @@ -41,6 +41,7 @@ public class Access extends CommonBase { 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; } diff --git a/src/main/java/org/ldk/structs/BaseSign.java b/src/main/java/org/ldk/structs/BaseSign.java index 11d55c96..7bc6174c 100644 --- a/src/main/java/org/ldk/structs/BaseSign.java +++ b/src/main/java/org/ldk/structs/BaseSign.java @@ -65,8 +65,15 @@ public class BaseSign extends CommonBase { * 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: 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); + Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages); /** * Gets 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 @@ -80,8 +87,15 @@ public class BaseSign extends CommonBase { * * 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: 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); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] preimages); /** * Validate the counterparty's revocation. * @@ -168,14 +182,17 @@ public class BaseSign extends CommonBase { */ Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx); /** - * Signs a channel announcement message with our funding key, proving it comes from one - * of the channel participants. + * 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_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg); + 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. @@ -196,74 +213,87 @@ public class BaseSign extends CommonBase { 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) { + @Override public long validate_holder_commitment(long holder_tx, byte[][] preimages) { HolderCommitmentTransaction holder_tx_hu_conv = null; if (holder_tx < 0 || holder_tx > 4096) { holder_tx_hu_conv = new HolderCommitmentTransaction(null, holder_tx); } - Result_NoneNoneZ ret = arg.validate_holder_commitment(holder_tx_hu_conv); + 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) { + @Override public long sign_counterparty_commitment(long commitment_tx, byte[][] preimages) { CommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new CommitmentTransaction(null, commitment_tx); } - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv); + 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) { HolderCommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new 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) { HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new 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) { HTLCOutputInCommitment htlc_hu_conv = null; if (htlc < 0 || htlc > 4096) { htlc_hu_conv = new 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) { ClosingTransaction closing_tx_hu_conv = null; if (closing_tx < 0 || closing_tx > 4096) { closing_tx_hu_conv = new 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_channel_announcement(long msg) { UnsignedChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UnsignedChannelAnnouncement(null, msg); } - Result_SignatureNoneZ ret = arg.sign_channel_announcement(msg_hu_conv); + 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 ready_channel(long channel_parameters) { ChannelTransactionParameters channel_parameters_hu_conv = null; if (channel_parameters < 0 || channel_parameters > 4096) { channel_parameters_hu_conv = new ChannelTransactionParameters(null, channel_parameters); } arg.ready_channel(channel_parameters_hu_conv); + Reference.reachabilityFence(arg); } }, pubkeys); return impl_holder.held; @@ -304,11 +334,19 @@ public class BaseSign extends CommonBase { * 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: all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. */ - public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx) { - long ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr & ~1); + public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx, byte[][] preimages) { + long ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr & ~1, 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); this.ptrs_to.add(holder_tx); @@ -333,11 +371,19 @@ public class BaseSign extends CommonBase { * * 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: 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(CommitmentTransaction commitment_tx) { - long ret = bindings.BaseSign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] preimages) { + long ret = bindings.BaseSign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1, 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); this.ptrs_to.add(commitment_tx); @@ -494,19 +540,22 @@ public class BaseSign extends CommonBase { } /** - * Signs a channel announcement message with our funding key, proving it comes from one - * of the channel participants. + * 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_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { + public Result_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { long ret = bindings.BaseSign_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + Result_C2Tuple_SignatureSignatureZNoneZ ret_hu_conv = Result_C2Tuple_SignatureSignatureZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(msg); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/BroadcasterInterface.java b/src/main/java/org/ldk/structs/BroadcasterInterface.java index 5052076d..5192133c 100644 --- a/src/main/java/org/ldk/structs/BroadcasterInterface.java +++ b/src/main/java/org/ldk/structs/BroadcasterInterface.java @@ -36,6 +36,7 @@ public class BroadcasterInterface extends CommonBase { impl_holder.held = new BroadcasterInterface(new bindings.LDKBroadcasterInterface() { @Override public void broadcast_transaction(byte[] tx) { arg.broadcast_transaction(tx); + Reference.reachabilityFence(arg); } }); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/ChannelCounterparty.java b/src/main/java/org/ldk/structs/ChannelCounterparty.java index d355cbf1..2695fc45 100644 --- a/src/main/java/org/ldk/structs/ChannelCounterparty.java +++ b/src/main/java/org/ldk/structs/ChannelCounterparty.java @@ -155,4 +155,24 @@ public class ChannelCounterparty extends CommonBase { return ret_hu_conv; } + /** + * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read + */ + public byte[] write() { + byte[] ret = bindings.ChannelCounterparty_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write + */ + public static Result_ChannelCounterpartyDecodeErrorZ read(byte[] ser) { + long ret = bindings.ChannelCounterparty_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelCounterpartyDecodeErrorZ ret_hu_conv = Result_ChannelCounterpartyDecodeErrorZ.constr_from_ptr(ret); + 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 8babf959..be561479 100644 --- a/src/main/java/org/ldk/structs/ChannelDetails.java +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -510,4 +510,24 @@ public class ChannelDetails extends CommonBase { return ret_hu_conv; } + /** + * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read + */ + public byte[] write() { + byte[] ret = bindings.ChannelDetails_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a ChannelDetails from a byte array, created by ChannelDetails_write + */ + public static Result_ChannelDetailsDecodeErrorZ read(byte[] ser) { + long ret = bindings.ChannelDetails_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index c9de83bc..a8d680c1 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -69,11 +69,11 @@ public class ChannelInfo extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public DirectionalChannelInfo get_one_to_two() { + public ChannelUpdateInfo get_one_to_two() { long ret = bindings.ChannelInfo_get_one_to_two(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } + ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -83,7 +83,7 @@ public class ChannelInfo extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_one_to_two(@Nullable DirectionalChannelInfo val) { + public void set_one_to_two(@Nullable ChannelUpdateInfo val) { bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(val); @@ -116,11 +116,11 @@ public class ChannelInfo extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public DirectionalChannelInfo get_two_to_one() { + public ChannelUpdateInfo get_two_to_one() { long ret = bindings.ChannelInfo_get_two_to_one(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } + ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -130,7 +130,7 @@ public class ChannelInfo extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_two_to_one(@Nullable DirectionalChannelInfo val) { + public void set_two_to_one(@Nullable ChannelUpdateInfo val) { bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(val); diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index 268199ea..25f79c39 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -531,6 +531,23 @@ public class ChannelManager extends CommonBase { return ret; } + /** + * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been + * triggered. + * + * The `temporary_channel_id` parameter indicates which inbound channel should be accepted. + * + * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest + */ + public Result_NoneAPIErrorZ accept_inbound_channel(byte[] temporary_channel_id) { + long ret = bindings.ChannelManager_accept_inbound_channel(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(temporary_channel_id); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing * to pay us. @@ -682,6 +699,32 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids + * are used when constructing the phantom invoice's route hints. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + */ + public long get_phantom_scid() { + long ret = bindings.ChannelManager_get_phantom_scid(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Gets route hints for use in receiving [phantom node payments]. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + */ + public PhantomRouteHints get_phantom_route_hints() { + long ret = bindings.ChannelManager_get_phantom_route_hints(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PhantomRouteHints(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + /** * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is diff --git a/src/main/java/org/ldk/structs/ChannelManagerPersister.java b/src/main/java/org/ldk/structs/ChannelManagerPersister.java index 686a076e..0e3cf347 100644 --- a/src/main/java/org/ldk/structs/ChannelManagerPersister.java +++ b/src/main/java/org/ldk/structs/ChannelManagerPersister.java @@ -42,6 +42,7 @@ public class ChannelManagerPersister extends CommonBase { @Override public long persist_manager(long channel_manager) { ChannelManager channel_manager_hu_conv = null; if (channel_manager < 0 || channel_manager > 4096) { channel_manager_hu_conv = new ChannelManager(null, channel_manager); } Result_NoneErrorZ ret = arg.persist_manager(channel_manager_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index 8bb6667f..50da70d6 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -122,84 +122,104 @@ public class ChannelMessageHandler extends CommonBase { their_features_hu_conv.ptrs_to.add(this); OpenChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new OpenChannel(null, msg); } arg.handle_open_channel(their_node_id, their_features_hu_conv, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_accept_channel(byte[] their_node_id, long their_features, long msg) { InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new InitFeatures(null, their_features); } their_features_hu_conv.ptrs_to.add(this); AcceptChannel msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AcceptChannel(null, msg); } arg.handle_accept_channel(their_node_id, their_features_hu_conv, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_funding_created(byte[] their_node_id, long msg) { FundingCreated msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingCreated(null, msg); } arg.handle_funding_created(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_funding_signed(byte[] their_node_id, long msg) { FundingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingSigned(null, msg); } arg.handle_funding_signed(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_funding_locked(byte[] their_node_id, long msg) { FundingLocked msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new FundingLocked(null, msg); } arg.handle_funding_locked(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_shutdown(byte[] their_node_id, long their_features, long msg) { InitFeatures their_features_hu_conv = null; if (their_features < 0 || their_features > 4096) { their_features_hu_conv = new InitFeatures(null, their_features); } Shutdown msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Shutdown(null, msg); } arg.handle_shutdown(their_node_id, their_features_hu_conv, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_closing_signed(byte[] their_node_id, long msg) { ClosingSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ClosingSigned(null, msg); } arg.handle_closing_signed(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_update_add_htlc(byte[] their_node_id, long msg) { UpdateAddHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateAddHTLC(null, msg); } arg.handle_update_add_htlc(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_update_fulfill_htlc(byte[] their_node_id, long msg) { UpdateFulfillHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFulfillHTLC(null, msg); } arg.handle_update_fulfill_htlc(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_update_fail_htlc(byte[] their_node_id, long msg) { UpdateFailHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFailHTLC(null, msg); } arg.handle_update_fail_htlc(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_update_fail_malformed_htlc(byte[] their_node_id, long msg) { UpdateFailMalformedHTLC msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFailMalformedHTLC(null, msg); } arg.handle_update_fail_malformed_htlc(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_commitment_signed(byte[] their_node_id, long msg) { CommitmentSigned msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new CommitmentSigned(null, msg); } arg.handle_commitment_signed(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_revoke_and_ack(byte[] their_node_id, long msg) { RevokeAndACK msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new RevokeAndACK(null, msg); } arg.handle_revoke_and_ack(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_update_fee(byte[] their_node_id, long msg) { UpdateFee msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new UpdateFee(null, msg); } arg.handle_update_fee(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_announcement_signatures(byte[] their_node_id, long msg) { AnnouncementSignatures msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new AnnouncementSignatures(null, msg); } 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); + Reference.reachabilityFence(arg); } @Override public void peer_connected(byte[] their_node_id, long msg) { Init msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new Init(null, msg); } arg.peer_connected(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_channel_reestablish(byte[] their_node_id, long msg) { ChannelReestablish msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelReestablish(null, msg); } arg.handle_channel_reestablish(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_channel_update(byte[] their_node_id, long msg) { ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); } arg.handle_channel_update(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } @Override public void handle_error(byte[] their_node_id, long msg) { ErrorMessage msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ErrorMessage(null, msg); } arg.handle_error(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); } }, MessageSendEventsProvider.new_impl(MessageSendEventsProvider_impl).bindings_instance); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java new file mode 100644 index 00000000..4503cdb6 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelUpdateInfo.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; + + +/** + * Details about one direction of a channel as received within a [`ChannelUpdate`]. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ChannelUpdateInfo extends CommonBase { + ChannelUpdateInfo(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ChannelUpdateInfo_free(ptr); } + } + + /** + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. + */ + public int get_last_update() { + int ret = bindings.ChannelUpdateInfo_get_last_update(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. + */ + public void set_last_update(int val) { + bindings.ChannelUpdateInfo_set_last_update(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Whether the channel can be currently used for payments (in this one direction). + */ + public boolean get_enabled() { + boolean ret = bindings.ChannelUpdateInfo_get_enabled(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Whether the channel can be currently used for payments (in this one direction). + */ + public void set_enabled(boolean val) { + bindings.ChannelUpdateInfo_set_enabled(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The difference in CLTV values that you must have when routing through this channel. + */ + public short get_cltv_expiry_delta() { + short ret = bindings.ChannelUpdateInfo_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The difference in CLTV values that you must have when routing through this channel. + */ + public void set_cltv_expiry_delta(short val) { + bindings.ChannelUpdateInfo_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The minimum value, which must be relayed to the next hop via the channel + */ + public long get_htlc_minimum_msat() { + long ret = bindings.ChannelUpdateInfo_get_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The minimum value, which must be relayed to the next hop via the channel + */ + public void set_htlc_minimum_msat(long val) { + bindings.ChannelUpdateInfo_set_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The maximum value which may be relayed to the next hop via the channel. + */ + public Option_u64Z get_htlc_maximum_msat() { + long ret = bindings.ChannelUpdateInfo_get_htlc_maximum_msat(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * The maximum value which may be relayed to the next hop via the channel. + */ + public void set_htlc_maximum_msat(Option_u64Z val) { + bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Fees charged when the channel is used for routing + */ + public RoutingFees get_fees() { + long ret = bindings.ChannelUpdateInfo_get_fees(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Fees charged when the channel is used for routing + */ + public void set_fees(RoutingFees val) { + bindings.ChannelUpdateInfo_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelUpdate get_last_update_message() { + long ret = bindings.ChannelUpdateInfo_get_last_update_message(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_last_update_message(@Nullable ChannelUpdate val) { + bindings.ChannelUpdateInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Constructs a new ChannelUpdateInfo given each field + */ + public static ChannelUpdateInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) { + long ret = bindings.ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg.ptr, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1); + Reference.reachabilityFence(last_update_arg); + Reference.reachabilityFence(enabled_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); + Reference.reachabilityFence(htlc_minimum_msat_arg); + Reference.reachabilityFence(htlc_maximum_msat_arg); + Reference.reachabilityFence(fees_arg); + Reference.reachabilityFence(last_update_message_arg); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.ChannelUpdateInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ChannelUpdateInfo + */ + public ChannelUpdateInfo clone() { + long ret = bindings.ChannelUpdateInfo_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read + */ + public byte[] write() { + byte[] ret = bindings.ChannelUpdateInfo_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write + */ + public static Result_ChannelUpdateInfoDecodeErrorZ read(byte[] ser) { + long ret = bindings.ChannelUpdateInfo_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Confirm.java b/src/main/java/org/ldk/structs/Confirm.java index 485c486f..ba9d766d 100644 --- a/src/main/java/org/ldk/structs/Confirm.java +++ b/src/main/java/org/ldk/structs/Confirm.java @@ -121,15 +121,19 @@ public class Confirm extends CommonBase { txdata_conv_28_arr[c] = txdata_conv_28_hu_conv; } arg.transactions_confirmed(header, txdata_conv_28_arr, height); + Reference.reachabilityFence(arg); } @Override public void transaction_unconfirmed(byte[] txid) { arg.transaction_unconfirmed(txid); + Reference.reachabilityFence(arg); } @Override public void best_block_updated(byte[] header, int height) { arg.best_block_updated(header, height); + Reference.reachabilityFence(arg); } @Override public byte[][] get_relevant_txids() { byte[][] ret = arg.get_relevant_txids(); + Reference.reachabilityFence(arg); byte[][] result = ret != null ? Arrays.stream(ret).map(ret_conv_8 -> InternalUtils.check_arr_len(ret_conv_8, 32)).toArray(byte[][]::new) : null; return result; } diff --git a/src/main/java/org/ldk/structs/CounterpartyCommitmentSecrets.java b/src/main/java/org/ldk/structs/CounterpartyCommitmentSecrets.java new file mode 100644 index 00000000..98bf7cd3 --- /dev/null +++ b/src/main/java/org/ldk/structs/CounterpartyCommitmentSecrets.java @@ -0,0 +1,114 @@ +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; + + +/** + * Implements the per-commitment secret storage scheme from + * [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). + * + * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes + * or so. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class CounterpartyCommitmentSecrets extends CommonBase { + CounterpartyCommitmentSecrets(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.CounterpartyCommitmentSecrets_free(ptr); } + } + + long clone_ptr() { + long ret = bindings.CounterpartyCommitmentSecrets_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the CounterpartyCommitmentSecrets + */ + public CounterpartyCommitmentSecrets clone() { + long ret = bindings.CounterpartyCommitmentSecrets_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + CounterpartyCommitmentSecrets ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyCommitmentSecrets(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a new empty `CounterpartyCommitmentSecrets` structure. + */ + public static CounterpartyCommitmentSecrets of() { + long ret = bindings.CounterpartyCommitmentSecrets_new(); + if (ret >= 0 && ret <= 4096) { return null; } + CounterpartyCommitmentSecrets ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyCommitmentSecrets(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Returns the minimum index of all stored secrets. Note that indexes start + * at 1 << 48 and get decremented by one for each new secret. + */ + public long get_min_seen_secret() { + long ret = bindings.CounterpartyCommitmentSecrets_get_min_seen_secret(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret + * was generated in accordance with BOLT 3 and is consistent with previous secrets. + */ + public Result_NoneNoneZ provide_secret(long idx, byte[] secret) { + long ret = bindings.CounterpartyCommitmentSecrets_provide_secret(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; + } + + /** + * Returns the secret at `idx`. + * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public byte[] get_secret(long idx) { + byte[] ret = bindings.CounterpartyCommitmentSecrets_get_secret(this.ptr, idx); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); + return ret; + } + + /** + * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read + */ + public byte[] write() { + byte[] ret = bindings.CounterpartyCommitmentSecrets_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write + */ + public static Result_CounterpartyCommitmentSecretsDecodeErrorZ read(byte[] ser) { + long ret = bindings.CounterpartyCommitmentSecrets_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyCommitmentSecretsDecodeErrorZ ret_hu_conv = Result_CounterpartyCommitmentSecretsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java b/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java index e6a95f76..405a51a2 100644 --- a/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java +++ b/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java @@ -110,4 +110,24 @@ public class CounterpartyForwardingInfo extends CommonBase { return ret_hu_conv; } + /** + * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read + */ + public byte[] write() { + byte[] ret = bindings.CounterpartyForwardingInfo_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write + */ + public static Result_CounterpartyForwardingInfoDecodeErrorZ read(byte[] ser) { + long ret = bindings.CounterpartyForwardingInfo_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyForwardingInfoDecodeErrorZ ret_hu_conv = Result_CounterpartyForwardingInfoDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/CustomMessageHandler.java b/src/main/java/org/ldk/structs/CustomMessageHandler.java index ffc48876..03ac5c9c 100644 --- a/src/main/java/org/ldk/structs/CustomMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomMessageHandler.java @@ -47,11 +47,13 @@ public class CustomMessageHandler extends CommonBase { Type ret_hu_conv = new Type(null, msg); ret_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_custom_message(ret_hu_conv, sender_node_id); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long[] get_and_clear_pending_msg() { TwoTuple_PublicKeyTypeZ[] ret = arg.get_and_clear_pending_msg(); + Reference.reachabilityFence(arg); long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_25 -> ret_conv_25 == null ? 0 : ret_conv_25.clone_ptr()).toArray() : null; return result; } diff --git a/src/main/java/org/ldk/structs/CustomMessageReader.java b/src/main/java/org/ldk/structs/CustomMessageReader.java index 92378e08..954c92b7 100644 --- a/src/main/java/org/ldk/structs/CustomMessageReader.java +++ b/src/main/java/org/ldk/structs/CustomMessageReader.java @@ -40,6 +40,7 @@ public class CustomMessageReader extends CommonBase { impl_holder.held = new CustomMessageReader(new bindings.LDKCustomMessageReader() { @Override public long read(short message_type, byte[] buffer) { Result_COption_TypeZDecodeErrorZ ret = arg.read(message_type, buffer); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } diff --git a/src/main/java/org/ldk/structs/DirectedChannelInfo.java b/src/main/java/org/ldk/structs/DirectedChannelInfo.java new file mode 100644 index 00000000..5dea625f --- /dev/null +++ b/src/main/java/org/ldk/structs/DirectedChannelInfo.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; + + +/** + * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a + * source node to a target node. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class DirectedChannelInfo extends CommonBase { + DirectedChannelInfo(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.DirectedChannelInfo_free(ptr); } + } + + long clone_ptr() { + long ret = bindings.DirectedChannelInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the DirectedChannelInfo + */ + public DirectedChannelInfo clone() { + long ret = bindings.DirectedChannelInfo_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + DirectedChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectedChannelInfo(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Returns information for the channel. + */ + public ChannelInfo channel() { + long ret = bindings.DirectedChannelInfo_channel(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelInfo(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Returns information for the direction. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelUpdateInfo direction() { + long ret = bindings.DirectedChannelInfo_direction(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Returns the [`EffectiveCapacity`] of the channel in the direction. + * + * This is either the total capacity from the funding transaction, if known, or the + * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known, + * whichever is smaller. + */ + public EffectiveCapacity effective_capacity() { + long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java deleted file mode 100644 index 03093d27..00000000 --- a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java +++ /dev/null @@ -1,228 +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; - - -/** - * Details about one direction of a channel. Received - * within a channel update. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class DirectionalChannelInfo extends CommonBase { - DirectionalChannelInfo(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.DirectionalChannelInfo_free(ptr); } - } - - /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. - */ - public int get_last_update() { - int ret = bindings.DirectionalChannelInfo_get_last_update(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. - */ - public void set_last_update(int val) { - bindings.DirectionalChannelInfo_set_last_update(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Whether the channel can be currently used for payments (in this one direction). - */ - public boolean get_enabled() { - boolean ret = bindings.DirectionalChannelInfo_get_enabled(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Whether the channel can be currently used for payments (in this one direction). - */ - public void set_enabled(boolean val) { - bindings.DirectionalChannelInfo_set_enabled(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * The difference in CLTV values that you must have when routing through this channel. - */ - public short get_cltv_expiry_delta() { - short ret = bindings.DirectionalChannelInfo_get_cltv_expiry_delta(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * The difference in CLTV values that you must have when routing through this channel. - */ - public void set_cltv_expiry_delta(short val) { - bindings.DirectionalChannelInfo_set_cltv_expiry_delta(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * The minimum value, which must be relayed to the next hop via the channel - */ - public long get_htlc_minimum_msat() { - long ret = bindings.DirectionalChannelInfo_get_htlc_minimum_msat(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * The minimum value, which must be relayed to the next hop via the channel - */ - public void set_htlc_minimum_msat(long val) { - bindings.DirectionalChannelInfo_set_htlc_minimum_msat(this.ptr, val); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * The maximum value which may be relayed to the next hop via the channel. - */ - public Option_u64Z get_htlc_maximum_msat() { - long ret = bindings.DirectionalChannelInfo_get_htlc_maximum_msat(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * The maximum value which may be relayed to the next hop via the channel. - */ - public void set_htlc_maximum_msat(Option_u64Z val) { - bindings.DirectionalChannelInfo_set_htlc_maximum_msat(this.ptr, val.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Fees charged when the channel is used for routing - */ - public RoutingFees get_fees() { - long ret = bindings.DirectionalChannelInfo_get_fees(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Fees charged when the channel is used for routing - */ - public void set_fees(RoutingFees val) { - bindings.DirectionalChannelInfo_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - @Nullable - public ChannelUpdate get_last_update_message() { - long ret = bindings.DirectionalChannelInfo_get_last_update_message(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - public void set_last_update_message(@Nullable ChannelUpdate val) { - bindings.DirectionalChannelInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr & ~1); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Constructs a new DirectionalChannelInfo given each field - */ - public static DirectionalChannelInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) { - long ret = bindings.DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg.ptr, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1); - Reference.reachabilityFence(last_update_arg); - Reference.reachabilityFence(enabled_arg); - Reference.reachabilityFence(cltv_expiry_delta_arg); - Reference.reachabilityFence(htlc_minimum_msat_arg); - Reference.reachabilityFence(htlc_maximum_msat_arg); - Reference.reachabilityFence(fees_arg); - Reference.reachabilityFence(last_update_message_arg); - if (ret >= 0 && ret <= 4096) { return null; } - DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - long clone_ptr() { - long ret = bindings.DirectionalChannelInfo_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a copy of the DirectionalChannelInfo - */ - public DirectionalChannelInfo clone() { - long ret = bindings.DirectionalChannelInfo_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read - */ - public byte[] write() { - byte[] ret = bindings.DirectionalChannelInfo_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write - */ - public static Result_DirectionalChannelInfoDecodeErrorZ read(byte[] ser) { - long ret = bindings.DirectionalChannelInfo_read(ser); - Reference.reachabilityFence(ser); - if (ret >= 0 && ret <= 4096) { return null; } - Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/EffectiveCapacity.java b/src/main/java/org/ldk/structs/EffectiveCapacity.java new file mode 100644 index 00000000..777c3b66 --- /dev/null +++ b/src/main/java/org/ldk/structs/EffectiveCapacity.java @@ -0,0 +1,189 @@ +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 effective capacity of a channel for routing purposes. + * + * While this may be smaller than the actual channel capacity, amounts greater than + * [`Self::as_msat`] should not be routed through the channel. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class EffectiveCapacity extends CommonBase { + private EffectiveCapacity(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.EffectiveCapacity_free(ptr); } + } + static EffectiveCapacity constr_from_ptr(long ptr) { + bindings.LDKEffectiveCapacity raw_val = bindings.LDKEffectiveCapacity_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.ExactLiquidity.class) { + return new ExactLiquidity(ptr, (bindings.LDKEffectiveCapacity.ExactLiquidity)raw_val); + } + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.MaximumHTLC.class) { + return new MaximumHTLC(ptr, (bindings.LDKEffectiveCapacity.MaximumHTLC)raw_val); + } + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.Total.class) { + return new Total(ptr, (bindings.LDKEffectiveCapacity.Total)raw_val); + } + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.Infinite.class) { + return new Infinite(ptr, (bindings.LDKEffectiveCapacity.Infinite)raw_val); + } + if (raw_val.getClass() == bindings.LDKEffectiveCapacity.Unknown.class) { + return new Unknown(ptr, (bindings.LDKEffectiveCapacity.Unknown)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * The available liquidity in the channel known from being a channel counterparty, and thus a + * direct hop. + */ + public final static class ExactLiquidity extends EffectiveCapacity { + /** + * Either the inbound or outbound liquidity depending on the direction, denominated in + * millisatoshi. + */ + public final long liquidity_msat; + private ExactLiquidity(long ptr, bindings.LDKEffectiveCapacity.ExactLiquidity obj) { + super(null, ptr); + this.liquidity_msat = obj.liquidity_msat; + } + } + /** + * The maximum HTLC amount in one direction as advertised on the gossip network. + */ + public final static class MaximumHTLC extends EffectiveCapacity { + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + public final long amount_msat; + private MaximumHTLC(long ptr, bindings.LDKEffectiveCapacity.MaximumHTLC obj) { + super(null, ptr); + this.amount_msat = obj.amount_msat; + } + } + /** + * The total capacity of the channel as determined by the funding transaction. + */ + public final static class Total extends EffectiveCapacity { + /** + * The funding amount denominated in millisatoshi. + */ + public final long capacity_msat; + private Total(long ptr, bindings.LDKEffectiveCapacity.Total obj) { + super(null, ptr); + this.capacity_msat = obj.capacity_msat; + } + } + /** + * A capacity sufficient to route any payment, typically used for private channels provided by + * an invoice. + */ + public final static class Infinite extends EffectiveCapacity { + private Infinite(long ptr, bindings.LDKEffectiveCapacity.Infinite obj) { + super(null, ptr); + } + } + /** + * A capacity that is unknown possibly because either the chain state is unavailable to know + * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network. + */ + public final static class Unknown extends EffectiveCapacity { + private Unknown(long ptr, bindings.LDKEffectiveCapacity.Unknown obj) { + super(null, ptr); + } + } + long clone_ptr() { + long ret = bindings.EffectiveCapacity_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the EffectiveCapacity + */ + public EffectiveCapacity clone() { + long ret = bindings.EffectiveCapacity_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity + */ + public static EffectiveCapacity exact_liquidity(long liquidity_msat) { + long ret = bindings.EffectiveCapacity_exact_liquidity(liquidity_msat); + Reference.reachabilityFence(liquidity_msat); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity + */ + public static EffectiveCapacity maximum_htlc(long amount_msat) { + long ret = bindings.EffectiveCapacity_maximum_htlc(amount_msat); + Reference.reachabilityFence(amount_msat); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Total-variant EffectiveCapacity + */ + public static EffectiveCapacity total(long capacity_msat) { + long ret = bindings.EffectiveCapacity_total(capacity_msat); + Reference.reachabilityFence(capacity_msat); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Infinite-variant EffectiveCapacity + */ + public static EffectiveCapacity infinite() { + long ret = bindings.EffectiveCapacity_infinite(); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Unknown-variant EffectiveCapacity + */ + public static EffectiveCapacity unknown() { + long ret = bindings.EffectiveCapacity_unknown(); + if (ret >= 0 && ret <= 4096) { return null; } + EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Returns the effective capacity denominated in millisatoshi. + */ + public long as_msat() { + long ret = bindings.EffectiveCapacity_as_msat(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 b7e592dd..bb9b7e44 100644 --- a/src/main/java/org/ldk/structs/ErrorAction.java +++ b/src/main/java/org/ldk/structs/ErrorAction.java @@ -36,6 +36,9 @@ public class ErrorAction extends CommonBase { if (raw_val.getClass() == bindings.LDKErrorAction.SendErrorMessage.class) { return new SendErrorMessage(ptr, (bindings.LDKErrorAction.SendErrorMessage)raw_val); } + if (raw_val.getClass() == bindings.LDKErrorAction.SendWarningMessage.class) { + return new SendWarningMessage(ptr, (bindings.LDKErrorAction.SendWarningMessage)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -102,6 +105,29 @@ public class ErrorAction extends CommonBase { this.msg = msg_hu_conv; } } + /** + * The peer did something incorrect. Tell them without closing any channels. + */ + public final static class SendWarningMessage extends ErrorAction { + /** + * The message to send. + */ + public final WarningMessage msg; + /** + * The peer may have done something harmless that we weren't able to meaningfully process, + * though we should still tell them about it. + * If this event is logged, log it at the given level. + */ + public final Level log_level; + private SendWarningMessage(long ptr, bindings.LDKErrorAction.SendWarningMessage obj) { + super(null, ptr); + long msg = obj.msg; + WarningMessage msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new WarningMessage(null, msg); } + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + this.log_level = obj.log_level; + } + } long clone_ptr() { long ret = bindings.ErrorAction_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -178,4 +204,17 @@ public class ErrorAction extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new SendWarningMessage-variant ErrorAction + */ + public static ErrorAction send_warning_message(WarningMessage msg, org.ldk.enums.Level log_level) { + long ret = bindings.ErrorAction_send_warning_message(msg == null ? 0 : msg.ptr & ~1, log_level); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(log_level); + if (ret >= 0 && ret <= 4096) { return null; } + ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/ErrorMessage.java b/src/main/java/org/ldk/structs/ErrorMessage.java index 9199d7fd..22bbb8c4 100644 --- a/src/main/java/org/ldk/structs/ErrorMessage.java +++ b/src/main/java/org/ldk/structs/ErrorMessage.java @@ -21,7 +21,10 @@ public class ErrorMessage extends CommonBase { } /** - * The channel ID involved in the error + * The channel ID involved in the error. + * + * All-0s indicates a general error unrelated to a specific channel, after which all channels + * with the sending peer should be closed. */ public byte[] get_channel_id() { byte[] ret = bindings.ErrorMessage_get_channel_id(this.ptr); @@ -30,7 +33,10 @@ public class ErrorMessage extends CommonBase { } /** - * The channel ID involved in the error + * The channel ID involved in the error. + * + * All-0s indicates a general error unrelated to a specific channel, after which all channels + * with the sending peer should be closed. */ public void set_channel_id(byte[] val) { bindings.ErrorMessage_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); @@ -40,9 +46,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 terminal emulator or the logging subsystem. + * 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() { String ret = bindings.ErrorMessage_get_data(this.ptr); @@ -52,9 +58,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 terminal emulator or the logging subsystem. + * 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) { bindings.ErrorMessage_set_data(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/Event.java b/src/main/java/org/ldk/structs/Event.java index df53a511..149e1a1d 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -58,6 +58,9 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) { return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) { + return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -202,7 +205,7 @@ public class Event extends CommonBase { * Note that this does *not* indicate that all paths for an MPP payment have failed, see * [`Event::PaymentFailed`] and [`all_paths_failed`]. * - * [`all_paths_failed`]: Self::all_paths_failed + * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed */ public final static class PaymentPathFailed extends Event { /** @@ -518,6 +521,51 @@ public class Event extends CommonBase { this.path = path_conv_10_arr; } } + /** + * Indicates a request to open a new channel by a peer. + * + * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the + * request, call [`ChannelManager::force_close_channel`]. + * + * The event is only triggered when a new open channel request is received and the + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + public final static class OpenChannelRequest extends Event { + /** + * The temporary channel ID of the channel requested to be opened. + * + * When responding to the request, the `temporary_channel_id` should be passed + * back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept, + * or to [`ChannelManager::force_close_channel`] to reject. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel + */ + public final byte[] temporary_channel_id; + /** + * The node_id of the counterparty requesting to open the channel. + */ + public final byte[] counterparty_node_id; + /** + * The channel value of the requested channel. + */ + public final long funding_satoshis; + /** + * Our starting balance in the channel if the request is accepted, in milli-satoshi. + */ + public final long push_msat; + private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) { + super(null, ptr); + this.temporary_channel_id = obj.temporary_channel_id; + this.counterparty_node_id = obj.counterparty_node_id; + this.funding_satoshis = obj.funding_satoshis; + this.push_msat = obj.push_msat; + } + } long clone_ptr() { long ret = bindings.Event_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -690,6 +738,21 @@ public class Event extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new OpenChannelRequest-variant Event + */ + public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat) { + long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat); + Reference.reachabilityFence(temporary_channel_id); + Reference.reachabilityFence(counterparty_node_id); + Reference.reachabilityFence(funding_satoshis); + Reference.reachabilityFence(push_msat); + if (ret >= 0 && ret <= 4096) { return null; } + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + /** * Serialize the Event object into a byte array which can be read by Event_read */ diff --git a/src/main/java/org/ldk/structs/EventHandler.java b/src/main/java/org/ldk/structs/EventHandler.java index 99a4e5f4..2de4e0c0 100644 --- a/src/main/java/org/ldk/structs/EventHandler.java +++ b/src/main/java/org/ldk/structs/EventHandler.java @@ -39,6 +39,7 @@ public class EventHandler extends CommonBase { @Override public void handle_event(long event) { Event event_hu_conv = Event.constr_from_ptr(event); arg.handle_event(event_hu_conv); + Reference.reachabilityFence(arg); } }); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java index 0422859b..a75370c7 100644 --- a/src/main/java/org/ldk/structs/EventsProvider.java +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -65,6 +65,7 @@ public class EventsProvider extends CommonBase { EventHandler ret_hu_conv = new EventHandler(null, handler); ret_hu_conv.ptrs_to.add(this); arg.process_pending_events(ret_hu_conv); + Reference.reachabilityFence(arg); } }); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/ExpiryTime.java b/src/main/java/org/ldk/structs/ExpiryTime.java index ecb2d4c9..07601ecc 100644 --- a/src/main/java/org/ldk/structs/ExpiryTime.java +++ b/src/main/java/org/ldk/structs/ExpiryTime.java @@ -11,11 +11,6 @@ import javax.annotation.Nullable; /** * Positive duration that defines when (relatively to the timestamp) in the future the invoice * expires - * - * # Invariants - * The number of seconds this expiry time represents has to be in the range - * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a - * timestamp */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ExpiryTime extends CommonBase { @@ -74,28 +69,26 @@ public class ExpiryTime extends CommonBase { return this.eq((ExpiryTime)o); } /** - * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would - * overflow on adding the `EpiryTime` to it then this function will return a - * `CreationError::ExpiryTimeOutOfBounds`. + * Construct an `ExpiryTime` from seconds. */ - public static Result_ExpiryTimeCreationErrorZ from_seconds(long seconds) { + public static ExpiryTime from_seconds(long seconds) { long ret = bindings.ExpiryTime_from_seconds(seconds); Reference.reachabilityFence(seconds); if (ret >= 0 && ret <= 4096) { return null; } - Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); + ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ExpiryTime(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } /** - * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which - * would overflow on adding the `EpiryTime` to it then this function will return a - * `CreationError::ExpiryTimeOutOfBounds`. + * Construct an `ExpiryTime` from a `Duration`. */ - public static Result_ExpiryTimeCreationErrorZ from_duration(long duration) { + public static ExpiryTime from_duration(long duration) { long ret = bindings.ExpiryTime_from_duration(duration); Reference.reachabilityFence(duration); if (ret >= 0 && ret <= 4096) { return null; } - Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); + ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ExpiryTime(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/FeeEstimator.java b/src/main/java/org/ldk/structs/FeeEstimator.java index 675ae698..e8e14de5 100644 --- a/src/main/java/org/ldk/structs/FeeEstimator.java +++ b/src/main/java/org/ldk/structs/FeeEstimator.java @@ -47,6 +47,7 @@ public class FeeEstimator extends CommonBase { impl_holder.held = new FeeEstimator(new bindings.LDKFeeEstimator() { @Override public int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target) { int ret = arg.get_est_sat_per_1000_weight(confirmation_target); + Reference.reachabilityFence(arg); return ret; } }); diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index 5503b797..340da1b9 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -68,11 +68,13 @@ public class Filter extends CommonBase { impl_holder.held = new Filter(new bindings.LDKFilter() { @Override public void register_tx(byte[] txid, byte[] script_pubkey) { arg.register_tx(txid, script_pubkey); + Reference.reachabilityFence(arg); } @Override public long register_output(long output) { WatchedOutput output_hu_conv = null; if (output < 0 || output > 4096) { output_hu_conv = new WatchedOutput(null, output); } output_hu_conv.ptrs_to.add(this); Option_C2Tuple_usizeTransactionZZ ret = arg.register_output(output_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } diff --git a/src/main/java/org/ldk/structs/FixedPenaltyScorer.java b/src/main/java/org/ldk/structs/FixedPenaltyScorer.java new file mode 100644 index 00000000..ca8b6acb --- /dev/null +++ b/src/main/java/org/ldk/structs/FixedPenaltyScorer.java @@ -0,0 +1,86 @@ +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; + + +/** + * [`Score`] implementation that uses a fixed penalty. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class FixedPenaltyScorer extends CommonBase { + FixedPenaltyScorer(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.FixedPenaltyScorer_free(ptr); } + } + + long clone_ptr() { + long ret = bindings.FixedPenaltyScorer_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the FixedPenaltyScorer + */ + public FixedPenaltyScorer clone() { + long ret = bindings.FixedPenaltyScorer_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FixedPenaltyScorer(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read + */ + public byte[] write() { + byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write + */ + public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser) { + long ret = bindings.FixedPenaltyScorer_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new scorer using `penalty_msat`. + */ + public static FixedPenaltyScorer with_penalty(long penalty_msat) { + long ret = bindings.FixedPenaltyScorer_with_penalty(penalty_msat); + Reference.reachabilityFence(penalty_msat); + if (ret >= 0 && ret <= 4096) { return null; } + FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FixedPenaltyScorer(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Constructs a new Score which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is + */ + public Score as_Score() { + long ret = bindings.FixedPenaltyScorer_as_Score(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Score ret_hu_conv = new Score(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/InMemorySigner.java b/src/main/java/org/ldk/structs/InMemorySigner.java index 031985ff..f166a47e 100644 --- a/src/main/java/org/ldk/structs/InMemorySigner.java +++ b/src/main/java/org/ldk/structs/InMemorySigner.java @@ -152,8 +152,9 @@ public class InMemorySigner extends CommonBase { /** * Create a new InMemorySigner */ - 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)); + 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); Reference.reachabilityFence(funding_key); Reference.reachabilityFence(revocation_base_key); Reference.reachabilityFence(payment_key); @@ -258,7 +259,8 @@ public class InMemorySigner extends CommonBase { * described by descriptor, returning the witness stack for the input. * * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * or is not spending the outpoint described by `descriptor.outpoint`. + * is not spending the outpoint described by `descriptor.outpoint`, + * or if an output descriptor script_pubkey does not match the one we can spend. */ public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, StaticPaymentOutputDescriptor descriptor) { long ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); @@ -277,8 +279,9 @@ public class InMemorySigner extends CommonBase { * described by descriptor, returning the witness stack for the input. * * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * is not spending the outpoint described by `descriptor.outpoint`, or does not have a - * sequence set to `descriptor.to_self_delay`. + * is not spending the outpoint described by `descriptor.outpoint`, does not have a + * sequence set to `descriptor.to_self_delay`, or if an output descriptor + * script_pubkey does not match the one we can spend. */ public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, DelayedPaymentOutputDescriptor descriptor) { long ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); @@ -330,9 +333,10 @@ public class InMemorySigner extends CommonBase { /** * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ - public static Result_InMemorySignerDecodeErrorZ read(byte[] ser) { - long ret = bindings.InMemorySigner_read(ser); + public static Result_InMemorySignerDecodeErrorZ read(byte[] ser, byte[] arg) { + long ret = bindings.InMemorySigner_read(ser, InternalUtils.check_arr_len(arg, 32)); 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/Invoice.java b/src/main/java/org/ldk/structs/Invoice.java index 80a987eb..e46ac174 100644 --- a/src/main/java/org/ldk/structs/Invoice.java +++ b/src/main/java/org/ldk/structs/Invoice.java @@ -115,7 +115,7 @@ public class Invoice extends CommonBase { } /** - * Returns the `Invoice`'s timestamp (should equal it's creation time) + * Returns the `Invoice`'s timestamp (should equal its creation time) */ public long timestamp() { long ret = bindings.Invoice_timestamp(this.ptr); @@ -123,6 +123,15 @@ public class Invoice extends CommonBase { return ret; } + /** + * Returns the `Invoice`'s timestamp as a duration since the Unix epoch + */ + public long duration_since_epoch() { + long ret = bindings.Invoice_duration_since_epoch(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Returns the hash to which we will receive the preimage on completion of the payment */ @@ -195,6 +204,17 @@ public class Invoice extends CommonBase { return ret; } + /** + * Returns whether the expiry time would pass at the given point in time. + * `at_time` is the timestamp as a duration since the Unix epoch. + */ + public boolean would_expire(long at_time) { + boolean ret = bindings.Invoice_would_expire(this.ptr, at_time); + Reference.reachabilityFence(this); + Reference.reachabilityFence(at_time); + return ret; + } + /** * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`]. diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java index f9d70fce..4fcc6010 100644 --- a/src/main/java/org/ldk/structs/KeysInterface.java +++ b/src/main/java/org/ldk/structs/KeysInterface.java @@ -26,11 +26,12 @@ public class KeysInterface extends CommonBase { public static interface KeysInterfaceInterface { /** - * Get node secret key (aka node_id or network_key). + * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`]. * - * This method must return the same value each time it is called. + * This method must return the same value each time it is called with a given `Recipient` + * parameter. */ - byte[] get_node_secret(); + Result_SecretKeyNoneZ get_node_secret(Recipient recipient); /** * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. * @@ -70,16 +71,25 @@ public class KeysInterface extends CommonBase { */ Result_SignDecodeErrorZ read_chan_signer(byte[] reader); /** - * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's - * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of + * 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. + * + * The secret key used to sign the invoice is dependent on the [`Recipient`]. */ - Result_RecoverableSignatureNoneZ sign_invoice(byte[] invoice_preimage); + 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(); } @@ -87,43 +97,58 @@ public class KeysInterface extends CommonBase { public static KeysInterface new_impl(KeysInterfaceInterface arg) { final LDKKeysInterfaceHolder impl_holder = new LDKKeysInterfaceHolder(); impl_holder.held = new KeysInterface(new bindings.LDKKeysInterface() { - @Override public byte[] get_node_secret() { - byte[] ret = arg.get_node_secret(); - byte[] result = InternalUtils.check_arr_len(ret, 32); + @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 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 long get_channel_signer(boolean inbound, long channel_value_satoshis) { Sign ret = arg.get_channel_signer(inbound, channel_value_satoshis); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); 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[] invoice_preimage) { - Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(invoice_preimage); + @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; } @@ -131,14 +156,18 @@ public class KeysInterface extends CommonBase { return impl_holder.held; } /** - * Get node secret key (aka node_id or network_key). + * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`]. * - * This method must return the same value each time it is called. + * This method must return the same value each time it is called with a given `Recipient` + * parameter. */ - public byte[] get_node_secret() { - byte[] ret = bindings.KeysInterface_get_node_secret(this.ptr); + public Result_SecretKeyNoneZ get_node_secret(org.ldk.enums.Recipient recipient) { + long ret = bindings.KeysInterface_get_node_secret(this.ptr, recipient); Reference.reachabilityFence(this); - return ret; + 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; } /** @@ -216,15 +245,20 @@ public class KeysInterface extends CommonBase { } /** - * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's - * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of + * 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. + * + * The secret key used to sign the invoice is dependent on the [`Recipient`]. */ - public Result_RecoverableSignatureNoneZ sign_invoice(byte[] invoice_preimage) { - long ret = bindings.KeysInterface_sign_invoice(this.ptr, invoice_preimage); + 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(invoice_preimage); + 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; @@ -233,7 +267,13 @@ public class KeysInterface extends CommonBase { /** * 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); diff --git a/src/main/java/org/ldk/structs/KeysManager.java b/src/main/java/org/ldk/structs/KeysManager.java index 0876219e..cb09143e 100644 --- a/src/main/java/org/ldk/structs/KeysManager.java +++ b/src/main/java/org/ldk/structs/KeysManager.java @@ -16,6 +16,12 @@ import javax.annotation.Nullable; * ChannelMonitor closes may use seed/1' * Cooperative closes may use seed/2' * The two close keys may be needed to claim on-chain funds! + * + * This struct cannot be used for nodes that wish to support receiving phantom payments; + * [`PhantomKeysManager`] must be used instead. + * + * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any + * previously issued invoices and attempts to pay previous invoices will fail. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class KeysManager extends CommonBase { @@ -81,8 +87,9 @@ public class KeysManager extends CommonBase { * output to the given change destination (if sufficient change value remains). The * transaction will have a feerate, at least, of the given value. * - * Returns `Err(())` if the output value is greater than the input value minus required fee or - * if a descriptor was duplicated. + * Returns `Err(())` if the output value is greater than the input value minus required fee, + * if a descriptor was duplicated, or if an output descriptor `script_pubkey` + * does not match the one we can spend. * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. * diff --git a/src/main/java/org/ldk/structs/Listen.java b/src/main/java/org/ldk/structs/Listen.java index 93c1fc22..8d597217 100644 --- a/src/main/java/org/ldk/structs/Listen.java +++ b/src/main/java/org/ldk/structs/Listen.java @@ -46,9 +46,11 @@ public class Listen extends CommonBase { impl_holder.held = new Listen(new bindings.LDKListen() { @Override public void block_connected(byte[] block, int height) { arg.block_connected(block, height); + Reference.reachabilityFence(arg); } @Override public void block_disconnected(byte[] header, int height) { arg.block_disconnected(header, height); + Reference.reachabilityFence(arg); } }); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/LockableScore.java b/src/main/java/org/ldk/structs/LockableScore.java index 7716950a..30ba6409 100644 --- a/src/main/java/org/ldk/structs/LockableScore.java +++ b/src/main/java/org/ldk/structs/LockableScore.java @@ -43,6 +43,7 @@ public class LockableScore extends CommonBase { impl_holder.held = new LockableScore(new bindings.LDKLockableScore() { @Override public long lock() { Score ret = arg.lock(); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.ptr; impl_holder.held.ptrs_to.add(ret); return result; diff --git a/src/main/java/org/ldk/structs/Logger.java b/src/main/java/org/ldk/structs/Logger.java index f6da457b..04b6d020 100644 --- a/src/main/java/org/ldk/structs/Logger.java +++ b/src/main/java/org/ldk/structs/Logger.java @@ -37,6 +37,7 @@ public class Logger extends CommonBase { @Override public void log(long record) { Record record_hu_conv = null; if (record < 0 || record > 4096) { record_hu_conv = new Record(null, record); } arg.log(record_hu_conv); + Reference.reachabilityFence(arg); } }); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java index 8458b522..046acfed 100644 --- a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -37,6 +37,7 @@ public class MessageSendEventsProvider extends CommonBase { impl_holder.held = new MessageSendEventsProvider(new bindings.LDKMessageSendEventsProvider() { @Override public long[] get_and_clear_pending_msg_events() { 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; return result; } diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index e2f17ce1..5159d8ae 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -181,6 +181,26 @@ public class NetworkGraph extends CommonBase { Reference.reachabilityFence(is_permanent); } + /** + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. + * + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. + * + * Note that for users of the `lightning-background-processor` crate this method may be + * automatically called regularly for you. + * + * This method is only available with the `std` feature. See + * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use. + */ + public void remove_stale_channels() { + bindings.NetworkGraph_remove_stale_channels(this.ptr); + Reference.reachabilityFence(this); + } + /** * Removes information about channels that we haven't heard any updates about in some time. * This can be used regularly to prune the network graph of channels that likely no longer diff --git a/src/main/java/org/ldk/structs/Payee.java b/src/main/java/org/ldk/structs/Payee.java deleted file mode 100644 index 988de3ee..00000000 --- a/src/main/java/org/ldk/structs/Payee.java +++ /dev/null @@ -1,230 +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 recipient of a payment. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Payee extends CommonBase { - Payee(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.Payee_free(ptr); } - } - - /** - * The node id of the payee. - */ - public byte[] get_pubkey() { - byte[] ret = bindings.Payee_get_pubkey(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * The node id of the payee. - */ - public void set_pubkey(byte[] val) { - bindings.Payee_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Features supported by the payee. - * - * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice - * does not contain any features. - * - * [`for_keysend`]: Self::for_keysend - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - @Nullable - public InvoiceFeatures get_features() { - long ret = bindings.Payee_get_features(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Features supported by the payee. - * - * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice - * does not contain any features. - * - * [`for_keysend`]: Self::for_keysend - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - public void set_features(@Nullable InvoiceFeatures val) { - bindings.Payee_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Hints for routing to the payee, containing channels connecting the payee to public nodes. - */ - public RouteHint[] get_route_hints() { - long[] ret = bindings.Payee_get_route_hints(this.ptr); - Reference.reachabilityFence(this); - int ret_conv_11_len = ret.length; - RouteHint[] ret_conv_11_arr = new RouteHint[ret_conv_11_len]; - for (int l = 0; l < ret_conv_11_len; l++) { - long ret_conv_11 = ret[l]; - RouteHint ret_conv_11_hu_conv = null; if (ret_conv_11 < 0 || ret_conv_11 > 4096) { ret_conv_11_hu_conv = new RouteHint(null, ret_conv_11); } - ret_conv_11_hu_conv.ptrs_to.add(this); - ret_conv_11_arr[l] = ret_conv_11_hu_conv; - } - return ret_conv_11_arr; - } - - /** - * Hints for routing to the payee, containing channels connecting the payee to public nodes. - */ - public void set_route_hints(RouteHint[] val) { - bindings.Payee_set_route_hints(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_11 -> val_conv_11 == null ? 0 : val_conv_11.ptr & ~1).toArray() : null); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. - */ - public Option_u64Z get_expiry_time() { - long ret = bindings.Payee_get_expiry_time(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. - */ - public void set_expiry_time(Option_u64Z val) { - bindings.Payee_set_expiry_time(this.ptr, val.ptr); - Reference.reachabilityFence(this); - Reference.reachabilityFence(val); - } - - /** - * Constructs a new Payee given each field - */ - public static Payee of(byte[] pubkey_arg, InvoiceFeatures features_arg, RouteHint[] route_hints_arg, Option_u64Z expiry_time_arg) { - long ret = bindings.Payee_new(InternalUtils.check_arr_len(pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, route_hints_arg != null ? Arrays.stream(route_hints_arg).mapToLong(route_hints_arg_conv_11 -> route_hints_arg_conv_11 == null ? 0 : route_hints_arg_conv_11.ptr & ~1).toArray() : null, expiry_time_arg.ptr); - Reference.reachabilityFence(pubkey_arg); - Reference.reachabilityFence(features_arg); - Reference.reachabilityFence(route_hints_arg); - Reference.reachabilityFence(expiry_time_arg); - if (ret >= 0 && ret <= 4096) { return null; } - Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - long clone_ptr() { - long ret = bindings.Payee_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a copy of the Payee - */ - public Payee clone() { - long ret = bindings.Payee_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Checks if two Payees contain equal inner contents. - */ - public long hash() { - long ret = bindings.Payee_hash(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - @Override public int hashCode() { - return (int)this.hash(); - } - /** - * Checks if two Payees 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(Payee b) { - boolean ret = bindings.Payee_eq(this.ptr, b == null ? 0 : b.ptr & ~1); - Reference.reachabilityFence(this); - Reference.reachabilityFence(b); - this.ptrs_to.add(b); - return ret; - } - - @Override public boolean equals(Object o) { - if (!(o instanceof Payee)) return false; - return this.eq((Payee)o); - } - /** - * Serialize the Payee object into a byte array which can be read by Payee_read - */ - public byte[] write() { - byte[] ret = bindings.Payee_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Read a Payee from a byte array, created by Payee_write - */ - public static Result_PayeeDecodeErrorZ read(byte[] ser) { - long ret = bindings.Payee_read(ser); - Reference.reachabilityFence(ser); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a payee with the node id of the given `pubkey`. - */ - public static Payee from_node_id(byte[] pubkey) { - long ret = bindings.Payee_from_node_id(InternalUtils.check_arr_len(pubkey, 33)); - Reference.reachabilityFence(pubkey); - if (ret >= 0 && ret <= 4096) { return null; } - Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - /** - * Creates a payee with the node id of the given `pubkey` to use for keysend payments. - */ - public static Payee for_keysend(byte[] pubkey) { - long ret = bindings.Payee_for_keysend(InternalUtils.check_arr_len(pubkey, 33)); - Reference.reachabilityFence(pubkey); - if (ret >= 0 && ret <= 4096) { return null; } - Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Payer.java b/src/main/java/org/ldk/structs/Payer.java index 5d459062..e34ad9d2 100644 --- a/src/main/java/org/ldk/structs/Payer.java +++ b/src/main/java/org/ldk/structs/Payer.java @@ -58,34 +58,40 @@ public class Payer extends CommonBase { 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) { Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new Route(null, route); } Result_PaymentIdPaymentSendFailureZ ret = arg.send_payment(route_hu_conv, payment_hash, payment_secret); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long send_spontaneous_payment(long route, byte[] payment_preimage) { Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new Route(null, route); } Result_PaymentIdPaymentSendFailureZ ret = arg.send_spontaneous_payment(route_hu_conv, payment_preimage); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long retry_payment(long route, byte[] payment_id) { Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new 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); } }); return impl_holder.held; diff --git a/src/main/java/org/ldk/structs/PaymentParameters.java b/src/main/java/org/ldk/structs/PaymentParameters.java new file mode 100644 index 00000000..91e78d6f --- /dev/null +++ b/src/main/java/org/ldk/structs/PaymentParameters.java @@ -0,0 +1,249 @@ +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 recipient of a payment. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PaymentParameters extends CommonBase { + PaymentParameters(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PaymentParameters_free(ptr); } + } + + /** + * The node id of the payee. + */ + public byte[] get_payee_pubkey() { + byte[] ret = bindings.PaymentParameters_get_payee_pubkey(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The node id of the payee. + */ + public void set_payee_pubkey(byte[] val) { + bindings.PaymentParameters_set_payee_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: Self::for_keysend + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public InvoiceFeatures get_features() { + long ret = bindings.PaymentParameters_get_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: Self::for_keysend + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_features(@Nullable InvoiceFeatures val) { + bindings.PaymentParameters_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Hints for routing to the payee, containing channels connecting the payee to public nodes. + */ + public RouteHint[] get_route_hints() { + long[] ret = bindings.PaymentParameters_get_route_hints(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_11_len = ret.length; + RouteHint[] ret_conv_11_arr = new RouteHint[ret_conv_11_len]; + for (int l = 0; l < ret_conv_11_len; l++) { + long ret_conv_11 = ret[l]; + RouteHint ret_conv_11_hu_conv = null; if (ret_conv_11 < 0 || ret_conv_11 > 4096) { ret_conv_11_hu_conv = new RouteHint(null, ret_conv_11); } + ret_conv_11_hu_conv.ptrs_to.add(this); + ret_conv_11_arr[l] = ret_conv_11_hu_conv; + } + return ret_conv_11_arr; + } + + /** + * Hints for routing to the payee, containing channels connecting the payee to public nodes. + */ + public void set_route_hints(RouteHint[] val) { + bindings.PaymentParameters_set_route_hints(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_11 -> val_conv_11 == null ? 0 : val_conv_11.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + */ + public Option_u64Z get_expiry_time() { + long ret = bindings.PaymentParameters_get_expiry_time(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + */ + public void set_expiry_time(Option_u64Z val) { + bindings.PaymentParameters_set_expiry_time(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The maximum total CLTV delta we accept for the route. + */ + public int get_max_total_cltv_expiry_delta() { + int ret = bindings.PaymentParameters_get_max_total_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The maximum total CLTV delta we accept for the route. + */ + public void set_max_total_cltv_expiry_delta(int val) { + bindings.PaymentParameters_set_max_total_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, InvoiceFeatures features_arg, RouteHint[] route_hints_arg, Option_u64Z expiry_time_arg, int max_total_cltv_expiry_delta_arg) { + long ret = bindings.PaymentParameters_new(InternalUtils.check_arr_len(payee_pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, route_hints_arg != null ? Arrays.stream(route_hints_arg).mapToLong(route_hints_arg_conv_11 -> route_hints_arg_conv_11 == null ? 0 : route_hints_arg_conv_11.ptr & ~1).toArray() : null, expiry_time_arg.ptr, max_total_cltv_expiry_delta_arg); + Reference.reachabilityFence(payee_pubkey_arg); + Reference.reachabilityFence(features_arg); + Reference.reachabilityFence(route_hints_arg); + Reference.reachabilityFence(expiry_time_arg); + Reference.reachabilityFence(max_total_cltv_expiry_delta_arg); + if (ret >= 0 && ret <= 4096) { return null; } + PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PaymentParameters(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.PaymentParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the PaymentParameters + */ + public PaymentParameters clone() { + long ret = bindings.PaymentParameters_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PaymentParameters(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Checks if two PaymentParameterss contain equal inner contents. + */ + public long hash() { + long ret = bindings.PaymentParameters_hash(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + @Override public int hashCode() { + return (int)this.hash(); + } + /** + * Checks if two PaymentParameterss 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(PaymentParameters b) { + boolean ret = bindings.PaymentParameters_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + this.ptrs_to.add(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof PaymentParameters)) return false; + return this.eq((PaymentParameters)o); + } + /** + * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read + */ + public byte[] write() { + byte[] ret = bindings.PaymentParameters_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a PaymentParameters from a byte array, created by PaymentParameters_write + */ + public static Result_PaymentParametersDecodeErrorZ read(byte[] ser) { + long ret = bindings.PaymentParameters_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentParametersDecodeErrorZ ret_hu_conv = Result_PaymentParametersDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a payee with the node id of the given `pubkey`. + */ + public static PaymentParameters from_node_id(byte[] payee_pubkey) { + long ret = bindings.PaymentParameters_from_node_id(InternalUtils.check_arr_len(payee_pubkey, 33)); + Reference.reachabilityFence(payee_pubkey); + if (ret >= 0 && ret <= 4096) { return null; } + PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PaymentParameters(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Creates a payee with the node id of the given `pubkey` to use for keysend payments. + */ + public static PaymentParameters for_keysend(byte[] payee_pubkey) { + long ret = bindings.PaymentParameters_for_keysend(InternalUtils.check_arr_len(payee_pubkey, 33)); + Reference.reachabilityFence(payee_pubkey); + if (ret >= 0 && ret <= 4096) { return null; } + PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PaymentParameters(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Persist.java b/src/main/java/org/ldk/structs/Persist.java index 0237bcb2..707f359f 100644 --- a/src/main/java/org/ldk/structs/Persist.java +++ b/src/main/java/org/ldk/structs/Persist.java @@ -111,6 +111,7 @@ public class Persist extends CommonBase { MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new MonitorUpdateId(null, update_id); } update_id_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.persist_new_channel(channel_id_hu_conv, data_hu_conv, update_id_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -122,6 +123,7 @@ public class Persist extends CommonBase { MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new MonitorUpdateId(null, update_id); } update_id_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.update_persisted_channel(channel_id_hu_conv, update_hu_conv, data_hu_conv, update_id_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } diff --git a/src/main/java/org/ldk/structs/PhantomKeysManager.java b/src/main/java/org/ldk/structs/PhantomKeysManager.java new file mode 100644 index 00000000..55085267 --- /dev/null +++ b/src/main/java/org/ldk/structs/PhantomKeysManager.java @@ -0,0 +1,103 @@ +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; + + +/** + * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node + * payments. + * + * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be + * paid to one of multiple nodes. This works because we encode the invoice route hints such that + * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment + * itself without ever needing to forward to this fake node. + * + * Phantom node payments are useful for load balancing between multiple LDK nodes. They also + * provide some fault tolerance, because payers will automatically retry paying other provided + * nodes in the case that one node goes down. + * + * Note that multi-path payments are not supported in phantom invoices for security reasons. + * Switching between this struct and [`KeysManager`] will invalidate any previously issued + * invoices and attempts to pay previous invoices will fail. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PhantomKeysManager extends CommonBase { + PhantomKeysManager(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PhantomKeysManager_free(ptr); } + } + + /** + * 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 + */ + public KeysInterface as_KeysInterface() { + long ret = bindings.PhantomKeysManager_as_KeysInterface(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + KeysInterface ret_hu_conv = new KeysInterface(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed` + * that is shared across all nodes that intend to participate in [phantom node payments] together. + * + * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and + * `starting_time_nanos`. + * + * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the + * same across restarts, or else inbound payments may fail. + * + * [phantom node payments]: PhantomKeysManager + */ + public static PhantomKeysManager of(byte[] seed, long starting_time_secs, int starting_time_nanos, byte[] cross_node_seed) { + long ret = bindings.PhantomKeysManager_new(InternalUtils.check_arr_len(seed, 32), starting_time_secs, starting_time_nanos, InternalUtils.check_arr_len(cross_node_seed, 32)); + Reference.reachabilityFence(seed); + Reference.reachabilityFence(starting_time_secs); + Reference.reachabilityFence(starting_time_nanos); + Reference.reachabilityFence(cross_node_seed); + if (ret >= 0 && ret <= 4096) { return null; } + PhantomKeysManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PhantomKeysManager(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. + */ + public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight) { + long ret = bindings.PhantomKeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight); + Reference.reachabilityFence(this); + Reference.reachabilityFence(descriptors); + Reference.reachabilityFence(outputs); + Reference.reachabilityFence(change_destination_script); + 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); + return ret_hu_conv; + } + + /** + * See [`KeysManager::derive_channel_keys`] for documentation on this method. + */ + public InMemorySigner derive_channel_keys(long channel_value_satoshis, byte[] params) { + long ret = bindings.PhantomKeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, InternalUtils.check_arr_len(params, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(params); + if (ret >= 0 && ret <= 4096) { return null; } + InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/PhantomRouteHints.java b/src/main/java/org/ldk/structs/PhantomRouteHints.java new file mode 100644 index 00000000..459a06fa --- /dev/null +++ b/src/main/java/org/ldk/structs/PhantomRouteHints.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; + + +/** + * Route hints used in constructing invoices for [phantom node payents]. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PhantomRouteHints extends CommonBase { + PhantomRouteHints(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PhantomRouteHints_free(ptr); } + } + + /** + * The list of channels to be included in the invoice route hints. + */ + public ChannelDetails[] get_channels() { + long[] ret = bindings.PhantomRouteHints_get_channels(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]; + ChannelDetails ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new ChannelDetails(null, ret_conv_16); } + ret_conv_16_hu_conv.ptrs_to.add(this); + ret_conv_16_arr[q] = ret_conv_16_hu_conv; + } + return ret_conv_16_arr; + } + + /** + * The list of channels to be included in the invoice route hints. + */ + public void set_channels(ChannelDetails[] val) { + bindings.PhantomRouteHints_set_channels(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. + */ + public long get_phantom_scid() { + long ret = bindings.PhantomRouteHints_get_phantom_scid(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. + */ + public void set_phantom_scid(long val) { + bindings.PhantomRouteHints_set_phantom_scid(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The pubkey of the real backing node that would ultimately receive the payment. + */ + public byte[] get_real_node_pubkey() { + byte[] ret = bindings.PhantomRouteHints_get_real_node_pubkey(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The pubkey of the real backing node that would ultimately receive the payment. + */ + public void set_real_node_pubkey(byte[] val) { + bindings.PhantomRouteHints_set_real_node_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Constructs a new PhantomRouteHints given each field + */ + public static PhantomRouteHints of(ChannelDetails[] channels_arg, long phantom_scid_arg, byte[] real_node_pubkey_arg) { + long ret = bindings.PhantomRouteHints_new(channels_arg != null ? Arrays.stream(channels_arg).mapToLong(channels_arg_conv_16 -> channels_arg_conv_16 == null ? 0 : channels_arg_conv_16.ptr & ~1).toArray() : null, phantom_scid_arg, InternalUtils.check_arr_len(real_node_pubkey_arg, 33)); + Reference.reachabilityFence(channels_arg); + Reference.reachabilityFence(phantom_scid_arg); + Reference.reachabilityFence(real_node_pubkey_arg); + if (ret >= 0 && ret <= 4096) { return null; } + PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PhantomRouteHints(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.PhantomRouteHints_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the PhantomRouteHints + */ + public PhantomRouteHints clone() { + long ret = bindings.PhantomRouteHints_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + PhantomRouteHints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PhantomRouteHints(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read + */ + public byte[] write() { + byte[] ret = bindings.PhantomRouteHints_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write + */ + public static Result_PhantomRouteHintsDecodeErrorZ read(byte[] ser) { + long ret = bindings.PhantomRouteHints_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/PositiveTimestamp.java b/src/main/java/org/ldk/structs/PositiveTimestamp.java index dd04d046..35e09bd0 100644 --- a/src/main/java/org/ldk/structs/PositiveTimestamp.java +++ b/src/main/java/org/ldk/structs/PositiveTimestamp.java @@ -9,12 +9,12 @@ import javax.annotation.Nullable; /** - * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX - * timestamp is positive. + * A timestamp that refers to a date after 1 January 1970. * * # Invariants - * The UNIX timestamp representing the stored time has to be positive and small enough so that - * a `EpiryTime` can be added to it without an overflow. + * + * The Unix timestamp representing the stored time has to be positive and no greater than + * [`MAX_TIMESTAMP`]. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class PositiveTimestamp extends CommonBase { @@ -61,9 +61,9 @@ public class PositiveTimestamp extends CommonBase { } /** - * Create a new `PositiveTimestamp` from a unix timestamp in the Range - * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a - * `CreationError::TimestampOutOfBounds`. + * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`. + * + * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. */ public static Result_PositiveTimestampCreationErrorZ from_unix_timestamp(long unix_seconds) { long ret = bindings.PositiveTimestamp_from_unix_timestamp(unix_seconds); @@ -74,9 +74,10 @@ public class PositiveTimestamp extends CommonBase { } /** - * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in - * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a - * `CreationError::TimestampOutOfBounds`. + * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in + * the range `0..=MAX_TIMESTAMP`. + * + * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. */ public static Result_PositiveTimestampCreationErrorZ from_system_time(long time) { long ret = bindings.PositiveTimestamp_from_system_time(time); @@ -87,7 +88,21 @@ public class PositiveTimestamp extends CommonBase { } /** - * Returns the UNIX timestamp representing the stored time + * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range + * `0..=MAX_TIMESTAMP`. + * + * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. + */ + public static Result_PositiveTimestampCreationErrorZ from_duration_since_epoch(long duration) { + long ret = bindings.PositiveTimestamp_from_duration_since_epoch(duration); + Reference.reachabilityFence(duration); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Returns the Unix timestamp representing the stored time */ public long as_unix_timestamp() { long ret = bindings.PositiveTimestamp_as_unix_timestamp(this.ptr); @@ -96,7 +111,16 @@ public class PositiveTimestamp extends CommonBase { } /** - * Returns a reference to the internal `SystemTime` time representation + * Returns the duration of the stored time since the Unix epoch + */ + public long as_duration_since_epoch() { + long ret = bindings.PositiveTimestamp_as_duration_since_epoch(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Returns the [`SystemTime`] representing the stored time */ public long as_time() { long ret = bindings.PositiveTimestamp_as_time(this.ptr); diff --git a/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java b/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java new file mode 100644 index 00000000..ebace911 --- /dev/null +++ b/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java @@ -0,0 +1,169 @@ +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; + + +/** + * Parameters for configuring [`ProbabilisticScorer`]. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ProbabilisticScoringParameters extends CommonBase { + ProbabilisticScoringParameters(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ProbabilisticScoringParameters_free(ptr); } + } + + /** + * A multiplier used to determine the amount in msats willing to be paid to avoid routing + * through a channel, as per multiplying by the negative `log10` of the channel's success + * probability for a payment. + * + * The success probability is determined by the effective channel capacity, the payment amount, + * and knowledge learned from prior successful and unsuccessful payments. The lower bound of + * the success probability is 0.01, effectively limiting the penalty to the range + * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based + * on [`liquidity_offset_half_life`]. + * + * Default value: 10,000 msat + * + * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life + */ + public long get_liquidity_penalty_multiplier_msat() { + long ret = bindings.ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A multiplier used to determine the amount in msats willing to be paid to avoid routing + * through a channel, as per multiplying by the negative `log10` of the channel's success + * probability for a payment. + * + * The success probability is determined by the effective channel capacity, the payment amount, + * and knowledge learned from prior successful and unsuccessful payments. The lower bound of + * the success probability is 0.01, effectively limiting the penalty to the range + * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based + * on [`liquidity_offset_half_life`]. + * + * Default value: 10,000 msat + * + * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life + */ + public void set_liquidity_penalty_multiplier_msat(long val) { + bindings.ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The time required to elapse before any knowledge learned about channel liquidity balances is + * cut in half. + * + * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets + * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases + * the certainty of the channel liquidity balance. + * + * Default value: 1 hour + * + * # Note + * + * When built with the `no-std` feature, time will never elapse. Therefore, the channel + * liquidity knowledge will never decay except when the bounds cross. + */ + public long get_liquidity_offset_half_life() { + long ret = bindings.ProbabilisticScoringParameters_get_liquidity_offset_half_life(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The time required to elapse before any knowledge learned about channel liquidity balances is + * cut in half. + * + * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets + * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases + * the certainty of the channel liquidity balance. + * + * Default value: 1 hour + * + * # Note + * + * When built with the `no-std` feature, time will never elapse. Therefore, the channel + * liquidity knowledge will never decay except when the bounds cross. + */ + public void set_liquidity_offset_half_life(long val) { + bindings.ProbabilisticScoringParameters_set_liquidity_offset_half_life(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Constructs a new ProbabilisticScoringParameters given each field + */ + public static ProbabilisticScoringParameters of(long liquidity_penalty_multiplier_msat_arg, long liquidity_offset_half_life_arg) { + long ret = bindings.ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg); + Reference.reachabilityFence(liquidity_penalty_multiplier_msat_arg); + Reference.reachabilityFence(liquidity_offset_half_life_arg); + if (ret >= 0 && ret <= 4096) { return null; } + ProbabilisticScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScoringParameters(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.ProbabilisticScoringParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ProbabilisticScoringParameters + */ + public ProbabilisticScoringParameters clone() { + long ret = bindings.ProbabilisticScoringParameters_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ProbabilisticScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScoringParameters(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the ProbabilisticScoringParameters object into a byte array which can be read by ProbabilisticScoringParameters_read + */ + public byte[] write() { + byte[] ret = bindings.ProbabilisticScoringParameters_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a ProbabilisticScoringParameters from a byte array, created by ProbabilisticScoringParameters_write + */ + public static Result_ProbabilisticScoringParametersDecodeErrorZ read(byte[] ser) { + long ret = bindings.ProbabilisticScoringParameters_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. + */ + public static ProbabilisticScoringParameters with_default() { + long ret = bindings.ProbabilisticScoringParameters_default(); + if (ret >= 0 && ret <= 4096) { return null; } + ProbabilisticScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScoringParameters(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + 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 new file mode 100644 index 00000000..2dafb72a --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureSignatureZNoneZ.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_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); + 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(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_ChannelCounterpartyDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelCounterpartyDecodeErrorZ.java new file mode 100644 index 00000000..64951141 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelCounterpartyDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_ChannelCounterpartyDecodeErrorZ extends CommonBase { + private Result_ChannelCounterpartyDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelCounterpartyDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelCounterpartyDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ChannelCounterpartyDecodeErrorZ_is_ok(ptr)) { + return new Result_ChannelCounterpartyDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelCounterpartyDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelCounterpartyDecodeErrorZ_OK extends Result_ChannelCounterpartyDecodeErrorZ { + public final ChannelCounterparty res; + private Result_ChannelCounterpartyDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_ChannelCounterpartyDecodeErrorZ_get_ok(ptr); + ChannelCounterparty res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ChannelCounterparty(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ChannelCounterpartyDecodeErrorZ_Err extends Result_ChannelCounterpartyDecodeErrorZ { + public final DecodeError err; + private Result_ChannelCounterpartyDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_ChannelCounterpartyDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + */ + public static Result_ChannelCounterpartyDecodeErrorZ ok(ChannelCounterparty o) { + long ret = bindings.CResult_ChannelCounterpartyDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelCounterpartyDecodeErrorZ ret_hu_conv = Result_ChannelCounterpartyDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + */ + public static Result_ChannelCounterpartyDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_ChannelCounterpartyDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelCounterpartyDecodeErrorZ ret_hu_conv = Result_ChannelCounterpartyDecodeErrorZ.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_ChannelCounterpartyDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_ChannelCounterpartyDecodeErrorZ clone() { + long ret = bindings.CResult_ChannelCounterpartyDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelCounterpartyDecodeErrorZ ret_hu_conv = Result_ChannelCounterpartyDecodeErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..a69d38ce --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelDetailsDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_ChannelDetailsDecodeErrorZ extends CommonBase { + private Result_ChannelDetailsDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelDetailsDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelDetailsDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ChannelDetailsDecodeErrorZ_is_ok(ptr)) { + return new Result_ChannelDetailsDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelDetailsDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelDetailsDecodeErrorZ_OK extends Result_ChannelDetailsDecodeErrorZ { + public final ChannelDetails res; + private Result_ChannelDetailsDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_ChannelDetailsDecodeErrorZ_get_ok(ptr); + ChannelDetails res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ChannelDetails(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ChannelDetailsDecodeErrorZ_Err extends Result_ChannelDetailsDecodeErrorZ { + public final DecodeError err; + private Result_ChannelDetailsDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_ChannelDetailsDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. + */ + public static Result_ChannelDetailsDecodeErrorZ ok(ChannelDetails o) { + long ret = bindings.CResult_ChannelDetailsDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + */ + public static Result_ChannelDetailsDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_ChannelDetailsDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.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_ChannelDetailsDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_ChannelDetailsDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_ChannelDetailsDecodeErrorZ clone() { + long ret = bindings.CResult_ChannelDetailsDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..7386d0ad --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelUpdateInfoDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_ChannelUpdateInfoDecodeErrorZ extends CommonBase { + private Result_ChannelUpdateInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelUpdateInfoDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelUpdateInfoDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(ptr)) { + return new Result_ChannelUpdateInfoDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelUpdateInfoDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelUpdateInfoDecodeErrorZ_OK extends Result_ChannelUpdateInfoDecodeErrorZ { + public final ChannelUpdateInfo res; + private Result_ChannelUpdateInfoDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(ptr); + ChannelUpdateInfo res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ChannelUpdateInfo(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ChannelUpdateInfoDecodeErrorZ_Err extends Result_ChannelUpdateInfoDecodeErrorZ { + public final DecodeError err; + private Result_ChannelUpdateInfoDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_ChannelUpdateInfoDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. + */ + public static Result_ChannelUpdateInfoDecodeErrorZ ok(ChannelUpdateInfo o) { + long ret = bindings.CResult_ChannelUpdateInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. + */ + public static Result_ChannelUpdateInfoDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_ChannelUpdateInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.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_ChannelUpdateInfoDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_ChannelUpdateInfoDecodeErrorZ clone() { + long ret = bindings.CResult_ChannelUpdateInfoDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..0f0f11e0 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_CounterpartyCommitmentSecretsDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_CounterpartyCommitmentSecretsDecodeErrorZ extends CommonBase { + private Result_CounterpartyCommitmentSecretsDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CounterpartyCommitmentSecretsDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(ptr)) { + return new Result_CounterpartyCommitmentSecretsDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CounterpartyCommitmentSecretsDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CounterpartyCommitmentSecretsDecodeErrorZ_OK extends Result_CounterpartyCommitmentSecretsDecodeErrorZ { + public final CounterpartyCommitmentSecrets res; + private Result_CounterpartyCommitmentSecretsDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(ptr); + CounterpartyCommitmentSecrets res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new CounterpartyCommitmentSecrets(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_CounterpartyCommitmentSecretsDecodeErrorZ_Err extends Result_CounterpartyCommitmentSecretsDecodeErrorZ { + public final DecodeError err; + private Result_CounterpartyCommitmentSecretsDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + */ + public static Result_CounterpartyCommitmentSecretsDecodeErrorZ ok(CounterpartyCommitmentSecrets o) { + long ret = bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyCommitmentSecretsDecodeErrorZ ret_hu_conv = Result_CounterpartyCommitmentSecretsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + */ + public static Result_CounterpartyCommitmentSecretsDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyCommitmentSecretsDecodeErrorZ ret_hu_conv = Result_CounterpartyCommitmentSecretsDecodeErrorZ.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_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_CounterpartyCommitmentSecretsDecodeErrorZ clone() { + long ret = bindings.CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyCommitmentSecretsDecodeErrorZ ret_hu_conv = Result_CounterpartyCommitmentSecretsDecodeErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..1b322384 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_CounterpartyForwardingInfoDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_CounterpartyForwardingInfoDecodeErrorZ extends CommonBase { + private Result_CounterpartyForwardingInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CounterpartyForwardingInfoDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(ptr)) { + return new Result_CounterpartyForwardingInfoDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CounterpartyForwardingInfoDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CounterpartyForwardingInfoDecodeErrorZ_OK extends Result_CounterpartyForwardingInfoDecodeErrorZ { + public final CounterpartyForwardingInfo res; + private Result_CounterpartyForwardingInfoDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(ptr); + CounterpartyForwardingInfo res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new CounterpartyForwardingInfo(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_CounterpartyForwardingInfoDecodeErrorZ_Err extends Result_CounterpartyForwardingInfoDecodeErrorZ { + public final DecodeError err; + private Result_CounterpartyForwardingInfoDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + */ + public static Result_CounterpartyForwardingInfoDecodeErrorZ ok(CounterpartyForwardingInfo o) { + long ret = bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyForwardingInfoDecodeErrorZ ret_hu_conv = Result_CounterpartyForwardingInfoDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + */ + public static Result_CounterpartyForwardingInfoDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyForwardingInfoDecodeErrorZ ret_hu_conv = Result_CounterpartyForwardingInfoDecodeErrorZ.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_CounterpartyForwardingInfoDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_CounterpartyForwardingInfoDecodeErrorZ clone() { + long ret = bindings.CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_CounterpartyForwardingInfoDecodeErrorZ ret_hu_conv = Result_CounterpartyForwardingInfoDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java deleted file mode 100644 index dc9093c6..00000000 --- a/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.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; - -public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { - private Result_DirectionalChannelInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_DirectionalChannelInfoDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_DirectionalChannelInfoDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(ptr)) { - return new Result_DirectionalChannelInfoDecodeErrorZ_OK(null, ptr); - } else { - return new Result_DirectionalChannelInfoDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_DirectionalChannelInfoDecodeErrorZ_OK extends Result_DirectionalChannelInfoDecodeErrorZ { - public final DirectionalChannelInfo res; - private Result_DirectionalChannelInfoDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(ptr); - DirectionalChannelInfo res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new DirectionalChannelInfo(null, res); } - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - } - - public static final class Result_DirectionalChannelInfoDecodeErrorZ_Err extends Result_DirectionalChannelInfoDecodeErrorZ { - public final DecodeError err; - private Result_DirectionalChannelInfoDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_get_err(ptr); - DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state. - */ - public static Result_DirectionalChannelInfoDecodeErrorZ ok(DirectionalChannelInfo o) { - long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state. - */ - public static Result_DirectionalChannelInfoDecodeErrorZ err(DecodeError e) { - long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.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_DirectionalChannelInfoDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_DirectionalChannelInfoDecodeErrorZ clone() { - long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java deleted file mode 100644 index 1242c056..00000000 --- a/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java +++ /dev/null @@ -1,91 +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_ExpiryTimeCreationErrorZ extends CommonBase { - private Result_ExpiryTimeCreationErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_ExpiryTimeCreationErrorZ_free(ptr); } super.finalize(); - } - - static Result_ExpiryTimeCreationErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_ExpiryTimeCreationErrorZ_is_ok(ptr)) { - return new Result_ExpiryTimeCreationErrorZ_OK(null, ptr); - } else { - return new Result_ExpiryTimeCreationErrorZ_Err(null, ptr); - } - } - public static final class Result_ExpiryTimeCreationErrorZ_OK extends Result_ExpiryTimeCreationErrorZ { - public final ExpiryTime res; - private Result_ExpiryTimeCreationErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_ExpiryTimeCreationErrorZ_get_ok(ptr); - ExpiryTime res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ExpiryTime(null, res); } - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - } - - public static final class Result_ExpiryTimeCreationErrorZ_Err extends Result_ExpiryTimeCreationErrorZ { - public final CreationError err; - private Result_ExpiryTimeCreationErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - this.err = bindings.CResult_ExpiryTimeCreationErrorZ_get_err(ptr); - } - } - - /** - * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state. - */ - public static Result_ExpiryTimeCreationErrorZ ok(ExpiryTime o) { - long ret = bindings.CResult_ExpiryTimeCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state. - */ - public static Result_ExpiryTimeCreationErrorZ err(org.ldk.enums.CreationError e) { - long ret = bindings.CResult_ExpiryTimeCreationErrorZ_err(e); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.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_ExpiryTimeCreationErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_ExpiryTimeCreationErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_ExpiryTimeCreationErrorZ clone() { - long ret = bindings.CResult_ExpiryTimeCreationErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); - 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 new file mode 100644 index 00000000..f93a0bed --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_FixedPenaltyScorerDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_FixedPenaltyScorerDecodeErrorZ extends CommonBase { + private Result_FixedPenaltyScorerDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FixedPenaltyScorerDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FixedPenaltyScorerDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(ptr)) { + return new Result_FixedPenaltyScorerDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FixedPenaltyScorerDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FixedPenaltyScorerDecodeErrorZ_OK extends Result_FixedPenaltyScorerDecodeErrorZ { + public final FixedPenaltyScorer res; + private Result_FixedPenaltyScorerDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(ptr); + FixedPenaltyScorer res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new FixedPenaltyScorer(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_FixedPenaltyScorerDecodeErrorZ_Err extends Result_FixedPenaltyScorerDecodeErrorZ { + public final DecodeError err; + private Result_FixedPenaltyScorerDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_FixedPenaltyScorerDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + */ + public static Result_FixedPenaltyScorerDecodeErrorZ ok(FixedPenaltyScorer o) { + long ret = bindings.CResult_FixedPenaltyScorerDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. + */ + public static Result_FixedPenaltyScorerDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_FixedPenaltyScorerDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.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_FixedPenaltyScorerDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_FixedPenaltyScorerDecodeErrorZ clone() { + long ret = bindings.CResult_FixedPenaltyScorerDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.java deleted file mode 100644 index 7221a410..00000000 --- a/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.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; - -public class Result_PayeeDecodeErrorZ extends CommonBase { - private Result_PayeeDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_PayeeDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_PayeeDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_PayeeDecodeErrorZ_is_ok(ptr)) { - return new Result_PayeeDecodeErrorZ_OK(null, ptr); - } else { - return new Result_PayeeDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_PayeeDecodeErrorZ_OK extends Result_PayeeDecodeErrorZ { - public final Payee res; - private Result_PayeeDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_PayeeDecodeErrorZ_get_ok(ptr); - Payee res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new Payee(null, res); } - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - } - - public static final class Result_PayeeDecodeErrorZ_Err extends Result_PayeeDecodeErrorZ { - public final DecodeError err; - private Result_PayeeDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_PayeeDecodeErrorZ_get_err(ptr); - DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_PayeeDecodeErrorZ in the success state. - */ - public static Result_PayeeDecodeErrorZ ok(Payee o) { - long ret = bindings.CResult_PayeeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_PayeeDecodeErrorZ in the error state. - */ - public static Result_PayeeDecodeErrorZ err(DecodeError e) { - long ret = bindings.CResult_PayeeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.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_PayeeDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_PayeeDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_PayeeDecodeErrorZ clone() { - long ret = bindings.CResult_PayeeDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); - 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 new file mode 100644 index 00000000..bfaf0b65 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PaymentParametersDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_PaymentParametersDecodeErrorZ extends CommonBase { + private Result_PaymentParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentParametersDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_PaymentParametersDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_PaymentParametersDecodeErrorZ_is_ok(ptr)) { + return new Result_PaymentParametersDecodeErrorZ_OK(null, ptr); + } else { + return new Result_PaymentParametersDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_PaymentParametersDecodeErrorZ_OK extends Result_PaymentParametersDecodeErrorZ { + public final PaymentParameters res; + private Result_PaymentParametersDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_PaymentParametersDecodeErrorZ_get_ok(ptr); + PaymentParameters res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new PaymentParameters(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PaymentParametersDecodeErrorZ_Err extends Result_PaymentParametersDecodeErrorZ { + public final DecodeError err; + private Result_PaymentParametersDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_PaymentParametersDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. + */ + public static Result_PaymentParametersDecodeErrorZ ok(PaymentParameters o) { + long ret = bindings.CResult_PaymentParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentParametersDecodeErrorZ ret_hu_conv = Result_PaymentParametersDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. + */ + public static Result_PaymentParametersDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_PaymentParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentParametersDecodeErrorZ ret_hu_conv = Result_PaymentParametersDecodeErrorZ.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_PaymentParametersDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_PaymentParametersDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PaymentParametersDecodeErrorZ clone() { + long ret = bindings.CResult_PaymentParametersDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentParametersDecodeErrorZ ret_hu_conv = Result_PaymentParametersDecodeErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..8caea0eb --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PhantomRouteHintsDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_PhantomRouteHintsDecodeErrorZ extends CommonBase { + private Result_PhantomRouteHintsDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PhantomRouteHintsDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_PhantomRouteHintsDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_PhantomRouteHintsDecodeErrorZ_is_ok(ptr)) { + return new Result_PhantomRouteHintsDecodeErrorZ_OK(null, ptr); + } else { + return new Result_PhantomRouteHintsDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_PhantomRouteHintsDecodeErrorZ_OK extends Result_PhantomRouteHintsDecodeErrorZ { + public final PhantomRouteHints res; + private Result_PhantomRouteHintsDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_PhantomRouteHintsDecodeErrorZ_get_ok(ptr); + PhantomRouteHints res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new PhantomRouteHints(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PhantomRouteHintsDecodeErrorZ_Err extends Result_PhantomRouteHintsDecodeErrorZ { + public final DecodeError err; + private Result_PhantomRouteHintsDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_PhantomRouteHintsDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. + */ + public static Result_PhantomRouteHintsDecodeErrorZ ok(PhantomRouteHints o) { + long ret = bindings.CResult_PhantomRouteHintsDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. + */ + public static Result_PhantomRouteHintsDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_PhantomRouteHintsDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.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_PhantomRouteHintsDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PhantomRouteHintsDecodeErrorZ clone() { + long ret = bindings.CResult_PhantomRouteHintsDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PhantomRouteHintsDecodeErrorZ ret_hu_conv = Result_PhantomRouteHintsDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_ProbabilisticScoringParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ProbabilisticScoringParametersDecodeErrorZ.java new file mode 100644 index 00000000..1f4fb41c --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ProbabilisticScoringParametersDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_ProbabilisticScoringParametersDecodeErrorZ extends CommonBase { + private Result_ProbabilisticScoringParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ProbabilisticScoringParametersDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(ptr)) { + return new Result_ProbabilisticScoringParametersDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ProbabilisticScoringParametersDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ProbabilisticScoringParametersDecodeErrorZ_OK extends Result_ProbabilisticScoringParametersDecodeErrorZ { + public final ProbabilisticScoringParameters res; + private Result_ProbabilisticScoringParametersDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(ptr); + ProbabilisticScoringParameters res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ProbabilisticScoringParameters(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ProbabilisticScoringParametersDecodeErrorZ_Err extends Result_ProbabilisticScoringParametersDecodeErrorZ { + public final DecodeError err; + private Result_ProbabilisticScoringParametersDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state. + */ + public static Result_ProbabilisticScoringParametersDecodeErrorZ ok(ProbabilisticScoringParameters o) { + long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state. + */ + public static Result_ProbabilisticScoringParametersDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.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_ProbabilisticScoringParametersDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_ProbabilisticScoringParametersDecodeErrorZ clone() { + long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java index b7c53e5f..5909f4c2 100644 --- a/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java @@ -50,15 +50,7 @@ public class Result_ScorerDecodeErrorZ extends CommonBase { Reference.reachabilityFence(o_params); if (ret >= 0 && ret <= 4096) { return null; } Result_ScorerDecodeErrorZ ret_hu_conv = Result_ScorerDecodeErrorZ.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(o_params); -// Due to rust's strict-ownership memory model, in some cases we need to "move" -// an object to pass exclusive ownership to the function being called. -// In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object -// at the FFI layer, creating a new object which Rust can claim ownership of -// However, in some cases (eg here), there is no way to clone an object, and thus -// we actually have to pass full ownership to Rust. -// Thus, after ret_hu_conv call, o_params is reset to null and is now a dummy object. -o_params.ptr = 0;; + ; return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java index 6b99a12d..2b4d58dd 100644 --- a/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java @@ -45,13 +45,9 @@ public class Result_ScoringParametersDecodeErrorZ extends CommonBase { /** * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state. */ - public static Result_ScoringParametersDecodeErrorZ ok(long o_base_penalty_msat_arg, long o_failure_penalty_msat_arg, short o_overuse_penalty_start_1024th_arg, long o_overuse_penalty_msat_per_1024th_arg, long o_failure_penalty_half_life_arg) { - long ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(bindings.ScoringParameters_new(o_base_penalty_msat_arg, o_failure_penalty_msat_arg, o_overuse_penalty_start_1024th_arg, o_overuse_penalty_msat_per_1024th_arg, o_failure_penalty_half_life_arg)); - Reference.reachabilityFence(o_base_penalty_msat_arg); - Reference.reachabilityFence(o_failure_penalty_msat_arg); - Reference.reachabilityFence(o_overuse_penalty_start_1024th_arg); - Reference.reachabilityFence(o_overuse_penalty_msat_per_1024th_arg); - Reference.reachabilityFence(o_failure_penalty_half_life_arg); + public static Result_ScoringParametersDecodeErrorZ ok(ScoringParameters o) { + long ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -77,4 +73,22 @@ public class Result_ScoringParametersDecodeErrorZ extends CommonBase { return ret; } + long clone_ptr() { + long ret = bindings.CResult_ScoringParametersDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_ScoringParametersDecodeErrorZ clone() { + long ret = bindings.CResult_ScoringParametersDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java index be4ce173..a363f510 100644 --- a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java @@ -67,4 +67,22 @@ public class Result_SecretKeyErrorZ extends CommonBase { return ret; } + long clone_ptr() { + long ret = bindings.CResult_SecretKeyErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_SecretKeyErrorZ clone() { + long ret = bindings.CResult_SecretKeyErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..7c3cc1fb --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_SecretKeyNoneZ.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_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_WarningMessageDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_WarningMessageDecodeErrorZ.java new file mode 100644 index 00000000..01e68cca --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_WarningMessageDecodeErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_WarningMessageDecodeErrorZ extends CommonBase { + private Result_WarningMessageDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_WarningMessageDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_WarningMessageDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_WarningMessageDecodeErrorZ_is_ok(ptr)) { + return new Result_WarningMessageDecodeErrorZ_OK(null, ptr); + } else { + return new Result_WarningMessageDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_WarningMessageDecodeErrorZ_OK extends Result_WarningMessageDecodeErrorZ { + public final WarningMessage res; + private Result_WarningMessageDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_WarningMessageDecodeErrorZ_get_ok(ptr); + WarningMessage res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new WarningMessage(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_WarningMessageDecodeErrorZ_Err extends Result_WarningMessageDecodeErrorZ { + public final DecodeError err; + private Result_WarningMessageDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_WarningMessageDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. + */ + public static Result_WarningMessageDecodeErrorZ ok(WarningMessage o) { + long ret = bindings.CResult_WarningMessageDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. + */ + public static Result_WarningMessageDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_WarningMessageDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.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_WarningMessageDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_WarningMessageDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_WarningMessageDecodeErrorZ clone() { + long ret = bindings.CResult_WarningMessageDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Route.java b/src/main/java/org/ldk/structs/Route.java index 9682331e..74a08d98 100644 --- a/src/main/java/org/ldk/structs/Route.java +++ b/src/main/java/org/ldk/structs/Route.java @@ -64,7 +64,7 @@ public class Route extends CommonBase { } /** - * The `payee` parameter passed to [`find_route`]. + * The `payment_params` parameter passed to [`find_route`]. * This is used by `ChannelManager` to track information which may be required for retries, * provided back to you via [`Event::PaymentPathFailed`]. * @@ -73,17 +73,17 @@ public class Route extends CommonBase { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable - public Payee get_payee() { - long ret = bindings.Route_get_payee(this.ptr); + public PaymentParameters get_payment_params() { + long ret = bindings.Route_get_payment_params(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } + PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PaymentParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } /** - * The `payee` parameter passed to [`find_route`]. + * The `payment_params` parameter passed to [`find_route`]. * This is used by `ChannelManager` to track information which may be required for retries, * provided back to you via [`Event::PaymentPathFailed`]. * @@ -91,8 +91,8 @@ public class Route extends CommonBase { * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public void set_payee(@Nullable Payee val) { - bindings.Route_set_payee(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_payment_params(@Nullable PaymentParameters val) { + bindings.Route_set_payment_params(this.ptr, val == null ? 0 : val.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(val); } @@ -100,10 +100,10 @@ public class Route extends CommonBase { /** * Constructs a new Route given each field */ - public static Route of(RouteHop[][] paths_arg, Payee payee_arg) { - long ret = bindings.Route_new(paths_arg != null ? Arrays.stream(paths_arg).map(paths_arg_conv_12 -> paths_arg_conv_12 != null ? Arrays.stream(paths_arg_conv_12).mapToLong(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray() : null).toArray(long[][]::new) : null, payee_arg == null ? 0 : payee_arg.ptr & ~1); + public static Route of(RouteHop[][] paths_arg, PaymentParameters payment_params_arg) { + long ret = bindings.Route_new(paths_arg != null ? Arrays.stream(paths_arg).map(paths_arg_conv_12 -> paths_arg_conv_12 != null ? Arrays.stream(paths_arg_conv_12).mapToLong(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray() : null).toArray(long[][]::new) : null, payment_params_arg == null ? 0 : payment_params_arg.ptr & ~1); Reference.reachabilityFence(paths_arg); - Reference.reachabilityFence(payee_arg); + Reference.reachabilityFence(payment_params_arg); if (ret >= 0 && ret <= 4096) { return null; } Route ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Route(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/RouteParameters.java b/src/main/java/org/ldk/structs/RouteParameters.java index c7bd3b68..45afee42 100644 --- a/src/main/java/org/ldk/structs/RouteParameters.java +++ b/src/main/java/org/ldk/structs/RouteParameters.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * Parameters needed to find a [`Route`] for paying a [`Payee`]. + * Parameters needed to find a [`Route`]. * * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed * payment path. @@ -26,22 +26,22 @@ public class RouteParameters extends CommonBase { } /** - * The recipient of the failed payment path. + * The parameters of the failed payment path. */ - public Payee get_payee() { - long ret = bindings.RouteParameters_get_payee(this.ptr); + public PaymentParameters get_payment_params() { + long ret = bindings.RouteParameters_get_payment_params(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } + PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PaymentParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } /** - * The recipient of the failed payment path. + * The parameters of the failed payment path. */ - public void set_payee(Payee val) { - bindings.RouteParameters_set_payee(this.ptr, val == null ? 0 : val.ptr & ~1); + public void set_payment_params(PaymentParameters val) { + bindings.RouteParameters_set_payment_params(this.ptr, val == null ? 0 : val.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(val); } @@ -85,9 +85,9 @@ public class RouteParameters extends CommonBase { /** * Constructs a new RouteParameters given each field */ - public static RouteParameters of(Payee payee_arg, long final_value_msat_arg, int final_cltv_expiry_delta_arg) { - long ret = bindings.RouteParameters_new(payee_arg == null ? 0 : payee_arg.ptr & ~1, final_value_msat_arg, final_cltv_expiry_delta_arg); - Reference.reachabilityFence(payee_arg); + public static RouteParameters of(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 & ~1, final_value_msat_arg, final_cltv_expiry_delta_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; } diff --git a/src/main/java/org/ldk/structs/Router.java b/src/main/java/org/ldk/structs/Router.java index 529868cd..43f1aa14 100644 --- a/src/main/java/org/ldk/structs/Router.java +++ b/src/main/java/org/ldk/structs/Router.java @@ -30,14 +30,14 @@ 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(byte[] payer, RouteParameters params, byte[] payment_hash, ChannelDetails[] first_hops, Score scorer); + Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters route_params, byte[] payment_hash, ChannelDetails[] first_hops, Score scorer); } private static class LDKRouterHolder { Router held; } public static Router new_impl(RouterInterface arg) { final LDKRouterHolder impl_holder = new LDKRouterHolder(); impl_holder.held = new Router(new bindings.LDKRouter() { - @Override public long find_route(byte[] payer, long params, byte[] payment_hash, long[] first_hops, long scorer) { - RouteParameters params_hu_conv = null; if (params < 0 || params > 4096) { params_hu_conv = new RouteParameters(null, params); } + @Override public long find_route(byte[] payer, long route_params, byte[] payment_hash, long[] first_hops, long scorer) { + RouteParameters route_params_hu_conv = null; if (route_params < 0 || route_params > 4096) { route_params_hu_conv = new RouteParameters(null, route_params); } int first_hops_conv_16_len = first_hops.length; ChannelDetails[] first_hops_conv_16_arr = new ChannelDetails[first_hops_conv_16_len]; for (int q = 0; q < first_hops_conv_16_len; q++) { @@ -48,7 +48,8 @@ public class Router extends CommonBase { } Score ret_hu_conv = new Score(null, scorer); ret_hu_conv.ptrs_to.add(this); - Result_RouteLightningErrorZ ret = arg.find_route(payer, params_hu_conv, payment_hash, first_hops_conv_16_arr, ret_hu_conv); + Result_RouteLightningErrorZ ret = arg.find_route(payer, route_params_hu_conv, payment_hash, first_hops_conv_16_arr, ret_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -60,17 +61,17 @@ public class Router extends CommonBase { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters params, byte[] payment_hash, @Nullable ChannelDetails[] first_hops, Score scorer) { - long ret = bindings.Router_find_route(this.ptr, InternalUtils.check_arr_len(payer, 33), params == null ? 0 : params.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, scorer == null ? 0 : scorer.ptr); + public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters route_params, byte[] payment_hash, @Nullable ChannelDetails[] first_hops, Score scorer) { + long ret = bindings.Router_find_route(this.ptr, InternalUtils.check_arr_len(payer, 33), route_params == null ? 0 : route_params.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, scorer == null ? 0 : scorer.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(payer); - Reference.reachabilityFence(params); + Reference.reachabilityFence(route_params); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(first_hops); Reference.reachabilityFence(scorer); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(params); + this.ptrs_to.add(route_params); for (ChannelDetails first_hops_conv_16: first_hops) { this.ptrs_to.add(first_hops_conv_16); }; this.ptrs_to.add(scorer); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index 040eb644..67254708 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -99,39 +99,46 @@ public class RoutingMessageHandler extends CommonBase { @Override public long handle_node_announcement(long msg) { NodeAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new NodeAnnouncement(null, msg); } Result_boolLightningErrorZ ret = arg.handle_node_announcement(msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long handle_channel_announcement(long msg) { ChannelAnnouncement msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelAnnouncement(null, msg); } Result_boolLightningErrorZ ret = arg.handle_channel_announcement(msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long handle_channel_update(long msg) { ChannelUpdate msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ChannelUpdate(null, msg); } Result_boolLightningErrorZ ret = arg.handle_channel_update(msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long[] get_next_channel_announcements(long starting_point, byte batch_amount) { ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ[] ret = arg.get_next_channel_announcements(starting_point, batch_amount); + Reference.reachabilityFence(arg); long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_59 -> ret_conv_59 == null ? 0 : ret_conv_59.clone_ptr()).toArray() : null; return result; } @Override public long[] get_next_node_announcements(byte[] starting_point, byte batch_amount) { NodeAnnouncement[] ret = arg.get_next_node_announcements(starting_point, batch_amount); + 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; return result; } @Override public void sync_routing_table(byte[] their_node_id, long init) { Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new Init(null, init); } arg.sync_routing_table(their_node_id, init_hu_conv); + Reference.reachabilityFence(arg); } @Override public long handle_reply_channel_range(byte[] their_node_id, long msg) { ReplyChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyChannelRange(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_reply_channel_range(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -139,6 +146,7 @@ public class RoutingMessageHandler extends CommonBase { ReplyShortChannelIdsEnd msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new ReplyShortChannelIdsEnd(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_reply_short_channel_ids_end(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -146,6 +154,7 @@ public class RoutingMessageHandler extends CommonBase { QueryChannelRange msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryChannelRange(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_query_channel_range(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -153,6 +162,7 @@ public class RoutingMessageHandler extends CommonBase { QueryShortChannelIds msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new QueryShortChannelIds(null, msg); } msg_hu_conv.ptrs_to.add(this); Result_NoneLightningErrorZ ret = arg.handle_query_short_channel_ids(their_node_id, msg_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } diff --git a/src/main/java/org/ldk/structs/Score.java b/src/main/java/org/ldk/structs/Score.java index 63da5612..a1d8498d 100644 --- a/src/main/java/org/ldk/structs/Score.java +++ b/src/main/java/org/ldk/structs/Score.java @@ -31,17 +31,13 @@ public class Score extends CommonBase { * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the * given channel in the direction from `source` to `target`. * - * The channel's capacity (less any other MPP parts which are also being considered for use in - * the same payment) is given by `channel_capacity_msat`. It may be guessed from various - * sources or assumed from no data at all. - * - * For hints provided in the invoice, we assume the channel has sufficient capacity to accept - * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other - * cases it is set to `Some`, even if we're guessing at the channel value. - * - * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC. + * The channel's capacity (less any other MPP parts that are also being considered for use in + * the same payment) is given by `capacity_msat`. It may be determined from various sources + * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near + * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. + * Thus, implementations should be overflow-safe. */ - long channel_penalty_msat(long short_channel_id, long send_amt_msat, Option_u64Z channel_capacity_msat, NodeId source, NodeId target); + long channel_penalty_msat(long short_channel_id, long send_amt_msat, long capacity_msat, NodeId source, NodeId target); /** * Handles updating channel penalties after failing to route through a channel. */ @@ -59,12 +55,11 @@ public class Score extends CommonBase { public static Score new_impl(ScoreInterface arg) { final LDKScoreHolder impl_holder = new LDKScoreHolder(); impl_holder.held = new Score(new bindings.LDKScore() { - @Override public long channel_penalty_msat(long short_channel_id, long send_amt_msat, long channel_capacity_msat, long source, long target) { - Option_u64Z channel_capacity_msat_hu_conv = Option_u64Z.constr_from_ptr(channel_capacity_msat); - channel_capacity_msat_hu_conv.ptrs_to.add(this); + @Override public long channel_penalty_msat(long short_channel_id, long send_amt_msat, long capacity_msat, long source, long target) { NodeId source_hu_conv = null; if (source < 0 || source > 4096) { source_hu_conv = new NodeId(null, source); } NodeId target_hu_conv = null; if (target < 0 || target > 4096) { target_hu_conv = new NodeId(null, target); } - long ret = arg.channel_penalty_msat(short_channel_id, send_amt_msat, channel_capacity_msat_hu_conv, source_hu_conv, target_hu_conv); + long ret = arg.channel_penalty_msat(short_channel_id, send_amt_msat, capacity_msat, source_hu_conv, target_hu_conv); + Reference.reachabilityFence(arg); return ret; } @Override public void payment_path_failed(long[] path, long short_channel_id) { @@ -77,6 +72,7 @@ public class Score extends CommonBase { path_conv_10_arr[k] = path_conv_10_hu_conv; } arg.payment_path_failed(path_conv_10_arr, short_channel_id); + Reference.reachabilityFence(arg); } @Override public void payment_path_successful(long[] path) { int path_conv_10_len = path.length; @@ -88,9 +84,11 @@ public class Score extends CommonBase { path_conv_10_arr[k] = path_conv_10_hu_conv; } arg.payment_path_successful(path_conv_10_arr); + Reference.reachabilityFence(arg); } @Override public byte[] write() { byte[] ret = arg.write(); + Reference.reachabilityFence(arg); return ret; } }); @@ -100,22 +98,18 @@ public class Score extends CommonBase { * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the * given channel in the direction from `source` to `target`. * - * The channel's capacity (less any other MPP parts which are also being considered for use in - * the same payment) is given by `channel_capacity_msat`. It may be guessed from various - * sources or assumed from no data at all. - * - * For hints provided in the invoice, we assume the channel has sufficient capacity to accept - * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other - * cases it is set to `Some`, even if we're guessing at the channel value. - * - * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC. + * The channel's capacity (less any other MPP parts that are also being considered for use in + * the same payment) is given by `capacity_msat`. It may be determined from various sources + * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near + * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. + * Thus, implementations should be overflow-safe. */ - public long channel_penalty_msat(long short_channel_id, long send_amt_msat, Option_u64Z channel_capacity_msat, NodeId source, NodeId target) { - long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, send_amt_msat, channel_capacity_msat.ptr, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1); + public long channel_penalty_msat(long short_channel_id, long send_amt_msat, long capacity_msat, NodeId source, NodeId target) { + long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, send_amt_msat, capacity_msat, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(short_channel_id); Reference.reachabilityFence(send_amt_msat); - Reference.reachabilityFence(channel_capacity_msat); + Reference.reachabilityFence(capacity_msat); Reference.reachabilityFence(source); Reference.reachabilityFence(target); this.ptrs_to.add(source); diff --git a/src/main/java/org/ldk/structs/Scorer.java b/src/main/java/org/ldk/structs/Scorer.java index 0bd74183..4ec2a7b8 100644 --- a/src/main/java/org/ldk/structs/Scorer.java +++ b/src/main/java/org/ldk/structs/Scorer.java @@ -14,7 +14,12 @@ import javax.annotation.Nullable; * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with * slightly higher fees are available. Will further penalize channels that fail to relay payments. * - * See [module-level documentation] for usage. + * See [module-level documentation] for usage and [`ScoringParameters`] for customization. + * + * # Note + * + * Mixing the `no-std` feature between serialization and deserialization results in undefined + * behavior. * * [module-level documentation]: crate::routing::scoring */ @@ -30,13 +35,9 @@ public class Scorer extends CommonBase { /** * Creates a new scorer using the given scoring parameters. */ - public static Scorer of(long params_base_penalty_msat_arg, long params_failure_penalty_msat_arg, short params_overuse_penalty_start_1024th_arg, long params_overuse_penalty_msat_per_1024th_arg, long params_failure_penalty_half_life_arg) { - long ret = bindings.Scorer_new(bindings.ScoringParameters_new(params_base_penalty_msat_arg, params_failure_penalty_msat_arg, params_overuse_penalty_start_1024th_arg, params_overuse_penalty_msat_per_1024th_arg, params_failure_penalty_half_life_arg)); - Reference.reachabilityFence(params_base_penalty_msat_arg); - Reference.reachabilityFence(params_failure_penalty_msat_arg); - Reference.reachabilityFence(params_overuse_penalty_start_1024th_arg); - Reference.reachabilityFence(params_overuse_penalty_msat_per_1024th_arg); - Reference.reachabilityFence(params_failure_penalty_half_life_arg); + public static Scorer of(ScoringParameters params) { + long ret = bindings.Scorer_new(params == null ? 0 : params.ptr & ~1); + Reference.reachabilityFence(params); if (ret >= 0 && ret <= 4096) { return null; } Scorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Scorer(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/ScoringParameters.java b/src/main/java/org/ldk/structs/ScoringParameters.java index d0360a5b..5a80f7a5 100644 --- a/src/main/java/org/ldk/structs/ScoringParameters.java +++ b/src/main/java/org/ldk/structs/ScoringParameters.java @@ -138,6 +138,8 @@ public class ScoringParameters extends CommonBase { * * Successfully routing through a channel will immediately cut the penalty in half as well. * + * Default value: 1 hour + * * # Note * * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will @@ -157,6 +159,8 @@ public class ScoringParameters extends CommonBase { * * Successfully routing through a channel will immediately cut the penalty in half as well. * + * Default value: 1 hour + * * # Note * * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will @@ -186,6 +190,24 @@ public class ScoringParameters extends CommonBase { return ret_hu_conv; } + long clone_ptr() { + long ret = bindings.ScoringParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ScoringParameters + */ + public ScoringParameters clone() { + long ret = bindings.ScoringParameters_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ScoringParameters(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + /** * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read */ diff --git a/src/main/java/org/ldk/structs/Sign.java b/src/main/java/org/ldk/structs/Sign.java index aea1d41e..ed3f9728 100644 --- a/src/main/java/org/ldk/structs/Sign.java +++ b/src/main/java/org/ldk/structs/Sign.java @@ -41,6 +41,7 @@ public class Sign extends CommonBase { 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); diff --git a/src/main/java/org/ldk/structs/SocketDescriptor.java b/src/main/java/org/ldk/structs/SocketDescriptor.java index 93e47ca4..02704aee 100644 --- a/src/main/java/org/ldk/structs/SocketDescriptor.java +++ b/src/main/java/org/ldk/structs/SocketDescriptor.java @@ -79,19 +79,23 @@ public class SocketDescriptor extends CommonBase { impl_holder.held = new SocketDescriptor(new bindings.LDKSocketDescriptor() { @Override public long send_data(byte[] data, boolean resume_read) { long ret = arg.send_data(data, resume_read); + Reference.reachabilityFence(arg); return ret; } @Override public void disconnect_socket() { arg.disconnect_socket(); + Reference.reachabilityFence(arg); } @Override public boolean eq(long other_arg) { SocketDescriptor ret_hu_conv = new SocketDescriptor(null, other_arg); ret_hu_conv.ptrs_to.add(this); boolean ret = arg.eq(ret_hu_conv); + Reference.reachabilityFence(arg); return ret; } @Override public long hash() { long ret = arg.hash(); + Reference.reachabilityFence(arg); return ret; } }); diff --git a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java index 1590d438..eec574dd 100644 --- a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java @@ -72,6 +72,8 @@ public class TrustedCommitmentTransaction extends CommonBase { * which HTLCOutputInCommitment::transaction_output_index.is_some()). * * The returned Vec has one entry for each HTLC, and in the same order. + * + * This function is only valid in the holder commitment context, it always uses SigHashType::All. */ public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) { long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr & ~1); diff --git a/src/main/java/org/ldk/structs/TwoTuple_SignatureSignatureZ.java b/src/main/java/org/ldk/structs/TwoTuple_SignatureSignatureZ.java new file mode 100644 index 00000000..01d05b0c --- /dev/null +++ b/src/main/java/org/ldk/structs/TwoTuple_SignatureSignatureZ.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_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); + 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); + 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 5d8c2d57..8f557c60 100644 --- a/src/main/java/org/ldk/structs/Type.java +++ b/src/main/java/org/ldk/structs/Type.java @@ -46,14 +46,17 @@ public class Type extends CommonBase { impl_holder.held = new Type(new bindings.LDKType() { @Override public short type_id() { short ret = arg.type_id(); + Reference.reachabilityFence(arg); return ret; } @Override public String debug_str() { String ret = arg.debug_str(); + Reference.reachabilityFence(arg); return ret; } @Override public byte[] write() { byte[] ret = arg.write(); + Reference.reachabilityFence(arg); return ret; } }); diff --git a/src/main/java/org/ldk/structs/UserConfig.java b/src/main/java/org/ldk/structs/UserConfig.java index 23078a60..0f7bff7b 100644 --- a/src/main/java/org/ldk/structs/UserConfig.java +++ b/src/main/java/org/ldk/structs/UserConfig.java @@ -154,16 +154,59 @@ public class UserConfig extends CommonBase { Reference.reachabilityFence(val); } + /** + * If this is set to true, the user needs to manually accept inbound requests to open a new + * channel. + * + * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a + * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a + * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the + * user explicitly chooses to accept the request. + * + * Default value: false. + * + * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest + * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel + * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + */ + public boolean get_manually_accept_inbound_channels() { + boolean ret = bindings.UserConfig_get_manually_accept_inbound_channels(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * If this is set to true, the user needs to manually accept inbound requests to open a new + * channel. + * + * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a + * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a + * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the + * user explicitly chooses to accept the request. + * + * Default value: false. + * + * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest + * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel + * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + */ + public void set_manually_accept_inbound_channels(boolean val) { + bindings.UserConfig_set_manually_accept_inbound_channels(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new UserConfig given each field */ - public static UserConfig of(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg) { - long ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); + public static UserConfig of(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg, boolean manually_accept_inbound_channels_arg) { + long ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg); Reference.reachabilityFence(own_channel_config_arg); Reference.reachabilityFence(peer_channel_config_limits_arg); Reference.reachabilityFence(channel_options_arg); Reference.reachabilityFence(accept_forwards_to_priv_channels_arg); Reference.reachabilityFence(accept_inbound_channels_arg); + Reference.reachabilityFence(manually_accept_inbound_channels_arg); if (ret >= 0 && ret <= 4096) { return null; } UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UserConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index 624cb60a..ef8ba801 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -83,6 +83,16 @@ public class UtilMethods { return ret; } + /** + * Construct the invoice's HRP and signatureless data into a preimage to be hashed. + */ + public static byte[] construct_invoice_preimage(byte[] hrp_bytes, UInt5[] data_without_signature) { + byte[] ret = bindings.construct_invoice_preimage(hrp_bytes, data_without_signature != null ? InternalUtils.convUInt5Array(data_without_signature) : null); + Reference.reachabilityFence(hrp_bytes); + Reference.reachabilityFence(data_without_signature); + return ret; + } + /** * Read a MonitorEvent from a byte array, created by MonitorEvent_write */ @@ -378,17 +388,17 @@ public class UtilMethods { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, RouteParameters params, NetworkGraph network, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer) { - long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), params == null ? 0 : params.ptr & ~1, network == null ? 0 : network.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); + public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, RouteParameters route_params, NetworkGraph network, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer) { + long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr & ~1, network == null ? 0 : network.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); Reference.reachabilityFence(our_node_pubkey); - Reference.reachabilityFence(params); + Reference.reachabilityFence(route_params); Reference.reachabilityFence(network); Reference.reachabilityFence(first_hops); Reference.reachabilityFence(logger); Reference.reachabilityFence(scorer); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(params); + ret_hu_conv.ptrs_to.add(route_params); ret_hu_conv.ptrs_to.add(network); for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; ret_hu_conv.ptrs_to.add(logger); @@ -410,6 +420,47 @@ public class UtilMethods { 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. + * + * `phantom_route_hints` parameter: + * Contains channel info for all nodes participating in the phantom invoice + * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each + * participating node + * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is + * updated when a channel becomes disabled or closes + * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice + * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared + * down + * + * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or + * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any + * participating node. + * + * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom + * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this + * requirement). + * + * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager + * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels + */ + public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice(Option_u64Z amt_msat, java.lang.String description, byte[] payment_hash, byte[] payment_secret, PhantomRouteHints[] phantom_route_hints, KeysInterface keys_manager, org.ldk.enums.Currency network) { + long ret = bindings.create_phantom_invoice(amt_msat.ptr, description, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32), 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 & ~1).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, network); + Reference.reachabilityFence(amt_msat); + Reference.reachabilityFence(description); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(payment_secret); + Reference.reachabilityFence(phantom_route_hints); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(network); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(keys_manager); + return ret_hu_conv; + } + /** * Utility to construct an invoice. Generally, unless you want to do something like a custom * cltv_expiry, this is what you should be using to create an invoice. The reason being, this @@ -431,4 +482,24 @@ public class UtilMethods { return ret_hu_conv; } + /** + * See [`create_invoice_from_channelmanager`] + * 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(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch) { + long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description, duration_since_epoch); + Reference.reachabilityFence(channelmanager); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(network); + Reference.reachabilityFence(amt_msat); + Reference.reachabilityFence(description); + Reference.reachabilityFence(duration_since_epoch); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(channelmanager); + ret_hu_conv.ptrs_to.add(keys_manager); + return ret_hu_conv; + } + } \ No newline at end of file diff --git a/src/main/java/org/ldk/structs/WarningMessage.java b/src/main/java/org/ldk/structs/WarningMessage.java new file mode 100644 index 00000000..662d479d --- /dev/null +++ b/src/main/java/org/ldk/structs/WarningMessage.java @@ -0,0 +1,120 @@ +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 warning message to be sent or received from a peer + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class WarningMessage extends CommonBase { + WarningMessage(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.WarningMessage_free(ptr); } + } + + /** + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. + */ + public byte[] get_channel_id() { + byte[] ret = bindings.WarningMessage_get_channel_id(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. + */ + public void set_channel_id(byte[] val) { + bindings.WarningMessage_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * 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. + */ + public String get_data() { + String ret = bindings.WarningMessage_get_data(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * 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. + */ + public void set_data(java.lang.String val) { + bindings.WarningMessage_set_data(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Constructs a new WarningMessage given each field + */ + public static WarningMessage of(byte[] channel_id_arg, java.lang.String data_arg) { + long ret = bindings.WarningMessage_new(InternalUtils.check_arr_len(channel_id_arg, 32), data_arg); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(data_arg); + if (ret >= 0 && ret <= 4096) { return null; } + WarningMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new WarningMessage(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.WarningMessage_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the WarningMessage + */ + public WarningMessage clone() { + long ret = bindings.WarningMessage_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + WarningMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new WarningMessage(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read + */ + public byte[] write() { + byte[] ret = bindings.WarningMessage_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a WarningMessage from a byte array, created by WarningMessage_write + */ + public static Result_WarningMessageDecodeErrorZ read(byte[] ser) { + long ret = bindings.WarningMessage_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_WarningMessageDecodeErrorZ ret_hu_conv = Result_WarningMessageDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index 6cc7fee6..f0d71228 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -90,6 +90,7 @@ public class Watch extends CommonBase { ChannelMonitor monitor_hu_conv = null; if (monitor < 0 || monitor > 4096) { monitor_hu_conv = new ChannelMonitor(null, monitor); } monitor_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.watch_channel(funding_txo_hu_conv, monitor_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -99,11 +100,13 @@ public class Watch extends CommonBase { ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new ChannelMonitorUpdate(null, update); } update_hu_conv.ptrs_to.add(this); Result_NoneChannelMonitorUpdateErrZ ret = arg.update_channel(funding_txo_hu_conv, update_hu_conv); + Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @Override public long[] release_pending_monitor_events() { MonitorEvent[] ret = arg.release_pending_monitor_events(); + Reference.reachabilityFence(arg); long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_14 -> ret_conv_14 == null ? 0 : ret_conv_14.clone_ptr()).toArray() : null; return result; } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 8e856d53..12989212 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -307,8 +307,8 @@ static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass cl case 0: return LDKCreationError_DescriptionTooLong; case 1: return LDKCreationError_RouteTooLong; case 2: return LDKCreationError_TimestampOutOfBounds; - case 3: return LDKCreationError_ExpiryTimeOutOfBounds; - case 4: return LDKCreationError_InvalidAmount; + case 3: return LDKCreationError_InvalidAmount; + case 4: return LDKCreationError_MissingRouteHints; } (*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 @@ -317,8 +317,8 @@ static jclass CreationError_class = NULL; static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL; static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL; static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL; -static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL; static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL; +static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) { CreationError_class = (*env)->NewGlobalRef(env, clz); CHECK(CreationError_class != NULL); @@ -328,10 +328,10 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclas CHECK(CreationError_LDKCreationError_RouteTooLong != NULL); CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL); - CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;"); - CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL); CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_InvalidAmount != NULL); + CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;"); + CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL); } static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) { switch (val) { @@ -341,10 +341,10 @@ static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong); case LDKCreationError_TimestampOutOfBounds: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds); - case LDKCreationError_ExpiryTimeOutOfBounds: - return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds); case LDKCreationError_InvalidAmount: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount); + case LDKCreationError_MissingRouteHints: + return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints); default: abort(); } } @@ -635,6 +635,40 @@ static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) { } } +static inline LDKRecipient LDKRecipient_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 Recipient.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKRecipient_Node; + case 1: return LDKRecipient_PhantomNode; + } + (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass Recipient_class = NULL; +static jfieldID Recipient_LDKRecipient_Node = NULL; +static jfieldID Recipient_LDKRecipient_PhantomNode = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) { + Recipient_class = (*env)->NewGlobalRef(env, clz); + CHECK(Recipient_class != NULL); + Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;"); + CHECK(Recipient_LDKRecipient_Node != NULL); + Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;"); + CHECK(Recipient_LDKRecipient_PhantomNode != NULL); +} +static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) { + switch (val) { + case LDKRecipient_Node: + return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node); + case LDKRecipient_PhantomNode: + return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode); + 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))) { @@ -859,6 +893,60 @@ uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPO return ret_val; } +static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); + CResult_NoneNoneZ_get_ok(owner_conv); +} + +static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); + CResult_NoneNoneZ_get_err(owner_conv); +} + +static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return CounterpartyCommitmentSecrets_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1); + LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -1569,13 +1657,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from default: abort(); } } -static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return Payee_clone(&*owner->contents.result); + return PaymentParameters_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1); - LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1); + LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1587,13 +1675,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_ return ret_ref; } -static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1); - LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1775,7 +1863,7 @@ static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ } return ret; } -static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) { +static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) { LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]); @@ -2257,6 +2345,8 @@ static jclass LDKEvent_DiscardFunding_class = NULL; static jmethodID LDKEvent_DiscardFunding_meth = NULL; static jclass LDKEvent_PaymentPathSuccessful_class = NULL; static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL; +static jclass LDKEvent_OpenChannelRequest_class = NULL; +static jmethodID LDKEvent_OpenChannelRequest_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady")); @@ -2313,6 +2403,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_PaymentPathSuccessful_class != NULL); LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "", "([B[B[J)V"); CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL); + LDKEvent_OpenChannelRequest_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest")); + CHECK(LDKEvent_OpenChannelRequest_class != NULL); + LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJ)V"); + CHECK(LDKEvent_OpenChannelRequest_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -2433,6 +2528,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr); } + case LDKEvent_OpenChannelRequest: { + int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data); + int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form); + return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat); + } default: abort(); } } @@ -2505,6 +2607,8 @@ static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL; static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL; static jclass LDKErrorAction_SendErrorMessage_class = NULL; static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL; +static jclass LDKErrorAction_SendWarningMessage_class = NULL; +static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) { LDKErrorAction_DisconnectPeer_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer")); @@ -2531,6 +2635,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIE CHECK(LDKErrorAction_SendErrorMessage_class != NULL); LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "", "(J)V"); CHECK(LDKErrorAction_SendErrorMessage_meth != NULL); + LDKErrorAction_SendWarningMessage_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage")); + CHECK(LDKErrorAction_SendWarningMessage_class != NULL); + LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "", "(JLorg/ldk/enums/Level;)V"); + CHECK(LDKErrorAction_SendWarningMessage_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1); @@ -2565,6 +2674,16 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 msg_ref = (uintptr_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref); } + case LDKErrorAction_SendWarningMessage: { + LDKWarningMessage msg_var = obj->send_warning_message.msg; + uintptr_t msg_ref = 0; + CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = (uintptr_t)msg_var.inner & ~1; + jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level); + return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv); + } default: abort(); } } @@ -2920,18 +3039,57 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return &*owner->contents.result; + return FixedPenaltyScorer_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1); + LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ScoringParameters_clone(&*owner->contents.result); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1); - LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv); + LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner & ~1; + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } @@ -2986,6 +3144,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ return ret_ref; } +static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ProbabilisticScoringParameters_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); + LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return InitFeatures_clone(&*owner->contents.result); @@ -3268,24 +3462,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDes return ret_ref; } -static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); - CResult_NoneNoneZ_get_ok(owner_conv); -} - -static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); - CResult_NoneNoneZ_get_err(owner_conv); +static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) { + LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]); + } + return ret; } - static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){ return owner->a; } @@ -3354,6 +3537,66 @@ 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*)(owner & ~1); + 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*)(owner & ~1); + 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*)(owner & ~1); + LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); + *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv); + return ((uintptr_t)ret_conv); +} + +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*)(owner & ~1); + 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*)(owner & ~1); + 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*)(owner & ~1); + CResult_SecretKeyNoneZ_get_err(owner_conv); +} + typedef struct LDKBaseSign_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -3437,7 +3680,7 @@ 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) { +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; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -3456,9 +3699,20 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th if (holder_tx_var.is_owned) { holder_tx_ref |= 1; } + LDKCVec_PaymentPreimageZ preimages_var = preimages; + jobjectArray preimages_arr = NULL; + preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL); + ; + for (size_t i = 0; i < preimages_var.datalen; i++) { + int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data); + (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr); + } + + FREE(preimages_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref); + 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."); @@ -3496,7 +3750,7 @@ 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) { +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; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -3515,9 +3769,20 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L if (commitment_tx_var.is_owned) { commitment_tx_ref |= 1; } + LDKCVec_PaymentPreimageZ preimages_var = preimages; + jobjectArray preimages_arr = NULL; + preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL); + ; + for (size_t i = 0; i < preimages_var.datalen; i++) { + int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data); + (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr); + } + + FREE(preimages_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref); + 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."); @@ -3741,7 +4006,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* } return ret_conv; } -LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { +LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { 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); @@ -3769,7 +4034,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void } void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); CHECK_ACCESS(ret_ptr); - LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr); FREE((void*)ret); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -3817,11 +4082,11 @@ static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, 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)J"); + 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)J"); + 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"); CHECK(calls->validate_counterparty_revocation_meth != NULL); @@ -3889,7 +4154,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1comm 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) { +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 = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; @@ -3897,8 +4162,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_ holder_tx_conv.inner = (void*)(holder_tx & (~1)); holder_tx_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); + 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); + *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); return (uintptr_t)ret_conv; } @@ -3911,7 +4189,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys return ret_arr; } -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) { +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) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; @@ -3919,8 +4197,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterpart commitment_tx_conv.inner = (void*)(commitment_tx & (~1)); commitment_tx_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv); + 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_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ"); - *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv); + *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr); return (uintptr_t)ret_conv; } @@ -4032,7 +4323,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1an msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); - LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + 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); return (uintptr_t)ret_conv; } @@ -4922,6 +5213,150 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPI return ret_ref; } +static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return CounterpartyForwardingInfo_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1); + LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ChannelCounterparty_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1); + LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ChannelDetails_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1); + LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return PhantomRouteHints_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1); + LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) { LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -5281,7 +5716,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { +LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { 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); @@ -5290,20 +5725,22 @@ LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { } 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); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception."); } - LDKSecretKey ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 32); - (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes); + void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr); + FREE((void*)ret); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_ref; + return ret_conv; } LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -5432,7 +5869,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* } return ret_conv; } -LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) { +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; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -5441,13 +5878,23 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKCVec_u8Z invoice_preimage_var = invoice_preimage; - int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen); - (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data); - CVec_u8Z_free(invoice_preimage_var); + 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, invoice_preimage_arr); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception."); @@ -5496,7 +5943,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j 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", "()[B"); + 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_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B"); CHECK(calls->get_destination_script_meth != NULL); @@ -5508,7 +5955,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j 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)J"); + 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); @@ -5532,13 +5979,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEn *res_ptr = LDKKeysInterface_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { +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 = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { 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_node_secret)(this_arg_conv->this_arg).bytes); - return ret_arr; + 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 (uintptr_t)ret_conv; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -5599,16 +6047,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1 return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) { +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) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKCVec_u8Z invoice_preimage_ref; - invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage); - invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data); + 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, invoice_preimage_ref); + *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 (uintptr_t)ret_conv; } @@ -6444,34 +6906,6 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreation return ret_conv; } -static inline struct LDKExpiryTime CResult_ExpiryTimeCreationErrorZ_get_ok(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return ExpiryTime_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ExpiryTimeCreationErrorZ* owner_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(owner & ~1); - LDKExpiryTime ret_var = CResult_ExpiryTimeCreationErrorZ_get_ok(owner_conv); - uintptr_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline enum LDKCreationError CResult_ExpiryTimeCreationErrorZ_get_err(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return CreationError_clone(&*owner->contents.err); -} -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ExpiryTimeCreationErrorZ* owner_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(owner & ~1); - jclass ret_conv = LDKCreationError_to_java(env, CResult_ExpiryTimeCreationErrorZ_get_err(owner_conv)); - return ret_conv; -} - static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return PrivateRoute_clone(&*owner->contents.result); @@ -7308,7 +7742,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1f case LDKCOption_AccessZ_Some: { LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess"); *some_ret = obj->some; - // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances + // 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 this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKAccess_JCalls_cloned(&(*some_ret)); @@ -7321,13 +7755,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1f default: abort(); } } -static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return DirectionalChannelInfo_clone(&*owner->contents.result); + return ChannelUpdateInfo_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1); - LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1); + LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -7339,13 +7773,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannel return ret_ref; } -static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1); - LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -8537,6 +8971,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecode return ret_ref; } +static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return WarningMessage_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1); + LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return UnsignedNodeAnnouncement_clone(&*owner->contents.result); @@ -8789,6 +9259,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFil return ret_ref; } +static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) { + LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = PhantomRouteHints_clone(&orig->data[i]); + } + return ret; +} static jclass LDKSignOrCreationError_SignError_class = NULL; static jmethodID LDKSignOrCreationError_SignError_meth = NULL; static jclass LDKSignOrCreationError_CreationError_class = NULL; @@ -9012,7 +9489,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f case LDKCOption_FilterZ_Some: { LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter"); *some_ret = obj->some; - // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances + // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances if ((*some_ret).free == LDKFilter_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKFilter_JCalls_cloned(&(*some_ret)); @@ -12040,6 +12517,64 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIE return ret_val; } +static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL; +static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL; +static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL; +static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL; +static jclass LDKEffectiveCapacity_Total_class = NULL; +static jmethodID LDKEffectiveCapacity_Total_meth = NULL; +static jclass LDKEffectiveCapacity_Infinite_class = NULL; +static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL; +static jclass LDKEffectiveCapacity_Unknown_class = NULL; +static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) { + LDKEffectiveCapacity_ExactLiquidity_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity")); + CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL); + LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "", "(J)V"); + CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL); + LDKEffectiveCapacity_MaximumHTLC_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC")); + CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL); + LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "", "(J)V"); + CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL); + LDKEffectiveCapacity_Total_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total")); + CHECK(LDKEffectiveCapacity_Total_class != NULL); + LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "", "(J)V"); + CHECK(LDKEffectiveCapacity_Total_meth != NULL); + LDKEffectiveCapacity_Infinite_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite")); + CHECK(LDKEffectiveCapacity_Infinite_class != NULL); + LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "", "()V"); + CHECK(LDKEffectiveCapacity_Infinite_meth != NULL); + LDKEffectiveCapacity_Unknown_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown")); + CHECK(LDKEffectiveCapacity_Unknown_class != NULL); + LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "", "()V"); + CHECK(LDKEffectiveCapacity_Unknown_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1); + switch(obj->tag) { + case LDKEffectiveCapacity_ExactLiquidity: { + return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, obj->exact_liquidity.liquidity_msat); + } + case LDKEffectiveCapacity_MaximumHTLC: { + return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, obj->maximum_htlc.amount_msat); + } + case LDKEffectiveCapacity_Total: { + return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, obj->total.capacity_msat); + } + case LDKEffectiveCapacity_Infinite: { + return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth); + } + case LDKEffectiveCapacity_Unknown: { + return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth); + } + default: abort(); + } +} typedef struct LDKScore_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -12066,7 +12601,7 @@ static void LDKScore_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12075,9 +12610,6 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *channel_capacity_msat_copy = channel_capacity_msat; - uintptr_t channel_capacity_msat_ref = (uintptr_t)channel_capacity_msat_copy; LDKNodeId source_var = *source; uintptr_t source_ref = 0; source_var = NodeId_clone(source); @@ -12100,7 +12632,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref); + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, capacity_msat, source_ref, target_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); @@ -12246,14 +12778,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, *res_ptr = LDKScore_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t channel_capacity_msat, int64_t source, int64_t target) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t capacity_msat, int64_t source, int64_t target) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; - void* channel_capacity_msat_ptr = (void*)(((uintptr_t)channel_capacity_msat) & ~1); - CHECK_ACCESS(channel_capacity_msat_ptr); - LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr); - channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)channel_capacity_msat) & ~1)); LDKNodeId source_conv; source_conv.inner = (void*)(source & (~1)); source_conv.is_owned = false; @@ -12262,7 +12790,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1ms target_conv.inner = (void*)(target & (~1)); target_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, capacity_msat, &source_conv, &target_conv); return ret_val; } @@ -12370,7 +12898,7 @@ LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { if (ret_conv.free == LDKScore_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKScore_JCalls_cloned(&ret_conv); - }// Warning: we may need a move here but no clone is available for LDKScore + }// WARNING: we may need a move here but no clone is available for LDKScore if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -12446,7 +12974,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi } LDKChannelManager channel_manager_var = *channel_manager; uintptr_t channel_manager_ref = 0; - // Warning: we may need a move here but no clone is available for LDKChannelManager + // WARNING: we may need a move here but no clone is available for LDKChannelManager CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var); @@ -12938,7 +13466,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { 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); @@ -12949,15 +13477,15 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, } int8_tArray payer_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); - LDKRouteParameters params_var = *params; - uintptr_t params_ref = 0; - params_var = RouteParameters_clone(params); - CHECK((((uintptr_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var); - params_ref = (uintptr_t)params_var.inner; - if (params_var.is_owned) { - params_ref |= 1; + LDKRouteParameters route_params_var = *route_params; + uintptr_t route_params_ref = 0; + route_params_var = RouteParameters_clone(route_params); + CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = (uintptr_t)route_params_var.inner; + if (route_params_var.is_owned) { + route_params_ref |= 1; } int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash); @@ -12985,7 +13513,7 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, uintptr_t ret_scorer = ((uintptr_t)scorer) | 1; 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, params_ref, payment_hash_arr, first_hops_arr, ret_scorer); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, ret_scorer); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); @@ -13025,17 +13553,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, *res_ptr = LDKRouter_init(env, clz, o); return (uint64_t)res_ptr; } -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 params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) { +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, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { 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 params_conv; - params_conv.inner = (void*)(params & (~1)); - params_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + LDKRouteParameters route_params_conv; + route_params_conv.inner = (void*)(route_params & (~1)); + route_params_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); unsigned char payment_hash_arr[32]; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); @@ -13064,7 +13592,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uintptr_t)ret_conv; } @@ -13134,6 +13662,106 @@ 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_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_ok(); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_err(); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1); + jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_NoneNoneZ_free(_res_conv); +} + +static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) { + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1); + intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCounterpartyCommitmentSecrets o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = CounterpartyCommitmentSecrets_clone(&o_conv); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKSecretKey o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -13165,6 +13793,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free CResult_SecretKeyErrorZ_free(_res_conv); } +static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) { + LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); + *ret_conv = CResult_SecretKeyErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1); + LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); + *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKPublicKey o_ref; CHECK((*env)->GetArrayLength(env, o) == 33); @@ -13730,7 +14376,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTran o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction + // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ"); *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -13817,7 +14463,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentT o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction + // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ"); *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -14336,58 +14982,58 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKPayee o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Payee_clone(&o_conv); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv); + o_conv = PaymentParameters_clone(&o_conv); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv); return (uintptr_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr); + LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_PayeeDecodeErrorZ_free(_res_conv); + CResult_PaymentParametersDecodeErrorZ_free(_res_conv); } -static inline uintptr_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg); +static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg); return (uintptr_t)ret_conv; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1); - intptr_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv); +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv); return (uintptr_t)ret_conv; } @@ -15123,12 +15769,67 @@ 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_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKFixedPenaltyScorer o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = FixedPenaltyScorer_clone(&o_conv); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKScoringParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters + o_conv = ScoringParameters_clone(&o_conv); LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -15160,12 +15861,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDeco CResult_ScoringParametersDecodeErrorZ_free(_res_conv); } +static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKScorer o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScorer + // WARNING: we need a move here but no clone is available for LDKScorer LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -15197,6 +15916,61 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1f CResult_ScorerDecodeErrorZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKProbabilisticScoringParameters o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = ProbabilisticScoringParameters_clone(&o_conv); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInitFeatures o_conv; o_conv.inner = (void*)(o & (~1)); @@ -15546,49 +16320,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDes return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) { - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_ok(); - return (uintptr_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_err(); - return (uintptr_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1); - jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr); - FREE((void*)_res); - CResult_NoneNoneZ_free(_res_conv); -} - -static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) { - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_clone(arg); - return (uintptr_t)ret_conv; -} -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1); - intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1); - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_clone(orig_conv); - return (uintptr_t)ret_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) { + LDKCVec_PaymentPreimageZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); + else + _res_constr.data = NULL; + for (size_t i = 0; i < _res_constr.datalen; i++) { + int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); + LDKThirtyTwoBytes _res_conv_8_ref; + CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32); + (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data); + _res_constr.data[i] = _res_conv_8_ref; + } + CVec_PaymentPreimageZ_free(_res_constr); } static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) { @@ -15737,6 +16483,142 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1cl return (uintptr_t)ret_conv; } +static inline uintptr_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 ((uintptr_t)ret_conv); +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1); + intptr_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv); + return ret_val; +} + +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*)(orig & ~1); + LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); + *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv); + return ((uintptr_t)ret_conv); +} + +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 ((uintptr_t)ret_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr); + FREE((void*)_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 = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr); + o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1)); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); + *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +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 (uintptr_t)ret_conv; +} + +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*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv); +} + +static inline uintptr_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 (uintptr_t)ret_conv; +} +JNIEXPORT intptr_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*)(arg & ~1); + intptr_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +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*)(orig & ~1); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); + *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +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 (uintptr_t)ret_conv; +} + +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 (uintptr_t)ret_conv; +} + +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*)(o & ~1); + jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_SecretKeyNoneZ_free(_res_conv); +} + +static inline uintptr_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 (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1); + intptr_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +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*)(orig & ~1); + LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); + *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = (void*)(((uintptr_t)o) & ~1); CHECK_ACCESS(o_ptr); @@ -15794,12 +16676,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1 return (uintptr_t)ret_conv; } -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); - _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data); - CVec_u8Z_free(_res_ref); +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); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + else + _res_constr.data = NULL; + int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL); + for (size_t h = 0; h < _res_constr.datalen; h++) { + int8_t _res_conv_7 = _res_vals[h]; + + _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 }; + } + (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0); + CVec_u5Z_free(_res_constr); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { @@ -15850,6 +16741,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatu return (uintptr_t)ret_conv; } +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); + _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data); + CVec_u8Z_free(_res_ref); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) { LDKCVec_CVec_u8ZZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -16865,6 +17764,226 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPI return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCounterpartyForwardingInfo o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = CounterpartyForwardingInfo_clone(&o_conv); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelCounterparty o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = ChannelCounterparty_clone(&o_conv); + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelDetails o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = ChannelDetails_clone(&o_conv); + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ChannelDetailsDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPhantomRouteHints o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = PhantomRouteHints_clone(&o_conv); + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1); + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_ChannelMonitorZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -16893,7 +18012,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMa b_conv.inner = (void*)(b & (~1)); b_conv.is_owned = (b & 1) || (b == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); - // Warning: we need a move here but no clone is available for LDKChannelManager + // WARNING: we need a move here but no clone is available for LDKChannelManager LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ"); *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv); return ((uintptr_t)ret_conv); @@ -16912,7 +18031,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHash void* o_ptr = (void*)(((uintptr_t)o) & ~1); CHECK_ACCESS(o_ptr); LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr); - // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ + // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ"); *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -17672,57 +18791,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreatio return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKExpiryTime o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = ExpiryTime_clone(&o_conv); - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv); - return (uintptr_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { - LDKCreationError e_conv = LDKCreationError_from_java(env, e); - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv); - return (uintptr_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1); - jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_ExpiryTimeCreationErrorZ_free(_res_conv); -} - -static inline uintptr_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) { - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg); - return (uintptr_t)ret_conv; -} -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1); - intptr_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1); - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv); - return (uintptr_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKPrivateRoute o_conv; o_conv.inner = (void*)(o & (~1)); @@ -18988,58 +20056,58 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv COption_AccessZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKDirectionalChannelInfo o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelUpdateInfo o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = DirectionalChannelInfo_clone(&o_conv); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv); + o_conv = ChannelUpdateInfo_clone(&o_conv); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv); return (uintptr_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr); + LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv); + CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv); } -static inline uintptr_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg); +static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg); return (uintptr_t)ret_conv; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1); - intptr_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv); +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv); return (uintptr_t)ret_conv; } @@ -20902,6 +21970,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecode return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKWarningMessage o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = WarningMessage_clone(&o_conv); + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_WarningMessageDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1); + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKUnsignedNodeAnnouncement o_conv; o_conv.inner = (void*)(o & (~1)); @@ -21287,6 +22410,26 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFil return (uintptr_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_PhantomRouteHintsZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t t = 0; t < _res_constr.datalen; t++) { + int64_t _res_conv_19 = _res_vals[t]; + LDKPhantomRouteHints _res_conv_19_conv; + _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1)); + _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv); + _res_constr.data[t] = _res_conv_19_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_PhantomRouteHintsZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInvoice o_conv; o_conv.inner = (void*)(o & (~1)); @@ -21376,7 +22519,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonit o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor + // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -21814,6 +22957,19 @@ 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_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat) { + LDKThirtyTwoBytes temporary_channel_id_ref; + CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); + (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data); + 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); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -22287,6 +23443,31 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass return ret_val; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) { + 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 data_without_signature_constr; + data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature); + if (data_without_signature_constr.datalen > 0) + data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + else + data_without_signature_constr.data = NULL; + int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL); + for (size_t h = 0; h < data_without_signature_constr.datalen; h++) { + int8_t data_without_signature_conv_7 = data_without_signature_vals[h]; + + data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 }; + } + (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0); + LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr); + 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); + (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0); + return ret_arr; +} + JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKLevel* orig_conv = (LDKLevel*)(orig & ~1); jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv)); @@ -23167,7 +24348,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbou UserConfig_set_accept_inbound_channels(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) { +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) { LDKChannelHandshakeConfig own_channel_config_arg_conv; own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1)); own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0); @@ -23183,7 +24381,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); - LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); + LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -23715,7 +24913,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *e void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1); CHECK_ACCESS(chain_source_ptr); LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr); - // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ + // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ if (chain_source_conv.tag == LDKCOption_FilterZ_Some) { // Manually implement clone for Java trait instances if (chain_source_conv.some.free == LDKFilter_JCalls_free) { @@ -25400,6 +26598,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass Sign_free(this_ptr_conv); } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1); + jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRecipient_to_java(env, Recipient_node()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node()); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -25581,7 +26795,10 @@ 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 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) { +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); LDKSecretKey funding_key_ref; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes); @@ -25603,7 +26820,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(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(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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -25772,12 +26989,15 @@ 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) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) { 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); + *ret_conv = InMemorySigner_read(ser_ref, arg_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uintptr_t)ret_conv; } @@ -25884,6 +27104,112 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterf return (uintptr_t)ret_ret; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPhantomKeysManager this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + 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) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); + *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv); + return (uintptr_t)ret_ret; +} + +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]; + 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]; + 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; + LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKCVec_SpendableOutputDescriptorZ descriptors_constr; + descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors); + if (descriptors_constr.datalen > 0) + descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements"); + else + descriptors_constr.data = NULL; + int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL); + for (size_t b = 0; b < descriptors_constr.datalen; b++) { + int64_t descriptors_conv_27 = descriptors_vals[b]; + void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1); + CHECK_ACCESS(descriptors_conv_27_ptr); + LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr); + descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1)); + descriptors_constr.data[b] = descriptors_conv_27_conv; + } + (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0); + LDKCVec_TxOutZ outputs_constr; + outputs_constr.datalen = (*env)->GetArrayLength(env, outputs); + if (outputs_constr.datalen > 0) + outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements"); + else + outputs_constr.data = NULL; + int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL); + for (size_t h = 0; h < outputs_constr.datalen; h++) { + int64_t outputs_conv_7 = outputs_vals[h]; + void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1); + CHECK_ACCESS(outputs_conv_7_ptr); + LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr); + outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1)); + outputs_constr.data[h] = outputs_conv_7_conv; + } + (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0); + LDKCVec_u8Z change_destination_script_ref; + change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script); + change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data); + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + unsigned char params_arr[32]; + CHECK((*env)->GetArrayLength(env, params) == 32); + (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); + unsigned char (*params_ref)[32] = ¶ms_arr; + LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT 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 = (void*)(this_obj & (~1)); @@ -26818,6 +28144,174 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPhantomRouteHints this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + PhantomRouteHints_free(this_obj_conv); +} + +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_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 q = 0; q < ret_var.datalen; q++) { + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + uintptr_t ret_conv_16_ref = 0; + CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var); + ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; + } + 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 void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCVec_ChannelDetailsZ val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); + for (size_t q = 0; q < val_constr.datalen; q++) { + int64_t val_conv_16 = val_vals[q]; + LDKChannelDetails val_conv_16_conv; + val_conv_16_conv.inner = (void*)(val_conv_16 & (~1)); + val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv); + val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv); + val_constr.data[q] = val_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); + PhantomRouteHints_set_channels(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) { + LDKCVec_ChannelDetailsZ channels_arg_constr; + channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg); + if (channels_arg_constr.datalen > 0) + channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + channels_arg_constr.data = NULL; + int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL); + for (size_t q = 0; q < channels_arg_constr.datalen; q++) { + int64_t channels_arg_conv_16 = channels_arg_vals[q]; + LDKChannelDetails channels_arg_conv_16_conv; + channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1)); + channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv); + channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv); + channels_arg_constr.data[q] = channels_arg_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0); + LDKPublicKey real_node_pubkey_arg_ref; + CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33); + (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form); + LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) { + LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPhantomRouteHints arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPhantomRouteHints orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_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) { void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1); CHECK_ACCESS(fee_est_ptr); @@ -27177,6 +28671,20 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + unsigned char 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; + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref); + return (uintptr_t)ret_conv; +} + 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) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -27255,6 +28763,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1paymen return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -27339,6 +28873,94 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Channel return (uintptr_t)ret_ret; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKCounterpartyForwardingInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_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_CounterpartyForwardingInfo_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_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CounterpartyForwardingInfo_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelCounterparty obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelCounterparty_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_ChannelCounterparty_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_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = ChannelCounterparty_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelDetails obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelDetails_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_ChannelDetails_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_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = ChannelDetails_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPhantomRouteHints obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = PhantomRouteHints_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_PhantomRouteHints_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_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = PhantomRouteHints_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKChannelManager obj_conv; obj_conv.inner = (void*)(obj & (~1)); @@ -27591,7 +29213,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMa arg_conv.inner = (void*)(arg & (~1)); arg_conv.is_owned = (arg & 1) || (arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs + // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ"); *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); @@ -27842,6 +29464,110 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKWarningMessage this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + WarningMessage_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv)); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKThirtyTwoBytes val_ref; + CHECK((*env)->GetArrayLength(env, val) == 32); + (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); + WarningMessage_set_channel_id(&this_ptr_conv, val_ref); +} + +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv); + jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKStr val_conv = java_to_owned_str(env, val); + WarningMessage_set_data(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); + (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); + LDKStr data_arg_conv = java_to_owned_str(env, data_arg); + LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) { + LDKWarningMessage ret_var = WarningMessage_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKWarningMessage arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = WarningMessage_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKWarningMessage orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKPing this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -28701,6 +30427,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKAcceptChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv); + uintptr_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKAcceptChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + AcceptChannel_set_channel_type(&this_ptr_conv, val_conv); +} + static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) { LDKAcceptChannel ret_var = AcceptChannel_clone(arg); uintptr_t ret_ref = 0; @@ -32409,6 +34167,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1m return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) { + LDKWarningMessage msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = WarningMessage_clone(&msg_conv); + LDKLevel log_level_conv = LDKLevel_from_java(env, log_level); + LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction"); + *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKLightningError this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -33487,6 +35258,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * return (uintptr_t)ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKWarningMessage obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = WarningMessage_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_WarningMessage_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_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = WarningMessage_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKUnsignedNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); @@ -33966,7 +35759,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *en message_handler_conv.inner = (void*)(message_handler & (~1)); message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv); - // Warning: we need a move here but no clone is available for LDKMessageHandler + // 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); @@ -34173,6 +35966,119 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transac return ret_arr; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKCounterpartyCommitmentSecrets this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + CounterpartyCommitmentSecrets_free(this_obj_conv); +} + +static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) { + LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCounterpartyCommitmentSecrets arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCounterpartyCommitmentSecrets orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) { + LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new(); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKCounterpartyCommitmentSecrets this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) { + LDKCounterpartyCommitmentSecrets this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes secret_ref; + CHECK((*env)->GetArrayLength(env, secret) == 32); + (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + LDKCounterpartyCommitmentSecrets this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKCounterpartyCommitmentSecrets obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_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_CounterpartyCommitmentSecrets_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_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) { LDKPublicKey per_commitment_point_ref; CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33); @@ -37299,7 +39205,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -37334,7 +39240,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -37365,95 +39271,95 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1Mes return (uintptr_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKDirectionalChannelInfo this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelUpdateInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - DirectionalChannelInfo_free(this_obj_conv); + ChannelUpdateInfo_free(this_obj_conv); } -JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); + int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); + ChannelUpdateInfo_set_last_update(&this_ptr_conv, val); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); + jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); + ChannelUpdateInfo_set_enabled(&this_ptr_conv, val); } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); + int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); + ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); + int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); + ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); + *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv); uintptr_t ret_ref = (uintptr_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -37461,15 +39367,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1h CHECK_ACCESS(val_ptr); LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); - DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37481,8 +39387,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -37491,15 +39397,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1f val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); val_conv = RoutingFees_clone(&val_conv); - DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -37513,8 +39419,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -37523,10 +39429,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1l val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); val_conv = ChannelUpdate_clone(&val_conv); - DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1); CHECK_ACCESS(htlc_maximum_msat_arg_ptr); LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr); @@ -37541,7 +39447,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv); last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37553,8 +39459,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new return ret_ref; } -static inline uintptr_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) { - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg); +static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) { + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37565,21 +39471,21 @@ if (ret_var.is_owned) { } return ret_ref; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKDirectionalChannelInfo arg_conv; +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKChannelUpdateInfo arg_conv; arg_conv.inner = (void*)(arg & (~1)); arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - intptr_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv); + intptr_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKDirectionalChannelInfo orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelUpdateInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37591,24 +39497,24 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clo return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKDirectionalChannelInfo obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelUpdateInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv); + LDKCVec_u8Z ret_var = ChannelUpdateInfo_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_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_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_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = DirectionalChannelInfo_read(ser_ref); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = ChannelUpdateInfo_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uintptr_t)ret_conv; } @@ -37686,7 +39592,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); + LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -37705,11 +39611,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo val_conv; + LDKChannelUpdateInfo val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = DirectionalChannelInfo_clone(&val_conv); + val_conv = ChannelUpdateInfo_clone(&val_conv); ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); } @@ -37748,7 +39654,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -37767,11 +39673,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo val_conv; + LDKChannelUpdateInfo val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = DirectionalChannelInfo_clone(&val_conv); + val_conv = ChannelUpdateInfo_clone(&val_conv); ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); } @@ -37890,6 +39796,169 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *e return (uintptr_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKDirectedChannelInfo this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + DirectedChannelInfo_free(this_obj_conv); +} + +static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) { + LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKDirectedChannelInfo arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKDirectedChannelInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelInfo this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelInfo this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv); + uintptr_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelInfo this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr); + FREE((void*)this_ptr); + EffectiveCapacity_free(this_ptr_conv); +} + +static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_clone(arg); +uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg; + intptr_t ret_val = EffectiveCapacity_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig; + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_clone(orig_conv); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_total(capacity_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_infinite(); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_unknown(); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg; + int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv); + return ret_val; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKRoutingFees this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -38566,7 +40635,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -38591,7 +40660,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -38623,6 +40692,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEn NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + NetworkGraph_remove_stale_channels(&this_arg_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -38999,12 +41076,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, Route_set_paths(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee ret_var = Route_get_payee(&this_ptr_conv); + LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -39018,20 +41095,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *e return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee val_conv; + LDKPaymentParameters val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = Payee_clone(&val_conv); - Route_set_payee(&this_ptr_conv, val_conv); + val_conv = PaymentParameters_clone(&val_conv); + Route_set_payment_params(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payee_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) { LDKCVec_CVec_RouteHopZZ paths_arg_constr; paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); if (paths_arg_constr.datalen > 0) @@ -39059,12 +41136,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jcl (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); paths_arg_constr.data[m] = paths_arg_conv_12_constr; } - LDKPayee payee_arg_conv; - payee_arg_conv.inner = (void*)(payee_arg & (~1)); - payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv); - payee_arg_conv = Payee_clone(&payee_arg_conv); - LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv); + LDKPaymentParameters payment_params_arg_conv; + payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1)); + payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv); + payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv); + LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39184,12 +41261,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv * RouteParameters_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKRouteParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv); + LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39201,17 +41278,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKRouteParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee val_conv; + LDKPaymentParameters val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = Payee_clone(&val_conv); - RouteParameters_set_payee(&this_ptr_conv, val_conv); + val_conv = PaymentParameters_clone(&val_conv); + RouteParameters_set_payment_params(&this_ptr_conv, val_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -39248,13 +41325,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1c 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 payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) { - LDKPayee payee_arg_conv; - payee_arg_conv.inner = (void*)(payee_arg & (~1)); - payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv); - payee_arg_conv = Payee_clone(&payee_arg_conv); - LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, 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, int32_t final_cltv_expiry_delta_arg) { + LDKPaymentParameters payment_params_arg_conv; + payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1)); + payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0); + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39326,41 +41403,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEn return (uintptr_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKPayee this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPaymentParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - Payee_free(this_obj_conv); + PaymentParameters_free(this_obj_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Payee_get_pubkey(&this_ptr_conv).compressed_form); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); LDKPublicKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 33); (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - Payee_set_pubkey(&this_ptr_conv, val_ref); + PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv); + LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -39374,8 +41451,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -39384,15 +41461,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *e val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); val_conv = InvoiceFeatures_clone(&val_conv); - Payee_set_features(&this_ptr_conv, val_conv); + PaymentParameters_set_features(&this_ptr_conv, val_conv); } -JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv); + LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_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); @@ -39413,8 +41490,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hin return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -39435,22 +41512,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEn val_constr.data[l] = val_conv_11_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); - Payee_set_route_hints(&this_ptr_conv, val_constr); + PaymentParameters_set_route_hints(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = Payee_get_expiry_time(&this_ptr_conv); + *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv); uintptr_t ret_ref = (uintptr_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -39458,13 +41535,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEn CHECK_ACCESS(val_ptr); LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); - Payee_set_expiry_time(&this_ptr_conv, val_conv); + PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg) { - LDKPublicKey pubkey_arg_ref; - CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); - (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + PaymentParameters_set_max_total_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) { + 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); LDKInvoiceFeatures features_arg_conv; features_arg_conv.inner = (void*)(features_arg & (~1)); features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); @@ -39491,7 +41585,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jcl CHECK_ACCESS(expiry_time_arg_ptr); LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr); expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1)); - LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv); + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39503,8 +41597,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jcl return ret_ref; } -static inline uintptr_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) { - LDKPayee ret_var = Payee_clone(arg); +static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) { + LDKPaymentParameters ret_var = PaymentParameters_clone(arg); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39515,21 +41609,21 @@ if (ret_var.is_owned) { } return ret_ref; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKPayee arg_conv; +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPaymentParameters arg_conv; arg_conv.inner = (void*)(arg & (~1)); arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - intptr_t ret_val = Payee_clone_ptr(&arg_conv); + intptr_t ret_val = PaymentParameters_clone_ptr(&arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKPayee orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentParameters orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKPayee ret_var = Payee_clone(&orig_conv); + LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39541,55 +41635,55 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, j return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKPayee o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - int64_t ret_val = Payee_hash(&o_conv); + int64_t ret_val = PaymentParameters_hash(&o_conv); return ret_val; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKPayee a_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPaymentParameters a_conv; a_conv.inner = (void*)(a & (~1)); a_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - LDKPayee b_conv; + LDKPaymentParameters b_conv; b_conv.inner = (void*)(b & (~1)); b_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); - jboolean ret_val = Payee_eq(&a_conv, &b_conv); + jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv); return ret_val; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKPayee obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPaymentParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = Payee_write(&obj_conv); + LDKCVec_u8Z ret_var = PaymentParameters_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_Payee_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) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = Payee_read(ser_ref); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = PaymentParameters_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray pubkey) { - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKPayee ret_var = Payee_from_node_id(pubkey_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39601,11 +41695,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray pubkey) { - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKPayee ret_var = Payee_for_keysend(pubkey_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -40038,14 +42132,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv * return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { LDKPublicKey our_node_pubkey_ref; CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33); (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form); - LDKRouteParameters params_conv; - params_conv.inner = (void*)(params & (~1)); - params_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + LDKRouteParameters route_params_conv; + route_params_conv.inner = (void*)(route_params & (~1)); + route_params_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); LDKNetworkGraph network_conv; network_conv.inner = (void*)(network & (~1)); network_conv.is_owned = false; @@ -40081,7 +42175,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); + *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uintptr_t)ret_conv; } @@ -40132,6 +42226,97 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_ return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKFixedPenaltyScorer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + FixedPenaltyScorer_free(this_obj_conv); +} + +static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) { + LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKFixedPenaltyScorer arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKFixedPenaltyScorer orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKFixedPenaltyScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = FixedPenaltyScorer_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_FixedPenaltyScorer_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_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = FixedPenaltyScorer_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) { + LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKFixedPenaltyScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv); + return (uintptr_t)ret_ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -40246,6 +42431,44 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIE return ret_ref; } +static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) { + LDKScoringParameters ret_var = ScoringParameters_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKScoringParameters arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = ScoringParameters_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKScoringParameters orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKScoringParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); @@ -40273,7 +42496,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jc params_conv.inner = (void*)(params & (~1)); params_conv.is_owned = (params & 1) || (params == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters + params_conv = ScoringParameters_clone(¶ms_conv); LDKScorer ret_var = Scorer_new(params_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -40344,6 +42567,134 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, j return (uintptr_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKProbabilisticScoringParameters this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ProbabilisticScoringParameters_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKProbabilisticScoringParameters arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKProbabilisticScoringParameters orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKProbabilisticScoringParameters obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_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_ProbabilisticScoringParameters_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_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = ProbabilisticScoringParameters_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default(); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKFilesystemPersister this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -40487,7 +42838,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(J this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - // Warning: we need a move here but no clone is available for LDKBackgroundProcessor + // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); *ret_conv = BackgroundProcessor_join(this_arg_conv); return (uintptr_t)ret_conv; @@ -40498,16 +42849,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(J this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - // Warning: we need a move here but no clone is available for LDKBackgroundProcessor + // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); *ret_conv = BackgroundProcessor_stop(this_arg_conv); return (uintptr_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) { - check_platform(); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKInvoice this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -41839,6 +44186,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1sy return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) { + LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); + *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPositiveTimestamp this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -41848,6 +44201,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix return ret_val; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPositiveTimestamp this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPositiveTimestamp this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -41905,6 +44267,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv * return ret_val; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInvoice this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv); + return ret_val; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -41982,6 +44353,15 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEn return ret_val; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) { + LDKInvoice this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -42083,15 +44463,29 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JN } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) { - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = ExpiryTime_from_seconds(seconds); - return (uintptr_t)ret_conv; + LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) { - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = ExpiryTime_from_duration(duration); - return (uintptr_t)ret_conv; + LDKExpiryTime ret_var = ExpiryTime_from_duration(duration); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -42162,13 +44556,13 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1ou return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount()); return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints()); return ret_conv; } @@ -42617,6 +45011,48 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHand return (uintptr_t)ret_ret; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, jstring description, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) { + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKStr description_conv = java_to_owned_str(env, description); + 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); + LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr; + phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints); + if (phantom_route_hints_constr.datalen > 0) + phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + phantom_route_hints_constr.data = NULL; + int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL); + for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) { + int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t]; + LDKPhantomRouteHints phantom_route_hints_conv_19_conv; + phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1)); + phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv); + phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv); + 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 = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_phantom_invoice(amt_msat_conv, description_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -42640,6 +45076,29 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan return (uintptr_t)ret_conv; } +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, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = (void*)(channelmanager & (~1)); + channelmanager_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKStr description_conv = java_to_owned_str(env, description); + 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, network_conv, amt_msat_conv, description_conv, duration_since_epoch); + return (uintptr_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKDefaultRouter this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index d8125731..38247398 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -305,8 +305,8 @@ static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass cl case 0: return LDKCreationError_DescriptionTooLong; case 1: return LDKCreationError_RouteTooLong; case 2: return LDKCreationError_TimestampOutOfBounds; - case 3: return LDKCreationError_ExpiryTimeOutOfBounds; - case 4: return LDKCreationError_InvalidAmount; + case 3: return LDKCreationError_InvalidAmount; + case 4: return LDKCreationError_MissingRouteHints; } (*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 @@ -315,8 +315,8 @@ static jclass CreationError_class = NULL; static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL; static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL; static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL; -static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL; static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL; +static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) { CreationError_class = (*env)->NewGlobalRef(env, clz); CHECK(CreationError_class != NULL); @@ -326,10 +326,10 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclas CHECK(CreationError_LDKCreationError_RouteTooLong != NULL); CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL); - CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;"); - CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL); CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_InvalidAmount != NULL); + CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;"); + CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL); } static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) { switch (val) { @@ -339,10 +339,10 @@ static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong); case LDKCreationError_TimestampOutOfBounds: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds); - case LDKCreationError_ExpiryTimeOutOfBounds: - return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds); case LDKCreationError_InvalidAmount: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount); + case LDKCreationError_MissingRouteHints: + return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints); default: abort(); } } @@ -633,6 +633,40 @@ static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) { } } +static inline LDKRecipient LDKRecipient_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 Recipient.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKRecipient_Node; + case 1: return LDKRecipient_PhantomNode; + } + (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass Recipient_class = NULL; +static jfieldID Recipient_LDKRecipient_Node = NULL; +static jfieldID Recipient_LDKRecipient_PhantomNode = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) { + Recipient_class = (*env)->NewGlobalRef(env, clz); + CHECK(Recipient_class != NULL); + Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;"); + CHECK(Recipient_LDKRecipient_Node != NULL); + Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;"); + CHECK(Recipient_LDKRecipient_PhantomNode != NULL); +} +static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) { + switch (val) { + case LDKRecipient_Node: + return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node); + case LDKRecipient_PhantomNode: + return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode); + 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))) { @@ -857,6 +891,60 @@ uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPO return ret_val; } +static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); + CResult_NoneNoneZ_get_ok(owner_conv); +} + +static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); + CResult_NoneNoneZ_get_err(owner_conv); +} + +static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return CounterpartyCommitmentSecrets_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1); + LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -1567,13 +1655,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from default: abort(); } } -static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return Payee_clone(&*owner->contents.result); + return PaymentParameters_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1); - LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1); + LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1585,13 +1673,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_ return ret_ref; } -static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1); - LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1773,7 +1861,7 @@ static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ } return ret; } -static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) { +static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) { LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]); @@ -2255,6 +2343,8 @@ static jclass LDKEvent_DiscardFunding_class = NULL; static jmethodID LDKEvent_DiscardFunding_meth = NULL; static jclass LDKEvent_PaymentPathSuccessful_class = NULL; static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL; +static jclass LDKEvent_OpenChannelRequest_class = NULL; +static jmethodID LDKEvent_OpenChannelRequest_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady")); @@ -2311,6 +2401,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_PaymentPathSuccessful_class != NULL); LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "", "([B[B[J)V"); CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL); + LDKEvent_OpenChannelRequest_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest")); + CHECK(LDKEvent_OpenChannelRequest_class != NULL); + LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJ)V"); + CHECK(LDKEvent_OpenChannelRequest_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -2431,6 +2526,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr); } + case LDKEvent_OpenChannelRequest: { + int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data); + int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form); + return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat); + } default: abort(); } } @@ -2503,6 +2605,8 @@ static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL; static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL; static jclass LDKErrorAction_SendErrorMessage_class = NULL; static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL; +static jclass LDKErrorAction_SendWarningMessage_class = NULL; +static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) { LDKErrorAction_DisconnectPeer_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer")); @@ -2529,6 +2633,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIE CHECK(LDKErrorAction_SendErrorMessage_class != NULL); LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "", "(J)V"); CHECK(LDKErrorAction_SendErrorMessage_meth != NULL); + LDKErrorAction_SendWarningMessage_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage")); + CHECK(LDKErrorAction_SendWarningMessage_class != NULL); + LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "", "(JLorg/ldk/enums/Level;)V"); + CHECK(LDKErrorAction_SendWarningMessage_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1); @@ -2563,6 +2672,16 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 msg_ref = (uintptr_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref); } + case LDKErrorAction_SendWarningMessage: { + LDKWarningMessage msg_var = obj->send_warning_message.msg; + uintptr_t msg_ref = 0; + CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = (uintptr_t)msg_var.inner & ~1; + jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level); + return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv); + } default: abort(); } } @@ -2918,18 +3037,57 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return &*owner->contents.result; + return FixedPenaltyScorer_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1); + LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ScoringParameters_clone(&*owner->contents.result); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1); - LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv); + LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner & ~1; + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } @@ -2984,6 +3142,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ return ret_ref; } +static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ProbabilisticScoringParameters_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); + LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return InitFeatures_clone(&*owner->contents.result); @@ -3266,24 +3460,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDes return ret_ref; } -static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); - CResult_NoneNoneZ_get_ok(owner_conv); -} - -static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1); - CResult_NoneNoneZ_get_err(owner_conv); +static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) { + LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]); + } + return ret; } - static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){ return owner->a; } @@ -3352,6 +3535,66 @@ 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*)(owner & ~1); + 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*)(owner & ~1); + 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*)(owner & ~1); + LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); + *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv); + return ((uintptr_t)ret_conv); +} + +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*)(owner & ~1); + 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*)(owner & ~1); + 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*)(owner & ~1); + CResult_SecretKeyNoneZ_get_err(owner_conv); +} + typedef struct LDKBaseSign_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -3435,7 +3678,7 @@ 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) { +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; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -3454,9 +3697,20 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th if (holder_tx_var.is_owned) { holder_tx_ref |= 1; } + LDKCVec_PaymentPreimageZ preimages_var = preimages; + jobjectArray preimages_arr = NULL; + preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL); + ; + for (size_t i = 0; i < preimages_var.datalen; i++) { + int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data); + (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr); + } + + FREE(preimages_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref); + 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."); @@ -3494,7 +3748,7 @@ 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) { +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; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -3513,9 +3767,20 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L if (commitment_tx_var.is_owned) { commitment_tx_ref |= 1; } + LDKCVec_PaymentPreimageZ preimages_var = preimages; + jobjectArray preimages_arr = NULL; + preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL); + ; + for (size_t i = 0; i < preimages_var.datalen; i++) { + int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data); + (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr); + } + + FREE(preimages_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref); + 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."); @@ -3739,7 +4004,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* } return ret_conv; } -LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { +LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { 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); @@ -3767,7 +4032,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void } void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); CHECK_ACCESS(ret_ptr); - LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr); FREE((void*)ret); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -3815,11 +4080,11 @@ static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, 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)J"); + 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)J"); + 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"); CHECK(calls->validate_counterparty_revocation_meth != NULL); @@ -3887,7 +4152,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1comm 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) { +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 = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; @@ -3895,8 +4160,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_ holder_tx_conv.inner = (void*)(holder_tx & (~1)); holder_tx_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); + 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); + *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); return (uintptr_t)ret_conv; } @@ -3909,7 +4187,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys return ret_arr; } -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) { +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) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; @@ -3917,8 +4195,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterpart commitment_tx_conv.inner = (void*)(commitment_tx & (~1)); commitment_tx_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv); + 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_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ"); - *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv); + *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr); return (uintptr_t)ret_conv; } @@ -4030,7 +4321,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1an msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); - LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + 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); return (uintptr_t)ret_conv; } @@ -4920,6 +5211,150 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPI return ret_ref; } +static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return CounterpartyForwardingInfo_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1); + LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ChannelCounterparty_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1); + LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ChannelDetails_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1); + LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return PhantomRouteHints_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1); + LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) { LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -5279,7 +5714,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { +LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { 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); @@ -5288,20 +5723,22 @@ LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { } 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); - int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception."); } - LDKSecretKey ret_ref; - CHECK((*env)->GetArrayLength(env, ret) == 32); - (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes); + void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr); + FREE((void*)ret); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_ref; + return ret_conv; } LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -5430,7 +5867,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* } return ret_conv; } -LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) { +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; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -5439,13 +5876,23 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKCVec_u8Z invoice_preimage_var = invoice_preimage; - int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen); - (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data); - CVec_u8Z_free(invoice_preimage_var); + 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, invoice_preimage_arr); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception."); @@ -5494,7 +5941,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j 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", "()[B"); + 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_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B"); CHECK(calls->get_destination_script_meth != NULL); @@ -5506,7 +5953,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j 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)J"); + 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); @@ -5530,13 +5977,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEn *res_ptr = LDKKeysInterface_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { +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 = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { 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_node_secret)(this_arg_conv->this_arg).bytes); - return ret_arr; + 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 (uintptr_t)ret_conv; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -5597,16 +6045,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1 return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) { +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) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; - LDKCVec_u8Z invoice_preimage_ref; - invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage); - invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data); + 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, invoice_preimage_ref); + *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 (uintptr_t)ret_conv; } @@ -6442,34 +6904,6 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreation return ret_conv; } -static inline struct LDKExpiryTime CResult_ExpiryTimeCreationErrorZ_get_ok(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return ExpiryTime_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ExpiryTimeCreationErrorZ* owner_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(owner & ~1); - LDKExpiryTime ret_var = CResult_ExpiryTimeCreationErrorZ_get_ok(owner_conv); - uintptr_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline enum LDKCreationError CResult_ExpiryTimeCreationErrorZ_get_err(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return CreationError_clone(&*owner->contents.err); -} -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ExpiryTimeCreationErrorZ* owner_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(owner & ~1); - jclass ret_conv = LDKCreationError_to_java(env, CResult_ExpiryTimeCreationErrorZ_get_err(owner_conv)); - return ret_conv; -} - static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return PrivateRoute_clone(&*owner->contents.result); @@ -7306,7 +7740,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1f case LDKCOption_AccessZ_Some: { LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess"); *some_ret = obj->some; - // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances + // 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 this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKAccess_JCalls_cloned(&(*some_ret)); @@ -7319,13 +7753,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1f default: abort(); } } -static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return DirectionalChannelInfo_clone(&*owner->contents.result); + return ChannelUpdateInfo_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1); - LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1); + LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -7337,13 +7771,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannel return ret_ref; } -static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1); - LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -8535,6 +8969,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecode return ret_ref; } +static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return WarningMessage_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1); + LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1); + LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return UnsignedNodeAnnouncement_clone(&*owner->contents.result); @@ -8787,6 +9257,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFil return ret_ref; } +static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) { + LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = PhantomRouteHints_clone(&orig->data[i]); + } + return ret; +} static jclass LDKSignOrCreationError_SignError_class = NULL; static jmethodID LDKSignOrCreationError_SignError_meth = NULL; static jclass LDKSignOrCreationError_CreationError_class = NULL; @@ -9010,7 +9487,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f case LDKCOption_FilterZ_Some: { LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter"); *some_ret = obj->some; - // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances + // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances if ((*some_ret).free == LDKFilter_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKFilter_JCalls_cloned(&(*some_ret)); @@ -12038,6 +12515,64 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIE return ret_val; } +static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL; +static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL; +static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL; +static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL; +static jclass LDKEffectiveCapacity_Total_class = NULL; +static jmethodID LDKEffectiveCapacity_Total_meth = NULL; +static jclass LDKEffectiveCapacity_Infinite_class = NULL; +static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL; +static jclass LDKEffectiveCapacity_Unknown_class = NULL; +static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) { + LDKEffectiveCapacity_ExactLiquidity_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity")); + CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL); + LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "", "(J)V"); + CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL); + LDKEffectiveCapacity_MaximumHTLC_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC")); + CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL); + LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "", "(J)V"); + CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL); + LDKEffectiveCapacity_Total_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total")); + CHECK(LDKEffectiveCapacity_Total_class != NULL); + LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "", "(J)V"); + CHECK(LDKEffectiveCapacity_Total_meth != NULL); + LDKEffectiveCapacity_Infinite_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite")); + CHECK(LDKEffectiveCapacity_Infinite_class != NULL); + LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "", "()V"); + CHECK(LDKEffectiveCapacity_Infinite_meth != NULL); + LDKEffectiveCapacity_Unknown_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown")); + CHECK(LDKEffectiveCapacity_Unknown_class != NULL); + LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "", "()V"); + CHECK(LDKEffectiveCapacity_Unknown_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1); + switch(obj->tag) { + case LDKEffectiveCapacity_ExactLiquidity: { + return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, obj->exact_liquidity.liquidity_msat); + } + case LDKEffectiveCapacity_MaximumHTLC: { + return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, obj->maximum_htlc.amount_msat); + } + case LDKEffectiveCapacity_Total: { + return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, obj->total.capacity_msat); + } + case LDKEffectiveCapacity_Infinite: { + return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth); + } + case LDKEffectiveCapacity_Unknown: { + return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth); + } + default: abort(); + } +} typedef struct LDKScore_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -12064,7 +12599,7 @@ static void LDKScore_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -12073,9 +12608,6 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *channel_capacity_msat_copy = channel_capacity_msat; - uintptr_t channel_capacity_msat_ref = (uintptr_t)channel_capacity_msat_copy; LDKNodeId source_var = *source; uintptr_t source_ref = 0; source_var = NodeId_clone(source); @@ -12098,7 +12630,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref); + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, capacity_msat, source_ref, target_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); @@ -12244,14 +12776,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, *res_ptr = LDKScore_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t channel_capacity_msat, int64_t source, int64_t target) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t capacity_msat, int64_t source, int64_t target) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; - void* channel_capacity_msat_ptr = (void*)(((uintptr_t)channel_capacity_msat) & ~1); - CHECK_ACCESS(channel_capacity_msat_ptr); - LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr); - channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)channel_capacity_msat) & ~1)); LDKNodeId source_conv; source_conv.inner = (void*)(source & (~1)); source_conv.is_owned = false; @@ -12260,7 +12788,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1ms target_conv.inner = (void*)(target & (~1)); target_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, capacity_msat, &source_conv, &target_conv); return ret_val; } @@ -12368,7 +12896,7 @@ LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { if (ret_conv.free == LDKScore_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKScore_JCalls_cloned(&ret_conv); - }// Warning: we may need a move here but no clone is available for LDKScore + }// WARNING: we may need a move here but no clone is available for LDKScore if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -12444,7 +12972,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi } LDKChannelManager channel_manager_var = *channel_manager; uintptr_t channel_manager_ref = 0; - // Warning: we may need a move here but no clone is available for LDKChannelManager + // WARNING: we may need a move here but no clone is available for LDKChannelManager CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var); @@ -12936,7 +13464,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { 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); @@ -12947,15 +13475,15 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, } int8_tArray payer_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form); - LDKRouteParameters params_var = *params; - uintptr_t params_ref = 0; - params_var = RouteParameters_clone(params); - CHECK((((uintptr_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var); - params_ref = (uintptr_t)params_var.inner; - if (params_var.is_owned) { - params_ref |= 1; + LDKRouteParameters route_params_var = *route_params; + uintptr_t route_params_ref = 0; + route_params_var = RouteParameters_clone(route_params); + CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = (uintptr_t)route_params_var.inner; + if (route_params_var.is_owned) { + route_params_ref |= 1; } int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash); @@ -12983,7 +13511,7 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, uintptr_t ret_scorer = ((uintptr_t)scorer) | 1; 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, params_ref, payment_hash_arr, first_hops_arr, ret_scorer); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, ret_scorer); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); @@ -13023,17 +13551,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, *res_ptr = LDKRouter_init(env, clz, o); return (uint64_t)res_ptr; } -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 params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) { +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, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { 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 params_conv; - params_conv.inner = (void*)(params & (~1)); - params_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + LDKRouteParameters route_params_conv; + route_params_conv.inner = (void*)(route_params & (~1)); + route_params_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); unsigned char payment_hash_arr[32]; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); @@ -13062,7 +13590,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uintptr_t)ret_conv; } @@ -13132,6 +13660,106 @@ 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_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_ok(); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_err(); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1); + jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_NoneNoneZ_free(_res_conv); +} + +static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) { + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1); + intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CResult_NoneNoneZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCounterpartyCommitmentSecrets o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = CounterpartyCommitmentSecrets_clone(&o_conv); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1); + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKSecretKey o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -13163,6 +13791,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free CResult_SecretKeyErrorZ_free(_res_conv); } +static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) { + LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); + *ret_conv = CResult_SecretKeyErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1); + LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); + *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKPublicKey o_ref; CHECK((*env)->GetArrayLength(env, o) == 33); @@ -13728,7 +14374,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTran o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction + // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ"); *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -13815,7 +14461,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentT o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction + // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ"); *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -14334,58 +14980,58 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKPayee o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Payee_clone(&o_conv); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv); + o_conv = PaymentParameters_clone(&o_conv); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv); return (uintptr_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr); + LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_PayeeDecodeErrorZ_free(_res_conv); + CResult_PaymentParametersDecodeErrorZ_free(_res_conv); } -static inline uintptr_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg); +static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg); return (uintptr_t)ret_conv; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1); - intptr_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv); +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv); return (uintptr_t)ret_conv; } @@ -15121,12 +15767,67 @@ 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_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKFixedPenaltyScorer o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = FixedPenaltyScorer_clone(&o_conv); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKScoringParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters + o_conv = ScoringParameters_clone(&o_conv); LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -15158,12 +15859,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDeco CResult_ScoringParametersDecodeErrorZ_free(_res_conv); } +static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKScorer o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScorer + // WARNING: we need a move here but no clone is available for LDKScorer LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -15195,6 +15914,61 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1f CResult_ScorerDecodeErrorZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKProbabilisticScoringParameters o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = ProbabilisticScoringParameters_clone(&o_conv); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1); + LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInitFeatures o_conv; o_conv.inner = (void*)(o & (~1)); @@ -15544,49 +16318,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDes return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) { - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_ok(); - return (uintptr_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_err(); - return (uintptr_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1); - jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr); - FREE((void*)_res); - CResult_NoneNoneZ_free(_res_conv); -} - -static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) { - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_clone(arg); - return (uintptr_t)ret_conv; -} -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1); - intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1); - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = CResult_NoneNoneZ_clone(orig_conv); - return (uintptr_t)ret_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) { + LDKCVec_PaymentPreimageZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); + else + _res_constr.data = NULL; + for (size_t i = 0; i < _res_constr.datalen; i++) { + int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); + LDKThirtyTwoBytes _res_conv_8_ref; + CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32); + (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data); + _res_constr.data[i] = _res_conv_8_ref; + } + CVec_PaymentPreimageZ_free(_res_constr); } static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) { @@ -15735,6 +16481,142 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1cl return (uintptr_t)ret_conv; } +static inline uintptr_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 ((uintptr_t)ret_conv); +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1); + intptr_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv); + return ret_val; +} + +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*)(orig & ~1); + LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); + *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv); + return ((uintptr_t)ret_conv); +} + +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 ((uintptr_t)ret_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr); + FREE((void*)_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 = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr); + o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1)); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); + *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +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 (uintptr_t)ret_conv; +} + +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*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv); +} + +static inline uintptr_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 (uintptr_t)ret_conv; +} +JNIEXPORT intptr_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*)(arg & ~1); + intptr_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +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*)(orig & ~1); + LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); + *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +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 (uintptr_t)ret_conv; +} + +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 (uintptr_t)ret_conv; +} + +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*)(o & ~1); + jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_SecretKeyNoneZ_free(_res_conv); +} + +static inline uintptr_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 (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1); + intptr_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +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*)(orig & ~1); + LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); + *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = (void*)(((uintptr_t)o) & ~1); CHECK_ACCESS(o_ptr); @@ -15792,12 +16674,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1 return (uintptr_t)ret_conv; } -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); - _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data); - CVec_u8Z_free(_res_ref); +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); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + else + _res_constr.data = NULL; + int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL); + for (size_t h = 0; h < _res_constr.datalen; h++) { + int8_t _res_conv_7 = _res_vals[h]; + + _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 }; + } + (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0); + CVec_u5Z_free(_res_constr); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { @@ -15848,6 +16739,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatu return (uintptr_t)ret_conv; } +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); + _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data); + CVec_u8Z_free(_res_ref); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) { LDKCVec_CVec_u8ZZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -16863,6 +17762,226 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPI return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCounterpartyForwardingInfo o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = CounterpartyForwardingInfo_clone(&o_conv); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1); + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelCounterparty o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = ChannelCounterparty_clone(&o_conv); + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelDetails o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = ChannelDetails_clone(&o_conv); + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_ChannelDetailsDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPhantomRouteHints o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = PhantomRouteHints_clone(&o_conv); + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1); + LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_ChannelMonitorZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -16891,7 +18010,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMa b_conv.inner = (void*)(b & (~1)); b_conv.is_owned = (b & 1) || (b == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); - // Warning: we need a move here but no clone is available for LDKChannelManager + // WARNING: we need a move here but no clone is available for LDKChannelManager LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ"); *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv); return ((uintptr_t)ret_conv); @@ -16910,7 +18029,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHash void* o_ptr = (void*)(((uintptr_t)o) & ~1); CHECK_ACCESS(o_ptr); LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr); - // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ + // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ"); *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -17670,57 +18789,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreatio return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKExpiryTime o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = ExpiryTime_clone(&o_conv); - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv); - return (uintptr_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { - LDKCreationError e_conv = LDKCreationError_from_java(env, e); - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv); - return (uintptr_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1); - jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_ExpiryTimeCreationErrorZ_free(_res_conv); -} - -static inline uintptr_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) { - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg); - return (uintptr_t)ret_conv; -} -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1); - intptr_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1); - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv); - return (uintptr_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKPrivateRoute o_conv; o_conv.inner = (void*)(o & (~1)); @@ -18986,58 +20054,58 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv COption_AccessZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKDirectionalChannelInfo o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelUpdateInfo o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = DirectionalChannelInfo_clone(&o_conv); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv); + o_conv = ChannelUpdateInfo_clone(&o_conv); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv); return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv); return (uintptr_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr); + LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv); + CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv); } -static inline uintptr_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg); +static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg); return (uintptr_t)ret_conv; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1); - intptr_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv); +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv); return (uintptr_t)ret_conv; } @@ -20900,6 +21968,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecode return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKWarningMessage o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = WarningMessage_clone(&o_conv); + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv); + return (uintptr_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_WarningMessageDecodeErrorZ_free(_res_conv); +} + +static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg); + return (uintptr_t)ret_conv; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1); + intptr_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1); + LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKUnsignedNodeAnnouncement o_conv; o_conv.inner = (void*)(o & (~1)); @@ -21285,6 +22408,26 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFil return (uintptr_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_PhantomRouteHintsZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t t = 0; t < _res_constr.datalen; t++) { + int64_t _res_conv_19 = _res_vals[t]; + LDKPhantomRouteHints _res_conv_19_conv; + _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1)); + _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv); + _res_constr.data[t] = _res_conv_19_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_PhantomRouteHintsZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInvoice o_conv; o_conv.inner = (void*)(o & (~1)); @@ -21374,7 +22517,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonit o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor + // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv); return (uintptr_t)ret_conv; @@ -21812,6 +22955,19 @@ 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_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat) { + LDKThirtyTwoBytes temporary_channel_id_ref; + CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); + (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data); + 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); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -22285,6 +23441,31 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass return ret_val; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) { + 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 data_without_signature_constr; + data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature); + if (data_without_signature_constr.datalen > 0) + data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + else + data_without_signature_constr.data = NULL; + int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL); + for (size_t h = 0; h < data_without_signature_constr.datalen; h++) { + int8_t data_without_signature_conv_7 = data_without_signature_vals[h]; + + data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 }; + } + (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0); + LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr); + 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); + (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0); + return ret_arr; +} + JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKLevel* orig_conv = (LDKLevel*)(orig & ~1); jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv)); @@ -23165,7 +24346,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbou UserConfig_set_accept_inbound_channels(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) { +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) { LDKChannelHandshakeConfig own_channel_config_arg_conv; own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1)); own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0); @@ -23181,7 +24379,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); - LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); + LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -23713,7 +24911,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *e void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1); CHECK_ACCESS(chain_source_ptr); LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr); - // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ + // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ if (chain_source_conv.tag == LDKCOption_FilterZ_Some) { // Manually implement clone for Java trait instances if (chain_source_conv.some.free == LDKFilter_JCalls_free) { @@ -25398,6 +26596,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass Sign_free(this_ptr_conv); } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1); + jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRecipient_to_java(env, Recipient_node()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node()); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -25579,7 +26793,10 @@ 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 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) { +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); LDKSecretKey funding_key_ref; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes); @@ -25601,7 +26818,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(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(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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -25770,12 +26987,15 @@ 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) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) { 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); + *ret_conv = InMemorySigner_read(ser_ref, arg_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uintptr_t)ret_conv; } @@ -25882,6 +27102,112 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterf return (uintptr_t)ret_ret; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPhantomKeysManager this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + 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) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); + *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv); + return (uintptr_t)ret_ret; +} + +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]; + 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]; + 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; + LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKCVec_SpendableOutputDescriptorZ descriptors_constr; + descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors); + if (descriptors_constr.datalen > 0) + descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements"); + else + descriptors_constr.data = NULL; + int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL); + for (size_t b = 0; b < descriptors_constr.datalen; b++) { + int64_t descriptors_conv_27 = descriptors_vals[b]; + void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1); + CHECK_ACCESS(descriptors_conv_27_ptr); + LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr); + descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1)); + descriptors_constr.data[b] = descriptors_conv_27_conv; + } + (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0); + LDKCVec_TxOutZ outputs_constr; + outputs_constr.datalen = (*env)->GetArrayLength(env, outputs); + if (outputs_constr.datalen > 0) + outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements"); + else + outputs_constr.data = NULL; + int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL); + for (size_t h = 0; h < outputs_constr.datalen; h++) { + int64_t outputs_conv_7 = outputs_vals[h]; + void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1); + CHECK_ACCESS(outputs_conv_7_ptr); + LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr); + outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1)); + outputs_constr.data[h] = outputs_conv_7_conv; + } + (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0); + LDKCVec_u8Z change_destination_script_ref; + change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script); + change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data); + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { + LDKPhantomKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + unsigned char params_arr[32]; + CHECK((*env)->GetArrayLength(env, params) == 32); + (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); + unsigned char (*params_ref)[32] = ¶ms_arr; + LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT 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 = (void*)(this_obj & (~1)); @@ -26816,6 +28142,174 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPhantomRouteHints this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + PhantomRouteHints_free(this_obj_conv); +} + +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_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 q = 0; q < ret_var.datalen; q++) { + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + uintptr_t ret_conv_16_ref = 0; + CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var); + ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; + } + 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 void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCVec_ChannelDetailsZ val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); + for (size_t q = 0; q < val_constr.datalen; q++) { + int64_t val_conv_16 = val_vals[q]; + LDKChannelDetails val_conv_16_conv; + val_conv_16_conv.inner = (void*)(val_conv_16 & (~1)); + val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv); + val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv); + val_constr.data[q] = val_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); + PhantomRouteHints_set_channels(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKPhantomRouteHints this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) { + LDKCVec_ChannelDetailsZ channels_arg_constr; + channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg); + if (channels_arg_constr.datalen > 0) + channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + channels_arg_constr.data = NULL; + int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL); + for (size_t q = 0; q < channels_arg_constr.datalen; q++) { + int64_t channels_arg_conv_16 = channels_arg_vals[q]; + LDKChannelDetails channels_arg_conv_16_conv; + channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1)); + channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv); + channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv); + channels_arg_constr.data[q] = channels_arg_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0); + LDKPublicKey real_node_pubkey_arg_ref; + CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33); + (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form); + LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) { + LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPhantomRouteHints arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPhantomRouteHints orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_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) { void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1); CHECK_ACCESS(fee_est_ptr); @@ -27175,6 +28669,20 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + unsigned char 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; + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref); + return (uintptr_t)ret_conv; +} + 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) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -27253,6 +28761,32 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1paymen return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -27337,6 +28871,94 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Channel return (uintptr_t)ret_ret; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKCounterpartyForwardingInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_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_CounterpartyForwardingInfo_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_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ"); + *ret_conv = CounterpartyForwardingInfo_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelCounterparty obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelCounterparty_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_ChannelCounterparty_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_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ"); + *ret_conv = ChannelCounterparty_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelDetails obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelDetails_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_ChannelDetails_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_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ"); + *ret_conv = ChannelDetails_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPhantomRouteHints obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = PhantomRouteHints_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_PhantomRouteHints_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_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ"); + *ret_conv = PhantomRouteHints_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKChannelManager obj_conv; obj_conv.inner = (void*)(obj & (~1)); @@ -27589,7 +29211,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMa arg_conv.inner = (void*)(arg & (~1)); arg_conv.is_owned = (arg & 1) || (arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs + // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ"); *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); @@ -27840,6 +29462,110 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKWarningMessage this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + WarningMessage_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv)); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKThirtyTwoBytes val_ref; + CHECK((*env)->GetArrayLength(env, val) == 32); + (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); + WarningMessage_set_channel_id(&this_ptr_conv, val_ref); +} + +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv); + jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) { + LDKWarningMessage this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKStr val_conv = java_to_owned_str(env, val); + WarningMessage_set_data(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) { + LDKThirtyTwoBytes channel_id_arg_ref; + CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); + (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); + LDKStr data_arg_conv = java_to_owned_str(env, data_arg); + LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) { + LDKWarningMessage ret_var = WarningMessage_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKWarningMessage arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = WarningMessage_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKWarningMessage orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKPing this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -28699,6 +30425,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKAcceptChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv); + uintptr_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKAcceptChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + AcceptChannel_set_channel_type(&this_ptr_conv, val_conv); +} + static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) { LDKAcceptChannel ret_var = AcceptChannel_clone(arg); uintptr_t ret_ref = 0; @@ -32407,6 +34165,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1m return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) { + LDKWarningMessage msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = WarningMessage_clone(&msg_conv); + LDKLevel log_level_conv = LDKLevel_from_java(env, log_level); + LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction"); + *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKLightningError this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -33485,6 +35256,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * return (uintptr_t)ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKWarningMessage obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = WarningMessage_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_WarningMessage_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_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ"); + *ret_conv = WarningMessage_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKUnsignedNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); @@ -33964,7 +35757,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *en message_handler_conv.inner = (void*)(message_handler & (~1)); message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv); - // Warning: we need a move here but no clone is available for LDKMessageHandler + // 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); @@ -34171,6 +35964,119 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transac return ret_arr; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKCounterpartyCommitmentSecrets this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + CounterpartyCommitmentSecrets_free(this_obj_conv); +} + +static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) { + LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCounterpartyCommitmentSecrets arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCounterpartyCommitmentSecrets orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) { + LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new(); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKCounterpartyCommitmentSecrets this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) { + LDKCounterpartyCommitmentSecrets this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes secret_ref; + CHECK((*env)->GetArrayLength(env, secret) == 32); + (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + LDKCounterpartyCommitmentSecrets this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKCounterpartyCommitmentSecrets obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_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_CounterpartyCommitmentSecrets_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_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ"); + *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) { LDKPublicKey per_commitment_point_ref; CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33); @@ -37297,7 +39203,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -37332,7 +39238,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -37363,95 +39269,95 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1Mes return (uintptr_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKDirectionalChannelInfo this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelUpdateInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - DirectionalChannelInfo_free(this_obj_conv); + ChannelUpdateInfo_free(this_obj_conv); } -JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); + int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); + ChannelUpdateInfo_set_last_update(&this_ptr_conv, val); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); + jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); + ChannelUpdateInfo_set_enabled(&this_ptr_conv, val); } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); + int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); + ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); + int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); + ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); + *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv); uintptr_t ret_ref = (uintptr_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -37459,15 +39365,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1h CHECK_ACCESS(val_ptr); LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); - DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37479,8 +39385,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -37489,15 +39395,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1f val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); val_conv = RoutingFees_clone(&val_conv); - DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -37511,8 +39417,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelUpdateInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -37521,10 +39427,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1l val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); val_conv = ChannelUpdate_clone(&val_conv); - DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); + ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1); CHECK_ACCESS(htlc_maximum_msat_arg_ptr); LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr); @@ -37539,7 +39445,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv); last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37551,8 +39457,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new return ret_ref; } -static inline uintptr_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) { - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg); +static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) { + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37563,21 +39469,21 @@ if (ret_var.is_owned) { } return ret_ref; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKDirectionalChannelInfo arg_conv; +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKChannelUpdateInfo arg_conv; arg_conv.inner = (void*)(arg & (~1)); arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - intptr_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv); + intptr_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKDirectionalChannelInfo orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelUpdateInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -37589,24 +39495,24 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clo return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKDirectionalChannelInfo obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelUpdateInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv); + LDKCVec_u8Z ret_var = ChannelUpdateInfo_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_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_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_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = DirectionalChannelInfo_read(ser_ref); + LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ"); + *ret_conv = ChannelUpdateInfo_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uintptr_t)ret_conv; } @@ -37684,7 +39590,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); + LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -37703,11 +39609,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo val_conv; + LDKChannelUpdateInfo val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = DirectionalChannelInfo_clone(&val_conv); + val_conv = ChannelUpdateInfo_clone(&val_conv); ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); } @@ -37746,7 +39652,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1 this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -37765,11 +39671,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKDirectionalChannelInfo val_conv; + LDKChannelUpdateInfo val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = DirectionalChannelInfo_clone(&val_conv); + val_conv = ChannelUpdateInfo_clone(&val_conv); ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); } @@ -37888,6 +39794,169 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *e return (uintptr_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKDirectedChannelInfo this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + DirectedChannelInfo_free(this_obj_conv); +} + +static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) { + LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKDirectedChannelInfo arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKDirectedChannelInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelInfo this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelInfo this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv); + uintptr_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelInfo this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr); + FREE((void*)this_ptr); + EffectiveCapacity_free(this_ptr_conv); +} + +static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_clone(arg); +uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg; + intptr_t ret_val = EffectiveCapacity_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig; + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_clone(orig_conv); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_total(capacity_msat); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_infinite(); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) { + LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); + *ret_copy = EffectiveCapacity_unknown(); + uintptr_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg; + int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv); + return ret_val; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKRoutingFees this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -38564,7 +40633,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -38589,7 +40658,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1); 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 + // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { // Manually implement clone for Java trait instances if (chain_access_conv.some.free == LDKAccess_JCalls_free) { @@ -38621,6 +40690,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEn NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + NetworkGraph_remove_stale_channels(&this_arg_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -38997,12 +41074,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, Route_set_paths(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee ret_var = Route_get_payee(&this_ptr_conv); + LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -39016,20 +41093,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *e return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee val_conv; + LDKPaymentParameters val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = Payee_clone(&val_conv); - Route_set_payee(&this_ptr_conv, val_conv); + val_conv = PaymentParameters_clone(&val_conv); + Route_set_payment_params(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payee_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) { LDKCVec_CVec_RouteHopZZ paths_arg_constr; paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); if (paths_arg_constr.datalen > 0) @@ -39057,12 +41134,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jcl (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); paths_arg_constr.data[m] = paths_arg_conv_12_constr; } - LDKPayee payee_arg_conv; - payee_arg_conv.inner = (void*)(payee_arg & (~1)); - payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv); - payee_arg_conv = Payee_clone(&payee_arg_conv); - LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv); + LDKPaymentParameters payment_params_arg_conv; + payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1)); + payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv); + payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv); + LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39182,12 +41259,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv * RouteParameters_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKRouteParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv); + LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39199,17 +41276,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { LDKRouteParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKPayee val_conv; + LDKPaymentParameters val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = Payee_clone(&val_conv); - RouteParameters_set_payee(&this_ptr_conv, val_conv); + val_conv = PaymentParameters_clone(&val_conv); + RouteParameters_set_payment_params(&this_ptr_conv, val_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -39246,13 +41323,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1c 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 payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) { - LDKPayee payee_arg_conv; - payee_arg_conv.inner = (void*)(payee_arg & (~1)); - payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv); - payee_arg_conv = Payee_clone(&payee_arg_conv); - LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, 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, int32_t final_cltv_expiry_delta_arg) { + LDKPaymentParameters payment_params_arg_conv; + payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1)); + payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0); + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39324,41 +41401,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEn return (uintptr_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKPayee this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPaymentParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - Payee_free(this_obj_conv); + PaymentParameters_free(this_obj_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Payee_get_pubkey(&this_ptr_conv).compressed_form); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); LDKPublicKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 33); (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - Payee_set_pubkey(&this_ptr_conv, val_ref); + PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv); + LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv); uintptr_t ret_ref = 0; if ((uintptr_t)ret_var.inner > 4096) { CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -39372,8 +41449,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -39382,15 +41459,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *e val_conv.is_owned = (val & 1) || (val == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); val_conv = InvoiceFeatures_clone(&val_conv); - Payee_set_features(&this_ptr_conv, val_conv); + PaymentParameters_set_features(&this_ptr_conv, val_conv); } -JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv); + LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_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); @@ -39411,8 +41488,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hin return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -39433,22 +41510,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEn val_constr.data[l] = val_conv_11_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); - Payee_set_route_hints(&this_ptr_conv, val_constr); + PaymentParameters_set_route_hints(&this_ptr_conv, val_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPayee this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = Payee_get_expiry_time(&this_ptr_conv); + *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv); uintptr_t ret_ref = (uintptr_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKPayee this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKPaymentParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); @@ -39456,13 +41533,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEn CHECK_ACCESS(val_ptr); LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); - Payee_set_expiry_time(&this_ptr_conv, val_conv); + PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg) { - LDKPublicKey pubkey_arg_ref; - CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); - (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKPaymentParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + PaymentParameters_set_max_total_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) { + 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); LDKInvoiceFeatures features_arg_conv; features_arg_conv.inner = (void*)(features_arg & (~1)); features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); @@ -39489,7 +41583,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jcl CHECK_ACCESS(expiry_time_arg_ptr); LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr); expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1)); - LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv); + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39501,8 +41595,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jcl return ret_ref; } -static inline uintptr_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) { - LDKPayee ret_var = Payee_clone(arg); +static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) { + LDKPaymentParameters ret_var = PaymentParameters_clone(arg); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39513,21 +41607,21 @@ if (ret_var.is_owned) { } return ret_ref; } -JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKPayee arg_conv; +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPaymentParameters arg_conv; arg_conv.inner = (void*)(arg & (~1)); arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - intptr_t ret_val = Payee_clone_ptr(&arg_conv); + intptr_t ret_val = PaymentParameters_clone_ptr(&arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKPayee orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentParameters orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKPayee ret_var = Payee_clone(&orig_conv); + LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39539,55 +41633,55 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, j return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKPayee o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - int64_t ret_val = Payee_hash(&o_conv); + int64_t ret_val = PaymentParameters_hash(&o_conv); return ret_val; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKPayee a_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPaymentParameters a_conv; a_conv.inner = (void*)(a & (~1)); a_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - LDKPayee b_conv; + LDKPaymentParameters b_conv; b_conv.inner = (void*)(b & (~1)); b_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); - jboolean ret_val = Payee_eq(&a_conv, &b_conv); + jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv); return ret_val; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKPayee obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPaymentParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = Payee_write(&obj_conv); + LDKCVec_u8Z ret_var = PaymentParameters_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_Payee_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) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ"); - *ret_conv = Payee_read(ser_ref); + LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); + *ret_conv = PaymentParameters_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray pubkey) { - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKPayee ret_var = Payee_from_node_id(pubkey_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39599,11 +41693,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray pubkey) { - LDKPublicKey pubkey_ref; - CHECK((*env)->GetArrayLength(env, pubkey) == 33); - (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); - LDKPayee ret_var = Payee_for_keysend(pubkey_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) { + 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); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -40036,14 +42130,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv * return (uintptr_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { LDKPublicKey our_node_pubkey_ref; CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33); (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form); - LDKRouteParameters params_conv; - params_conv.inner = (void*)(params & (~1)); - params_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + LDKRouteParameters route_params_conv; + route_params_conv.inner = (void*)(route_params & (~1)); + route_params_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); LDKNetworkGraph network_conv; network_conv.inner = (void*)(network & (~1)); network_conv.is_owned = false; @@ -40079,7 +42173,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); + *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uintptr_t)ret_conv; } @@ -40130,6 +42224,97 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_ return ret_ref; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKFixedPenaltyScorer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + FixedPenaltyScorer_free(this_obj_conv); +} + +static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) { + LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKFixedPenaltyScorer arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKFixedPenaltyScorer orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKFixedPenaltyScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = FixedPenaltyScorer_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_FixedPenaltyScorer_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_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = FixedPenaltyScorer_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) { + LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKFixedPenaltyScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv); + return (uintptr_t)ret_ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -40244,6 +42429,44 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIE return ret_ref; } +static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) { + LDKScoringParameters ret_var = ScoringParameters_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKScoringParameters arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = ScoringParameters_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKScoringParameters orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKScoringParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); @@ -40271,7 +42494,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jc params_conv.inner = (void*)(params & (~1)); params_conv.is_owned = (params & 1) || (params == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters + params_conv = ScoringParameters_clone(¶ms_conv); LDKScorer ret_var = Scorer_new(params_conv); uintptr_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -40342,6 +42565,134 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, j return (uintptr_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKProbabilisticScoringParameters this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ProbabilisticScoringParameters_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg); +uintptr_t ret_ref = 0; +CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uintptr_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKProbabilisticScoringParameters arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + intptr_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKProbabilisticScoringParameters orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKProbabilisticScoringParameters obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_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_ProbabilisticScoringParameters_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_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); + *ret_conv = ProbabilisticScoringParameters_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uintptr_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default(); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKFilesystemPersister this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -40485,7 +42836,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(J this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - // Warning: we need a move here but no clone is available for LDKBackgroundProcessor + // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); *ret_conv = BackgroundProcessor_join(this_arg_conv); return (uintptr_t)ret_conv; @@ -40496,16 +42847,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(J this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - // Warning: we need a move here but no clone is available for LDKBackgroundProcessor + // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); *ret_conv = BackgroundProcessor_stop(this_arg_conv); return (uintptr_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) { - check_platform(); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKInvoice this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -41837,6 +44184,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1sy return (uintptr_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) { + LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); + *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPositiveTimestamp this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -41846,6 +44199,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix return ret_val; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKPositiveTimestamp this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) { LDKPositiveTimestamp this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -41903,6 +44265,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv * return ret_val; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInvoice this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv); + return ret_val; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -41980,6 +44351,15 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEn return ret_val; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) { + LDKInvoice this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) { LDKInvoice this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -42081,15 +44461,29 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JN } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) { - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = ExpiryTime_from_seconds(seconds); - return (uintptr_t)ret_conv; + LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) { - LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ"); - *ret_conv = ExpiryTime_from_duration(duration); - return (uintptr_t)ret_conv; + LDKExpiryTime ret_var = ExpiryTime_from_duration(duration); + uintptr_t ret_ref = 0; + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -42160,13 +44554,13 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1ou return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount()); return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints()); return ret_conv; } @@ -42615,6 +45009,48 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHand return (uintptr_t)ret_ret; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, jstring description, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) { + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKStr description_conv = java_to_owned_str(env, description); + 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); + LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr; + phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints); + if (phantom_route_hints_constr.datalen > 0) + phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + phantom_route_hints_constr.data = NULL; + int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL); + for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) { + int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t]; + LDKPhantomRouteHints phantom_route_hints_conv_19_conv; + phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1)); + phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv); + phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv); + 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 = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_phantom_invoice(amt_msat_conv, description_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv); + return (uintptr_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -42638,6 +45074,29 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan return (uintptr_t)ret_conv; } +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, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = (void*)(channelmanager & (~1)); + channelmanager_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKStr description_conv = java_to_owned_str(env, description); + 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, network_conv, amt_msat_conv, description_conv, duration_since_epoch); + return (uintptr_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKDefaultRouter this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index ec29af85..a7171597 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -151,6 +151,38 @@ 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: CResult_NoneNoneZ_get_ok + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_SecretKeyErrorZ_get_ok @@ -489,18 +521,18 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_get_ok + * Method: CResult_PaymentParametersDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_get_err + * Method: CResult_PaymentParametersDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -727,6 +759,22 @@ 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_FixedPenaltyScorerDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_FixedPenaltyScorerDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_ScoringParametersDecodeErrorZ_get_ok @@ -759,6 +807,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_InitFeaturesDecodeErrorZ_get_ok @@ -887,22 +951,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_get_ok - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_get_err - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: C2Tuple_SignatureCVec_SignatureZZ_get_a @@ -951,6 +999,54 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * 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 + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyNoneZ_get_ok + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKBaseSign_new @@ -978,10 +1074,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commi /* * Class: org_ldk_impl_bindings * Method: BaseSign_validate_holder_commitment - * Signature: (JJ)J + * Signature: (JJ[[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jobjectArray); /* * Class: org_ldk_impl_bindings @@ -994,10 +1090,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_ /* * Class: org_ldk_impl_bindings * Method: BaseSign_sign_counterparty_commitment - * Signature: (JJ)J + * Signature: (JJ[[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jobjectArray); /* * Class: org_ldk_impl_bindings @@ -1431,6 +1527,70 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimage JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKWatch_new @@ -1490,10 +1650,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new /* * Class: org_ldk_impl_bindings * Method: KeysInterface_get_node_secret - * Signature: (J)[B + * Signature: (JLorg/ldk/enums/Recipient;)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret + (JNIEnv *, jclass, jlong, jobject); /* * Class: org_ldk_impl_bindings @@ -1538,10 +1698,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1si /* * Class: org_ldk_impl_bindings * Method: KeysInterface_sign_invoice - * Signature: (J[B)J + * Signature: (J[B[BLorg/ldk/enums/Recipient;)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jobject); /* * Class: org_ldk_impl_bindings @@ -1871,22 +2031,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationE JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_get_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_get_err - * Signature: (J)Lorg/ldk/enums/CreationError; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: CResult_PrivateRouteCreationErrorZ_get_ok @@ -2257,18 +2401,18 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1f /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_get_ok + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_get_err + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -2775,6 +2919,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeEr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok @@ -3447,6 +3607,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKEffectiveCapacity_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKEffectiveCapacity; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKScore_new @@ -3665,106 +3833,218 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free /* * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyErrorZ_ok - * Signature: ([B)J + * Method: CResult_NoneNoneZ_ok + * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyErrorZ_err - * Signature: (Lorg/ldk/enums/Secp256k1Error;)J + * Method: CResult_NoneNoneZ_err + * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err - (JNIEnv *, jclass, jobject); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyErrorZ_is_ok + * Method: CResult_NoneNoneZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SecretKeyErrorZ_free + * Method: CResult_NoneNoneZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyErrorZ_ok - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok - (JNIEnv *, jclass, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyErrorZ_err - * Signature: (Lorg/ldk/enums/Secp256k1Error;)J + * Method: CResult_NoneNoneZ_clone_ptr + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err - (JNIEnv *, jclass, jobject); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyErrorZ_is_ok - * Signature: (J)Z + * Method: CResult_NoneNoneZ_clone + * Signature: (J)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyErrorZ_free - * Signature: (J)V + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyErrorZ_clone_ptr + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PublicKeyErrorZ_clone - * Signature: (J)J + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok + * Signature: (J)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_TxCreationKeysDecodeErrorZ_ok - * Signature: (J)J + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_TxCreationKeysDecodeErrorZ_err + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_TxCreationKeysDecodeErrorZ_is_ok - * Signature: (J)Z + * Method: CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone + * Signature: (J)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyErrorZ_ok + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyErrorZ_err + * Signature: (Lorg/ldk/enums/Secp256k1Error;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SecretKeyErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PublicKeyErrorZ_ok + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PublicKeyErrorZ_err + * Signature: (Lorg/ldk/enums/Secp256k1Error;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PublicKeyErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PublicKeyErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PublicKeyErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PublicKeyErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxCreationKeysDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxCreationKeysDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TxCreationKeysDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* @@ -4713,50 +4993,50 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_ok + * Method: CResult_PaymentParametersDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_err + * Method: CResult_PaymentParametersDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_is_ok + * Method: CResult_PaymentParametersDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_free + * Method: CResult_PaymentParametersDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_clone_ptr + * Method: CResult_PaymentParametersDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PayeeDecodeErrorZ_clone + * Method: CResult_PaymentParametersDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -5343,6 +5623,54 @@ 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_FixedPenaltyScorerDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_FixedPenaltyScorerDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_FixedPenaltyScorerDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_FixedPenaltyScorerDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_FixedPenaltyScorerDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_ScoringParametersDecodeErrorZ_ok @@ -5375,6 +5703,22 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParameters JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ScoringParametersDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ScoringParametersDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_ScorerDecodeErrorZ_ok @@ -5407,6 +5751,54 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeError JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_InitFeaturesDecodeErrorZ_ok @@ -5713,51 +6105,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescr /* * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_ok - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_err - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneNoneZ_clone - * Signature: (J)J + * Method: CVec_PaymentPreimageZ_free + * Signature: ([[B)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free + (JNIEnv *, jclass, jobjectArray); /* * Class: org_ldk_impl_bindings @@ -5889,27 +6241,155 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clon /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_ok + * Method: C2Tuple_SignatureSignatureZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_err + * Method: C2Tuple_SignatureSignatureZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignDecodeErrorZ_is_ok - * Signature: (J)Z + * Method: C2Tuple_SignatureSignatureZ_new + * Signature: ([B[B)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new + (JNIEnv *, jclass, jbyteArray, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_SignatureSignatureZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_err + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_SignatureSignatureZNoneZ_free + * Signature: (J)V + */ +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_SignDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SignDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SignDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -5937,10 +6417,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1cl /* * Class: org_ldk_impl_bindings - * Method: CVec_u8Z_free + * Method: CVec_u5Z_free * Signature: ([B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free (JNIEnv *, jclass, jbyteArray); /* @@ -5991,6 +6471,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignature JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CVec_u8Z_free + * Signature: ([B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: CVec_CVec_u8ZZ_free @@ -6847,6 +7335,198 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIEr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelCounterpartyDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDetailsDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PhantomRouteHintsDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CVec_ChannelMonitorZ_free @@ -7505,106 +8185,58 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticError /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceSemanticErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_DescriptionCreationErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_DescriptionCreationErrorZ_err - * Signature: (Lorg/ldk/enums/CreationError;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err - (JNIEnv *, jclass, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_DescriptionCreationErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_DescriptionCreationErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_DescriptionCreationErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_DescriptionCreationErrorZ_clone + * Method: CResult_InvoiceSemanticErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_ok + * Method: CResult_DescriptionCreationErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_err + * Method: CResult_DescriptionCreationErrorZ_err * Signature: (Lorg/ldk/enums/CreationError;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_is_ok + * Method: CResult_DescriptionCreationErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_free + * Method: CResult_DescriptionCreationErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_clone_ptr + * Method: CResult_DescriptionCreationErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ExpiryTimeCreationErrorZ_clone + * Method: CResult_DescriptionCreationErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -8593,50 +9225,50 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_ok + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_err + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_is_ok + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_free + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_DirectionalChannelInfoDecodeErrorZ_clone + * Method: CResult_ChannelUpdateInfoDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -10207,6 +10839,54 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeEr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_WarningMessageDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok @@ -10543,6 +11223,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilte JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CVec_PhantomRouteHintsZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: CResult_InvoiceSignOrCreationErrorZ_ok @@ -10911,6 +11599,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful (JNIEnv *, jclass, jbyteArray, jbyteArray, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: Event_open_channel_request + * Signature: ([B[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: Event_write @@ -11223,6 +11919,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_recover_1pk JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify (JNIEnv *, jclass, jbyteArray, jstring, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: construct_invoice_preimage + * Signature: ([B[B)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage + (JNIEnv *, jclass, jbyteArray, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: Level_clone @@ -11927,13 +12631,29 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1i JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels (JNIEnv *, jclass, jlong, jboolean); +/* + * Class: org_ldk_impl_bindings + * Method: UserConfig_get_manually_accept_inbound_channels + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UserConfig_set_manually_accept_inbound_channels + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels + (JNIEnv *, jclass, jlong, jboolean); + /* * Class: org_ldk_impl_bindings * Method: UserConfig_new - * Signature: (JJJZZ)J + * Signature: (JJJZZZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jboolean, jboolean); + (JNIEnv *, jclass, jlong, jlong, jlong, jboolean, jboolean, jboolean); /* * Class: org_ldk_impl_bindings @@ -13239,6 +13959,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1clone JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Recipient_clone + * Signature: (J)Lorg/ldk/enums/Recipient; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Recipient_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Recipient_node + * Signature: ()Lorg/ldk/enums/Recipient; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Recipient_1node + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: Recipient_phantom_node + * Signature: ()Lorg/ldk/enums/Recipient; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: KeysInterface_free @@ -13370,10 +14114,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[BJ[B)J + * Signature: ([B[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, jlong, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -13474,10 +14218,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write /* * Class: org_ldk_impl_bindings * Method: InMemorySigner_read - * Signature: ([B)J + * Signature: ([B[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read - (JNIEnv *, jclass, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -13519,6 +14263,46 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_as_KeysInterface + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_new + * Signature: ([BJI[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new + (JNIEnv *, jclass, jbyteArray, jlong, jint, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_spend_spendable_outputs + * Signature: (J[J[J[BI)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs + (JNIEnv *, jclass, jlong, jlongArray, jlongArray, jbyteArray, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomKeysManager_derive_channel_keys + * Signature: (JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_free @@ -14111,6 +14895,86 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1fail JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure (JNIEnv *, jclass, jlongArray, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_get_channels + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_set_channels + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels + (JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_get_phantom_scid + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_set_phantom_scid + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_get_real_node_pubkey + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_set_real_node_pubkey + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_new + * Signature: ([JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new + (JNIEnv *, jclass, jlongArray, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_new @@ -14271,6 +15135,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1fun JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_accept_inbound_channel + * Signature: (J[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel + (JNIEnv *, jclass, jlong, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_create_inbound_payment @@ -14311,6 +15183,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbou JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_get_phantom_scid + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_get_phantom_route_hints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_as_MessageSendEventsProvider @@ -14364,16 +15252,80 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persist * Method: ChannelManager_current_best_block * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block + (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: CounterpartyForwardingInfo_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyForwardingInfo_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelCounterparty_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelCounterparty_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: PhantomRouteHints_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelManager_as_ChannelMessageHandler - * Signature: (J)J + * Method: PhantomRouteHints_read + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -14639,6 +15591,70 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_get_channel_id + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_set_channel_id + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_get_data + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_set_data + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_new + * Signature: ([BLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new + (JNIEnv *, jclass, jbyteArray, jstring); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Ping_free @@ -15311,6 +16327,22 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1firs JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point (JNIEnv *, jclass, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: AcceptChannel_get_channel_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: AcceptChannel_set_channel_type + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: AcceptChannel_clone_ptr @@ -17695,6 +18727,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicat JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ErrorAction_send_warning_message + * Signature: (JLorg/ldk/enums/Level;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message + (JNIEnv *, jclass, jlong, jobject); + /* * Class: org_ldk_impl_bindings * Method: LightningError_free @@ -18303,6 +19343,22 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: WarningMessage_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: UnsignedNodeAnnouncement_write @@ -18759,6 +19815,78 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secre JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_new + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_get_min_seen_secret + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_provide_secret + * Signature: (JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_get_secret + * Signature: (JJ)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CounterpartyCommitmentSecrets_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: derive_private_key @@ -20705,162 +21833,162 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1Messa /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_free + * Method: ChannelUpdateInfo_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_last_update + * Method: ChannelUpdateInfo_get_last_update * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_last_update + * Method: ChannelUpdateInfo_set_last_update * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update (JNIEnv *, jclass, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_enabled + * Method: ChannelUpdateInfo_get_enabled * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_enabled + * Method: ChannelUpdateInfo_set_enabled * Signature: (JZ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled (JNIEnv *, jclass, jlong, jboolean); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_cltv_expiry_delta + * Method: ChannelUpdateInfo_get_cltv_expiry_delta * Signature: (J)S */ -JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_cltv_expiry_delta + * Method: ChannelUpdateInfo_set_cltv_expiry_delta * Signature: (JS)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong, jshort); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_htlc_minimum_msat + * Method: ChannelUpdateInfo_get_htlc_minimum_msat * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_htlc_minimum_msat + * Method: ChannelUpdateInfo_set_htlc_minimum_msat * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_htlc_maximum_msat + * Method: ChannelUpdateInfo_get_htlc_maximum_msat * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_htlc_maximum_msat + * Method: ChannelUpdateInfo_set_htlc_maximum_msat * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_fees + * Method: ChannelUpdateInfo_get_fees * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_fees + * Method: ChannelUpdateInfo_set_fees * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_last_update_message + * Method: ChannelUpdateInfo_get_last_update_message * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_last_update_message + * Method: ChannelUpdateInfo_set_last_update_message * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_new + * Method: ChannelUpdateInfo_new * Signature: (IZSJJJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new (JNIEnv *, jclass, jint, jboolean, jshort, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_clone_ptr + * Method: ChannelUpdateInfo_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_clone + * Method: ChannelUpdateInfo_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_write + * Method: ChannelUpdateInfo_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_read + * Method: ChannelUpdateInfo_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read (JNIEnv *, jclass, jbyteArray); /* @@ -20889,131 +22017,251 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_node_one - * Signature: (J)J + * Method: ChannelInfo_get_node_one + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_set_node_one + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_get_one_to_two + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_set_one_to_two + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_get_node_two + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_set_node_two + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_get_two_to_one + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_set_two_to_one + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_get_capacity_sats + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_set_capacity_sats + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_get_announcement_message + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_set_announcement_message + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_read + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_node_one - * Signature: (JJ)V + * Method: DirectedChannelInfo_free + * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_one_to_two + * Method: DirectedChannelInfo_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_one_to_two - * Signature: (JJ)V + * Method: DirectedChannelInfo_clone + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_node_two + * Method: DirectedChannelInfo_channel * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_node_two - * Signature: (JJ)V + * Method: DirectedChannelInfo_direction + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_two_to_one + * Method: DirectedChannelInfo_effective_capacity * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_two_to_one - * Signature: (JJ)V + * Method: EffectiveCapacity_free + * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_capacity_sats + * Method: EffectiveCapacity_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_capacity_sats - * Signature: (JJ)V + * Method: EffectiveCapacity_clone + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_announcement_message + * Method: EffectiveCapacity_exact_liquidity * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_announcement_message - * Signature: (JJ)V + * Method: EffectiveCapacity_maximum_htlc + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_clone_ptr + * Method: EffectiveCapacity_total * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_clone - * Signature: (J)J + * Method: EffectiveCapacity_infinite + * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_write - * Signature: (J)[B + * Method: EffectiveCapacity_unknown + * Signature: ()J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_read - * Signature: ([B)J + * Method: EffectiveCapacity_as_msat + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -21415,6 +22663,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node (JNIEnv *, jclass, jlong, jbyteArray, jboolean); +/* + * Class: org_ldk_impl_bindings + * Method: NetworkGraph_remove_stale_channels + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: NetworkGraph_remove_stale_channels_with_time @@ -21633,18 +22889,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths /* * Class: org_ldk_impl_bindings - * Method: Route_get_payee + * Method: Route_get_payment_params * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_set_payee + * Method: Route_set_payment_params * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params (JNIEnv *, jclass, jlong, jlong); /* @@ -21729,18 +22985,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free /* * Class: org_ldk_impl_bindings - * Method: RouteParameters_get_payee + * Method: RouteParameters_get_payment_params * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteParameters_set_payee + * Method: RouteParameters_set_payment_params * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params (JNIEnv *, jclass, jlong, jlong); /* @@ -21817,146 +23073,162 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read /* * Class: org_ldk_impl_bindings - * Method: Payee_free + * Method: PaymentParameters_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_get_pubkey + * Method: PaymentParameters_get_payee_pubkey * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_set_pubkey + * Method: PaymentParameters_set_payee_pubkey * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: Payee_get_features + * Method: PaymentParameters_get_features * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_set_features + * Method: PaymentParameters_set_features * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_get_route_hints + * Method: PaymentParameters_get_route_hints * Signature: (J)[J */ -JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_set_route_hints + * Method: PaymentParameters_set_route_hints * Signature: (J[J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints (JNIEnv *, jclass, jlong, jlongArray); /* * Class: org_ldk_impl_bindings - * Method: Payee_get_expiry_time + * Method: PaymentParameters_get_expiry_time * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_set_expiry_time + * Method: PaymentParameters_set_expiry_time * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_new - * Signature: ([BJ[JJ)J + * Method: PaymentParameters_get_max_total_cltv_expiry_delta + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_set_max_total_cltv_expiry_delta + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentParameters_new + * Signature: ([BJ[JJI)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlongArray, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new + (JNIEnv *, jclass, jbyteArray, jlong, jlongArray, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: Payee_clone_ptr + * Method: PaymentParameters_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_clone + * Method: PaymentParameters_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_hash + * Method: PaymentParameters_hash * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1hash +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_eq + * Method: PaymentParameters_eq * Signature: (JJ)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_write + * Method: PaymentParameters_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Payee_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Payee_read + * Method: PaymentParameters_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: Payee_from_node_id + * Method: PaymentParameters_from_node_id * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: Payee_for_keysend + * Method: PaymentParameters_for_keysend * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend (JNIEnv *, jclass, jbyteArray); /* @@ -22239,6 +23511,62 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1fr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_with_penalty + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FixedPenaltyScorer_as_Score + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Scorer_free @@ -22343,6 +23671,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failur JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new (JNIEnv *, jclass, jlong, jlong, jshort, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ScoringParameters_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ScoringParameters_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ScoringParameters_write @@ -22407,6 +23751,94 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Scorer_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_get_liquidity_offset_half_life + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_set_liquidity_offset_half_life + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_new + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_default + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: FilesystemPersister_free @@ -22495,14 +23927,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: check_platform - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform - (JNIEnv *, jclass); - /* * Class: org_ldk_impl_bindings * Method: Invoice_free @@ -23359,6 +24783,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: PositiveTimestamp_from_duration_since_epoch + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: PositiveTimestamp_as_unix_timestamp @@ -23367,6 +24799,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1syst JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: PositiveTimestamp_as_duration_since_epoch + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: PositiveTimestamp_as_time @@ -23407,6 +24847,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Invoice_duration_since_epoch + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Invoice_payment_hash @@ -23463,6 +24911,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Invoice_would_expire + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: Invoice_min_final_cltv_expiry @@ -23601,18 +25057,18 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1o /* * Class: org_ldk_impl_bindings - * Method: CreationError_expiry_time_out_of_bounds + * Method: CreationError_invalid_amount * Signature: ()Lorg/ldk/enums/CreationError; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: CreationError_invalid_amount + * Method: CreationError_missing_route_hints * Signature: ()Lorg/ldk/enums/CreationError; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints (JNIEnv *, jclass); /* @@ -23975,6 +25431,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: create_phantom_invoice + * Signature: (JLjava/lang/String;[B[B[JJLorg/ldk/enums/Currency;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice + (JNIEnv *, jclass, jlong, jstring, jbyteArray, jbyteArray, jlongArray, jlong, jobject); + /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager @@ -23983,6 +25447,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandle JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager (JNIEnv *, jclass, jlong, jlong, jobject, jlong, jstring); +/* + * Class: org_ldk_impl_bindings + * Method: create_invoice_from_channelmanager_and_duration_since_epoch + * Signature: (JJLorg/ldk/enums/Currency;JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch + (JNIEnv *, jclass, jlong, jlong, jobject, jlong, jstring, jlong); + /* * Class: org_ldk_impl_bindings * Method: DefaultRouter_free