From: Matt Corallo Date: Wed, 31 May 2023 19:35:12 +0000 (+0000) Subject: [Java] Update auto-generated bindings X-Git-Tag: v0.0.115.1^2~13 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=27b8cc09b5182166e0ee7d7071dff5abfe71b8a2;p=ldk-java [Java] Update auto-generated bindings --- diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index bacc1d12..d0acc481 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -3512,6 +3512,10 @@ public class bindings { public static native long COption_ScalarZ_none(); // void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); public static native void COption_ScalarZ_free(long _res); + // uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg); + public static native long COption_ScalarZ_clone_ptr(long arg); + // struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig); + public static native long COption_ScalarZ_clone(long orig); // struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); public static native long CResult_SharedSecretNoneZ_ok(byte[] o); // struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void); diff --git a/src/main/java/org/ldk/structs/BackgroundProcessor.java b/src/main/java/org/ldk/structs/BackgroundProcessor.java index 72bdae5a..84c36931 100644 --- a/src/main/java/org/ldk/structs/BackgroundProcessor.java +++ b/src/main/java/org/ldk/structs/BackgroundProcessor.java @@ -91,7 +91,7 @@ public class BackgroundProcessor extends CommonBase { * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable */ public static BackgroundProcessor start(org.ldk.structs.Persister persister, org.ldk.structs.EventHandler event_handler, org.ldk.structs.ChainMonitor chain_monitor, org.ldk.structs.ChannelManager channel_manager, org.ldk.structs.GossipSync gossip_sync, org.ldk.structs.PeerManager peer_manager, org.ldk.structs.Logger logger, org.ldk.structs.Option_WriteableScoreZ scorer) { - long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, channel_manager == null ? 0 : channel_manager.ptr, gossip_sync.ptr, peer_manager == null ? 0 : peer_manager.ptr, logger == null ? 0 : logger.ptr, scorer.ptr); + long ret = bindings.BackgroundProcessor_start(persister.ptr, event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, channel_manager == null ? 0 : channel_manager.ptr, gossip_sync.ptr, peer_manager == null ? 0 : peer_manager.ptr, logger.ptr, scorer.ptr); Reference.reachabilityFence(persister); Reference.reachabilityFence(event_handler); Reference.reachabilityFence(chain_monitor); diff --git a/src/main/java/org/ldk/structs/BlindedPath.java b/src/main/java/org/ldk/structs/BlindedPath.java index 7a7999d0..27a7a0e7 100644 --- a/src/main/java/org/ldk/structs/BlindedPath.java +++ b/src/main/java/org/ldk/structs/BlindedPath.java @@ -75,7 +75,7 @@ public class BlindedPath extends CommonBase { * Errors if less than two hops are provided or if `node_pk`(s) are invalid. */ public static Result_BlindedPathNoneZ new_for_message(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) { - long ret = bindings.BlindedPath_new_for_message(node_pks != null ? Arrays.stream(node_pks).map(node_pks_conv_8 -> InternalUtils.check_arr_len(node_pks_conv_8, 33)).toArray(byte[][]::new) : null, entropy_source == null ? 0 : entropy_source.ptr); + long ret = bindings.BlindedPath_new_for_message(node_pks != null ? Arrays.stream(node_pks).map(node_pks_conv_8 -> InternalUtils.check_arr_len(node_pks_conv_8, 33)).toArray(byte[][]::new) : null, entropy_source.ptr); Reference.reachabilityFence(node_pks); Reference.reachabilityFence(entropy_source); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java b/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java index 52f04d5f..d816d8c4 100644 --- a/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java @@ -142,7 +142,7 @@ public class BuiltCommitmentTransaction extends CommonBase { * Signs the holder commitment transaction because we are about to broadcast it. */ public byte[] sign_holder_commitment(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis, org.ldk.structs.EntropySource entropy_source) { - byte[] ret = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis, entropy_source == null ? 0 : entropy_source.ptr); + byte[] ret = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis, entropy_source.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(funding_key); Reference.reachabilityFence(funding_redeemscript); diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java index 9c83ff24..e7bfc524 100644 --- a/src/main/java/org/ldk/structs/ChainMonitor.java +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -45,7 +45,7 @@ public class ChainMonitor extends CommonBase { * transactions relevant to the watched channels. */ public static ChainMonitor of(org.ldk.structs.Option_FilterZ chain_source, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.Logger logger, org.ldk.structs.FeeEstimator feeest, org.ldk.structs.Persist persister) { - long ret = bindings.ChainMonitor_new(chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr); + long ret = bindings.ChainMonitor_new(chain_source.ptr, broadcaster.ptr, logger.ptr, feeest.ptr, persister.ptr); Reference.reachabilityFence(chain_source); Reference.reachabilityFence(broadcaster); Reference.reachabilityFence(logger); diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index dd34eb87..14f4b1e6 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -89,7 +89,7 @@ public class ChannelManager extends CommonBase { * [`params.best_block.block_hash`]: chain::BestBlock::block_hash */ public static ChannelManager of(org.ldk.structs.FeeEstimator fee_est, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Router router, org.ldk.structs.Logger logger, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.SignerProvider signer_provider, org.ldk.structs.UserConfig config, org.ldk.structs.ChainParameters params) { - long ret = bindings.ChannelManager_new(fee_est == null ? 0 : fee_est.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, router == null ? 0 : router.ptr, logger == null ? 0 : logger.ptr, entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, signer_provider == null ? 0 : signer_provider.ptr, config == null ? 0 : config.ptr, params == null ? 0 : params.ptr); + long ret = bindings.ChannelManager_new(fee_est.ptr, chain_monitor.ptr, tx_broadcaster.ptr, router.ptr, logger.ptr, entropy_source.ptr, node_signer.ptr, signer_provider.ptr, config == null ? 0 : config.ptr, params == null ? 0 : params.ptr); Reference.reachabilityFence(fee_est); Reference.reachabilityFence(chain_monitor); Reference.reachabilityFence(tx_broadcaster); diff --git a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java index d542693e..95703760 100644 --- a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java +++ b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java @@ -67,7 +67,7 @@ public class ChannelManagerReadArgs extends CommonBase { * A cryptographically secure source of entropy. */ public void set_entropy_source(org.ldk.structs.EntropySource val) { - bindings.ChannelManagerReadArgs_set_entropy_source(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_entropy_source(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -89,7 +89,7 @@ public class ChannelManagerReadArgs extends CommonBase { * A signer that is able to perform node-scoped cryptographic operations. */ public void set_node_signer(org.ldk.structs.NodeSigner val) { - bindings.ChannelManagerReadArgs_set_node_signer(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_node_signer(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -115,7 +115,7 @@ public class ChannelManagerReadArgs extends CommonBase { * signing data. */ public void set_signer_provider(org.ldk.structs.SignerProvider val) { - bindings.ChannelManagerReadArgs_set_signer_provider(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_signer_provider(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -141,7 +141,7 @@ public class ChannelManagerReadArgs extends CommonBase { * No calls to the FeeEstimator will be made during deserialization. */ public void set_fee_estimator(org.ldk.structs.FeeEstimator val) { - bindings.ChannelManagerReadArgs_set_fee_estimator(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_fee_estimator(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -171,7 +171,7 @@ public class ChannelManagerReadArgs extends CommonBase { * chain::Watch after deserializing this ChannelManager. */ public void set_chain_monitor(org.ldk.structs.Watch val) { - bindings.ChannelManagerReadArgs_set_chain_monitor(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_chain_monitor(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -197,7 +197,7 @@ public class ChannelManagerReadArgs extends CommonBase { * force-closed during deserialization. */ public void set_tx_broadcaster(org.ldk.structs.BroadcasterInterface val) { - bindings.ChannelManagerReadArgs_set_tx_broadcaster(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_tx_broadcaster(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -225,7 +225,7 @@ public class ChannelManagerReadArgs extends CommonBase { * No calls to the router will be made during deserialization. */ public void set_router(org.ldk.structs.Router val) { - bindings.ChannelManagerReadArgs_set_router(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_router(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -249,7 +249,7 @@ public class ChannelManagerReadArgs extends CommonBase { * deserialization. */ public void set_logger(org.ldk.structs.Logger val) { - bindings.ChannelManagerReadArgs_set_logger(this.ptr, val == null ? 0 : val.ptr); + bindings.ChannelManagerReadArgs_set_logger(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -285,7 +285,7 @@ public class ChannelManagerReadArgs extends CommonBase { * populate a HashMap directly from C. */ public static ChannelManagerReadArgs of(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.SignerProvider signer_provider, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Watch chain_monitor, org.ldk.structs.BroadcasterInterface tx_broadcaster, org.ldk.structs.Router router, org.ldk.structs.Logger logger, org.ldk.structs.UserConfig default_config, ChannelMonitor[] channel_monitors) { - long ret = bindings.ChannelManagerReadArgs_new(entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, signer_provider == null ? 0 : signer_provider.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, router == null ? 0 : router.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr, channel_monitors != null ? Arrays.stream(channel_monitors).mapToLong(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr).toArray() : null); + long ret = bindings.ChannelManagerReadArgs_new(entropy_source.ptr, node_signer.ptr, signer_provider.ptr, fee_estimator.ptr, chain_monitor.ptr, tx_broadcaster.ptr, router.ptr, logger.ptr, default_config == null ? 0 : default_config.ptr, channel_monitors != null ? Arrays.stream(channel_monitors).mapToLong(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr).toArray() : null); Reference.reachabilityFence(entropy_source); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(signer_provider); diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java index 2f05f3c9..a505f8bd 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitor.java +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -69,7 +69,7 @@ public class ChannelMonitor extends CommonBase { * panics if the given update is not the next update by update_id. */ public Result_NoneNoneZ update_monitor(org.ldk.structs.ChannelMonitorUpdate updates, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - long ret = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0 : updates.ptr, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + long ret = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0 : updates.ptr, broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(updates); Reference.reachabilityFence(broadcaster); @@ -130,7 +130,7 @@ public class ChannelMonitor extends CommonBase { * have been registered. */ public void load_outputs_to_watch(org.ldk.structs.Filter filter) { - bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter == null ? 0 : filter.ptr); + bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(filter); if (this != null) { this.ptrs_to.add(filter); }; @@ -211,7 +211,7 @@ public class ChannelMonitor extends CommonBase { * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure */ public byte[][] get_latest_holder_commitment_txn(org.ldk.structs.Logger logger) { - byte[][] ret = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, logger == null ? 0 : logger.ptr); + byte[][] ret = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(logger); if (this != null) { this.ptrs_to.add(logger); }; @@ -232,7 +232,7 @@ public class ChannelMonitor extends CommonBase { * [`get_outputs_to_watch`]: #method.get_outputs_to_watch */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] block_connected(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(header); Reference.reachabilityFence(txdata); @@ -259,7 +259,7 @@ public class ChannelMonitor extends CommonBase { * appropriately. */ public void block_disconnected(byte[] header, int height, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - bindings.ChannelMonitor_block_disconnected(this.ptr, InternalUtils.check_arr_len(header, 80), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + bindings.ChannelMonitor_block_disconnected(this.ptr, InternalUtils.check_arr_len(header, 80), height, broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(header); Reference.reachabilityFence(height); @@ -281,7 +281,7 @@ public class ChannelMonitor extends CommonBase { * [`block_connected`]: Self::block_connected */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] transactions_confirmed(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - long[] ret = bindings.ChannelMonitor_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + long[] ret = bindings.ChannelMonitor_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(header); Reference.reachabilityFence(txdata); @@ -312,7 +312,7 @@ public class ChannelMonitor extends CommonBase { * [`block_disconnected`]: Self::block_disconnected */ public void transaction_unconfirmed(byte[] txid, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - bindings.ChannelMonitor_transaction_unconfirmed(this.ptr, InternalUtils.check_arr_len(txid, 32), broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + bindings.ChannelMonitor_transaction_unconfirmed(this.ptr, InternalUtils.check_arr_len(txid, 32), broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(txid); Reference.reachabilityFence(broadcaster); @@ -333,7 +333,7 @@ public class ChannelMonitor extends CommonBase { * [`block_connected`]: Self::block_connected */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] best_block_updated(byte[] header, int height, org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - long[] ret = bindings.ChannelMonitor_best_block_updated(this.ptr, InternalUtils.check_arr_len(header, 80), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + long[] ret = bindings.ChannelMonitor_best_block_updated(this.ptr, InternalUtils.check_arr_len(header, 80), height, broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(header); Reference.reachabilityFence(height); @@ -392,7 +392,7 @@ public class ChannelMonitor extends CommonBase { * connections, like on mobile. */ public void rebroadcast_pending_claims(org.ldk.structs.BroadcasterInterface broadcaster, org.ldk.structs.FeeEstimator fee_estimator, org.ldk.structs.Logger logger) { - bindings.ChannelMonitor_rebroadcast_pending_claims(this.ptr, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + bindings.ChannelMonitor_rebroadcast_pending_claims(this.ptr, broadcaster.ptr, fee_estimator.ptr, logger.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(broadcaster); Reference.reachabilityFence(fee_estimator); diff --git a/src/main/java/org/ldk/structs/CustomMessageHandler.java b/src/main/java/org/ldk/structs/CustomMessageHandler.java index 7425c2eb..247de06e 100644 --- a/src/main/java/org/ldk/structs/CustomMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomMessageHandler.java @@ -95,7 +95,7 @@ public class CustomMessageHandler extends CommonBase { * to send. */ public Result_NoneLightningErrorZ handle_custom_message(org.ldk.structs.Type msg, byte[] sender_node_id) { - long ret = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg == null ? 0 : msg.ptr, InternalUtils.check_arr_len(sender_node_id, 33)); + long ret = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg.ptr, InternalUtils.check_arr_len(sender_node_id, 33)); Reference.reachabilityFence(this); Reference.reachabilityFence(msg); Reference.reachabilityFence(sender_node_id); diff --git a/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java b/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java index 33d21a30..da87808f 100644 --- a/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java @@ -79,7 +79,7 @@ public class CustomOnionMessageHandler extends CommonBase { * Called with the custom message that was received. */ public void handle_custom_message(org.ldk.structs.CustomOnionMessageContents msg) { - bindings.CustomOnionMessageHandler_handle_custom_message(this.ptr, msg == null ? 0 : msg.ptr); + bindings.CustomOnionMessageHandler_handle_custom_message(this.ptr, msg.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(msg); if (this != null) { this.ptrs_to.add(msg); }; diff --git a/src/main/java/org/ldk/structs/DefaultRouter.java b/src/main/java/org/ldk/structs/DefaultRouter.java index 3f491961..aa5dcaea 100644 --- a/src/main/java/org/ldk/structs/DefaultRouter.java +++ b/src/main/java/org/ldk/structs/DefaultRouter.java @@ -24,7 +24,7 @@ public class DefaultRouter extends CommonBase { * Creates a new router. */ public static DefaultRouter of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger, byte[] random_seed_bytes, org.ldk.structs.LockableScore scorer) { - long ret = bindings.DefaultRouter_new(network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32), scorer == null ? 0 : scorer.ptr); + long ret = bindings.DefaultRouter_new(network_graph == null ? 0 : network_graph.ptr, logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32), scorer.ptr); Reference.reachabilityFence(network_graph); Reference.reachabilityFence(logger); Reference.reachabilityFence(random_seed_bytes); diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java index db707f51..a46ddd2c 100644 --- a/src/main/java/org/ldk/structs/EventsProvider.java +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -98,7 +98,7 @@ public class EventsProvider extends CommonBase { * See the trait-level documentation for requirements. */ public void process_pending_events(org.ldk.structs.EventHandler handler) { - bindings.EventsProvider_process_pending_events(this.ptr, handler == null ? 0 : handler.ptr); + bindings.EventsProvider_process_pending_events(this.ptr, handler.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(handler); if (this != null) { this.ptrs_to.add(handler); }; diff --git a/src/main/java/org/ldk/structs/FilesystemPersister.java b/src/main/java/org/ldk/structs/FilesystemPersister.java index 118a806b..f80fb3a8 100644 --- a/src/main/java/org/ldk/structs/FilesystemPersister.java +++ b/src/main/java/org/ldk/structs/FilesystemPersister.java @@ -57,7 +57,7 @@ public class FilesystemPersister extends CommonBase { * Read `ChannelMonitor`s from disk. */ public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.SignerProvider signer_provider) { - long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, entropy_source == null ? 0 : entropy_source.ptr, signer_provider == null ? 0 : signer_provider.ptr); + long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, entropy_source.ptr, signer_provider.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(entropy_source); Reference.reachabilityFence(signer_provider); diff --git a/src/main/java/org/ldk/structs/Future.java b/src/main/java/org/ldk/structs/Future.java index 74c5a62a..8e7b97fb 100644 --- a/src/main/java/org/ldk/structs/Future.java +++ b/src/main/java/org/ldk/structs/Future.java @@ -45,7 +45,7 @@ public class Future extends CommonBase { * completed, the callback will be called immediately. */ public void register_callback_fn(org.ldk.structs.FutureCallback callback) { - bindings.Future_register_callback_fn(this.ptr, callback == null ? 0 : callback.ptr); + bindings.Future_register_callback_fn(this.ptr, callback.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(callback); if (this != null) { this.ptrs_to.add(callback); }; diff --git a/src/main/java/org/ldk/structs/InMemorySigner.java b/src/main/java/org/ldk/structs/InMemorySigner.java index 5afb5605..d1761eb0 100644 --- a/src/main/java/org/ldk/structs/InMemorySigner.java +++ b/src/main/java/org/ldk/structs/InMemorySigner.java @@ -373,7 +373,7 @@ public class InMemorySigner extends CommonBase { * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ public static Result_InMemorySignerDecodeErrorZ read(byte[] ser, org.ldk.structs.EntropySource arg) { - long ret = bindings.InMemorySigner_read(ser, arg == null ? 0 : arg.ptr); + long ret = bindings.InMemorySigner_read(ser, arg.ptr); Reference.reachabilityFence(ser); Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/LockableScore.java b/src/main/java/org/ldk/structs/LockableScore.java index 206b6e54..a8cc6788 100644 --- a/src/main/java/org/ldk/structs/LockableScore.java +++ b/src/main/java/org/ldk/structs/LockableScore.java @@ -56,7 +56,7 @@ public class LockableScore extends CommonBase { @Override public long lock() { Score ret = arg.lock(); Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.ptr; + long result = ret.ptr; if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; return result; } diff --git a/src/main/java/org/ldk/structs/MessageHandler.java b/src/main/java/org/ldk/structs/MessageHandler.java index 20d74af3..e2d88b4a 100644 --- a/src/main/java/org/ldk/structs/MessageHandler.java +++ b/src/main/java/org/ldk/structs/MessageHandler.java @@ -42,7 +42,7 @@ public class MessageHandler extends CommonBase { * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ public void set_chan_handler(org.ldk.structs.ChannelMessageHandler val) { - bindings.MessageHandler_set_chan_handler(this.ptr, val == null ? 0 : val.ptr); + bindings.MessageHandler_set_chan_handler(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -70,7 +70,7 @@ public class MessageHandler extends CommonBase { * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ public void set_route_handler(org.ldk.structs.RoutingMessageHandler val) { - bindings.MessageHandler_set_route_handler(this.ptr, val == null ? 0 : val.ptr); + bindings.MessageHandler_set_route_handler(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -94,7 +94,7 @@ public class MessageHandler extends CommonBase { * [`IgnoringMessageHandler`]. */ public void set_onion_message_handler(org.ldk.structs.OnionMessageHandler val) { - bindings.MessageHandler_set_onion_message_handler(this.ptr, val == null ? 0 : val.ptr); + bindings.MessageHandler_set_onion_message_handler(this.ptr, val.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(val); if (this != null) { this.ptrs_to.add(val); }; @@ -104,7 +104,7 @@ public class MessageHandler extends CommonBase { * Constructs a new MessageHandler given each field */ public static MessageHandler of(org.ldk.structs.ChannelMessageHandler chan_handler_arg, org.ldk.structs.RoutingMessageHandler route_handler_arg, org.ldk.structs.OnionMessageHandler onion_message_handler_arg) { - long ret = bindings.MessageHandler_new(chan_handler_arg == null ? 0 : chan_handler_arg.ptr, route_handler_arg == null ? 0 : route_handler_arg.ptr, onion_message_handler_arg == null ? 0 : onion_message_handler_arg.ptr); + long ret = bindings.MessageHandler_new(chan_handler_arg.ptr, route_handler_arg.ptr, onion_message_handler_arg.ptr); Reference.reachabilityFence(chan_handler_arg); Reference.reachabilityFence(route_handler_arg); Reference.reachabilityFence(onion_message_handler_arg); diff --git a/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java b/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java index 3a7f2baf..2f6ca6c6 100644 --- a/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java +++ b/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java @@ -59,7 +59,7 @@ public class MultiThreadedLockableScore extends CommonBase { * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ public static MultiThreadedLockableScore of(org.ldk.structs.Score score) { - long ret = bindings.MultiThreadedLockableScore_new(score == null ? 0 : score.ptr); + long ret = bindings.MultiThreadedLockableScore_new(score.ptr); Reference.reachabilityFence(score); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.MultiThreadedLockableScore ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MultiThreadedLockableScore(null, ret); } diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index 42ebedb4..5ee9a791 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -44,7 +44,7 @@ public class NetworkGraph extends CommonBase { * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ public static Result_NetworkGraphDecodeErrorZ read(byte[] ser, org.ldk.structs.Logger arg) { - long ret = bindings.NetworkGraph_read(ser, arg == null ? 0 : arg.ptr); + long ret = bindings.NetworkGraph_read(ser, arg.ptr); Reference.reachabilityFence(ser); Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; } @@ -57,7 +57,7 @@ public class NetworkGraph extends CommonBase { * Creates a new, empty, network graph. */ public static NetworkGraph of(org.ldk.enums.Network network, org.ldk.structs.Logger logger) { - long ret = bindings.NetworkGraph_new(network, logger == null ? 0 : logger.ptr); + long ret = bindings.NetworkGraph_new(network, logger.ptr); Reference.reachabilityFence(network); Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/OnionMessageContents.java b/src/main/java/org/ldk/structs/OnionMessageContents.java index f2aba0ee..8bc1a7ed 100644 --- a/src/main/java/org/ldk/structs/OnionMessageContents.java +++ b/src/main/java/org/ldk/structs/OnionMessageContents.java @@ -63,7 +63,7 @@ public class OnionMessageContents extends CommonBase { * Utility method to constructs a new Custom-variant OnionMessageContents */ public static OnionMessageContents custom(org.ldk.structs.CustomOnionMessageContents a) { - long ret = bindings.OnionMessageContents_custom(a == null ? 0 : a.ptr); + long ret = bindings.OnionMessageContents_custom(a.ptr); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.OnionMessageContents ret_hu_conv = org.ldk.structs.OnionMessageContents.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/OnionMessenger.java b/src/main/java/org/ldk/structs/OnionMessenger.java index 2315e3ba..26b85f06 100644 --- a/src/main/java/org/ldk/structs/OnionMessenger.java +++ b/src/main/java/org/ldk/structs/OnionMessenger.java @@ -97,7 +97,7 @@ public class OnionMessenger extends CommonBase { * their respective handlers. */ public static OnionMessenger of(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.structs.CustomOnionMessageHandler custom_handler) { - long ret = bindings.OnionMessenger_new(entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, custom_handler == null ? 0 : custom_handler.ptr); + long ret = bindings.OnionMessenger_new(entropy_source.ptr, node_signer.ptr, logger.ptr, custom_handler.ptr); Reference.reachabilityFence(entropy_source); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); diff --git a/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java b/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java index a7254c11..e1a73abd 100644 --- a/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java +++ b/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java @@ -55,7 +55,7 @@ public class Option_CustomOnionMessageContentsZ extends CommonBase { * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents */ public static Option_CustomOnionMessageContentsZ some(org.ldk.structs.CustomOnionMessageContents o) { - long ret = bindings.COption_CustomOnionMessageContentsZ_some(o == null ? 0 : o.ptr); + long ret = bindings.COption_CustomOnionMessageContentsZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_CustomOnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_CustomOnionMessageContentsZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/Option_FilterZ.java b/src/main/java/org/ldk/structs/Option_FilterZ.java index 279be2f2..5c5a51ff 100644 --- a/src/main/java/org/ldk/structs/Option_FilterZ.java +++ b/src/main/java/org/ldk/structs/Option_FilterZ.java @@ -55,7 +55,7 @@ public class Option_FilterZ extends CommonBase { * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter */ public static Option_FilterZ some(org.ldk.structs.Filter o) { - long ret = bindings.COption_FilterZ_some(o == null ? 0 : o.ptr); + long ret = bindings.COption_FilterZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_FilterZ ret_hu_conv = org.ldk.structs.Option_FilterZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/Option_ScalarZ.java b/src/main/java/org/ldk/structs/Option_ScalarZ.java index eb553b93..78b28c87 100644 --- a/src/main/java/org/ldk/structs/Option_ScalarZ.java +++ b/src/main/java/org/ldk/structs/Option_ScalarZ.java @@ -74,4 +74,23 @@ public class Option_ScalarZ extends CommonBase { return ret_hu_conv; } + long clone_ptr() { + long ret = bindings.COption_ScalarZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_ScalarZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_ScalarZ clone() { + long ret = bindings.COption_ScalarZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_ScalarZ ret_hu_conv = org.ldk.structs.Option_ScalarZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/Option_TypeZ.java b/src/main/java/org/ldk/structs/Option_TypeZ.java index e71c9224..fe1ec846 100644 --- a/src/main/java/org/ldk/structs/Option_TypeZ.java +++ b/src/main/java/org/ldk/structs/Option_TypeZ.java @@ -55,7 +55,7 @@ public class Option_TypeZ extends CommonBase { * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ public static Option_TypeZ some(org.ldk.structs.Type o) { - long ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr); + long ret = bindings.COption_TypeZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java b/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java index 9326de47..cad3befb 100644 --- a/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java +++ b/src/main/java/org/ldk/structs/Option_UtxoLookupZ.java @@ -55,7 +55,7 @@ public class Option_UtxoLookupZ extends CommonBase { * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup */ public static Option_UtxoLookupZ some(org.ldk.structs.UtxoLookup o) { - long ret = bindings.COption_UtxoLookupZ_some(o == null ? 0 : o.ptr); + long ret = bindings.COption_UtxoLookupZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_UtxoLookupZ ret_hu_conv = org.ldk.structs.Option_UtxoLookupZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/Option_WriteableScoreZ.java b/src/main/java/org/ldk/structs/Option_WriteableScoreZ.java index 7ed1adf1..08eb67c7 100644 --- a/src/main/java/org/ldk/structs/Option_WriteableScoreZ.java +++ b/src/main/java/org/ldk/structs/Option_WriteableScoreZ.java @@ -55,7 +55,7 @@ public class Option_WriteableScoreZ extends CommonBase { * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore */ public static Option_WriteableScoreZ some(org.ldk.structs.WriteableScore o) { - long ret = bindings.COption_WriteableScoreZ_some(o == null ? 0 : o.ptr); + long ret = bindings.COption_WriteableScoreZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_WriteableScoreZ ret_hu_conv = org.ldk.structs.Option_WriteableScoreZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/P2PGossipSync.java b/src/main/java/org/ldk/structs/P2PGossipSync.java index 0eb91381..57544fdc 100644 --- a/src/main/java/org/ldk/structs/P2PGossipSync.java +++ b/src/main/java/org/ldk/structs/P2PGossipSync.java @@ -31,7 +31,7 @@ public class P2PGossipSync extends CommonBase { * correct, and the announcement is signed with channel owners' keys. */ public static P2PGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Option_UtxoLookupZ utxo_lookup, org.ldk.structs.Logger logger) { - long ret = bindings.P2PGossipSync_new(network_graph == null ? 0 : network_graph.ptr, utxo_lookup.ptr, logger == null ? 0 : logger.ptr); + long ret = bindings.P2PGossipSync_new(network_graph == null ? 0 : network_graph.ptr, utxo_lookup.ptr, logger.ptr); Reference.reachabilityFence(network_graph); Reference.reachabilityFence(utxo_lookup); Reference.reachabilityFence(logger); diff --git a/src/main/java/org/ldk/structs/PeerManager.java b/src/main/java/org/ldk/structs/PeerManager.java index ce9d3159..5e9a79f8 100644 --- a/src/main/java/org/ldk/structs/PeerManager.java +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -50,7 +50,7 @@ public class PeerManager extends CommonBase { * minute should suffice. */ public static PeerManager of(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, OnionMessageHandler message_handler_onion_message_handler_arg, int current_time, byte[] ephemeral_random_data, org.ldk.structs.Logger logger, org.ldk.structs.CustomMessageHandler custom_message_handler, org.ldk.structs.NodeSigner node_signer) { - long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr, message_handler_onion_message_handler_arg == null ? 0 : message_handler_onion_message_handler_arg.ptr), current_time, InternalUtils.check_arr_len(ephemeral_random_data, 32), logger == null ? 0 : logger.ptr, custom_message_handler == null ? 0 : custom_message_handler.ptr, node_signer == null ? 0 : node_signer.ptr); + long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg.ptr, message_handler_onion_message_handler_arg.ptr), current_time, InternalUtils.check_arr_len(ephemeral_random_data, 32), logger.ptr, custom_message_handler.ptr, node_signer.ptr); Reference.reachabilityFence(message_handler_chan_handler_arg); Reference.reachabilityFence(message_handler_route_handler_arg); Reference.reachabilityFence(message_handler_onion_message_handler_arg); @@ -115,7 +115,7 @@ public class PeerManager extends CommonBase { * [`socket_disconnected`]: PeerManager::socket_disconnected */ public Result_CVec_u8ZPeerHandleErrorZ new_outbound_connection(byte[] their_node_id, org.ldk.structs.SocketDescriptor descriptor, org.ldk.structs.Option_NetAddressZ remote_network_address) { - long ret = bindings.PeerManager_new_outbound_connection(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), descriptor == null ? 0 : descriptor.ptr, remote_network_address.ptr); + long ret = bindings.PeerManager_new_outbound_connection(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), descriptor.ptr, remote_network_address.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); Reference.reachabilityFence(descriptor); @@ -145,7 +145,7 @@ public class PeerManager extends CommonBase { * [`socket_disconnected`]: PeerManager::socket_disconnected */ public Result_NonePeerHandleErrorZ new_inbound_connection(org.ldk.structs.SocketDescriptor descriptor, org.ldk.structs.Option_NetAddressZ remote_network_address) { - long ret = bindings.PeerManager_new_inbound_connection(this.ptr, descriptor == null ? 0 : descriptor.ptr, remote_network_address.ptr); + long ret = bindings.PeerManager_new_inbound_connection(this.ptr, descriptor.ptr, remote_network_address.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(descriptor); Reference.reachabilityFence(remote_network_address); @@ -171,7 +171,7 @@ public class PeerManager extends CommonBase { * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail */ public Result_NonePeerHandleErrorZ write_buffer_space_avail(org.ldk.structs.SocketDescriptor descriptor) { - long ret = bindings.PeerManager_write_buffer_space_avail(this.ptr, descriptor == null ? 0 : descriptor.ptr); + long ret = bindings.PeerManager_write_buffer_space_avail(this.ptr, descriptor.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } @@ -199,7 +199,7 @@ public class PeerManager extends CommonBase { * [`process_events`]: PeerManager::process_events */ public Result_boolPeerHandleErrorZ read_event(org.ldk.structs.SocketDescriptor peer_descriptor, byte[] data) { - long ret = bindings.PeerManager_read_event(this.ptr, peer_descriptor == null ? 0 : peer_descriptor.ptr, data); + long ret = bindings.PeerManager_read_event(this.ptr, peer_descriptor.ptr, data); Reference.reachabilityFence(this); Reference.reachabilityFence(peer_descriptor); Reference.reachabilityFence(data); @@ -236,7 +236,7 @@ public class PeerManager extends CommonBase { * Indicates that the given socket descriptor's connection is now closed. */ public void socket_disconnected(org.ldk.structs.SocketDescriptor descriptor) { - bindings.PeerManager_socket_disconnected(this.ptr, descriptor == null ? 0 : descriptor.ptr); + bindings.PeerManager_socket_disconnected(this.ptr, descriptor.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(descriptor); } diff --git a/src/main/java/org/ldk/structs/Persister.java b/src/main/java/org/ldk/structs/Persister.java index 3cdf7360..d735aa24 100644 --- a/src/main/java/org/ldk/structs/Persister.java +++ b/src/main/java/org/ldk/structs/Persister.java @@ -109,7 +109,7 @@ public class Persister extends CommonBase { * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. */ public Result_NoneErrorZ persist_scorer(org.ldk.structs.WriteableScore scorer) { - long ret = bindings.Persister_persist_scorer(this.ptr, scorer == null ? 0 : scorer.ptr); + long ret = bindings.Persister_persist_scorer(this.ptr, scorer.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(scorer); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/ProbabilisticScorer.java b/src/main/java/org/ldk/structs/ProbabilisticScorer.java index ecd6aafb..db52ae42 100644 --- a/src/main/java/org/ldk/structs/ProbabilisticScorer.java +++ b/src/main/java/org/ldk/structs/ProbabilisticScorer.java @@ -60,7 +60,7 @@ public class ProbabilisticScorer extends CommonBase { * through a network graph. */ public static ProbabilisticScorer of(org.ldk.structs.ProbabilisticScoringParameters params, org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger) { - long ret = bindings.ProbabilisticScorer_new(params == null ? 0 : params.ptr, network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr); + long ret = bindings.ProbabilisticScorer_new(params == null ? 0 : params.ptr, network_graph == null ? 0 : network_graph.ptr, logger.ptr); Reference.reachabilityFence(params); Reference.reachabilityFence(network_graph); Reference.reachabilityFence(logger); @@ -211,7 +211,7 @@ public class ProbabilisticScorer extends CommonBase { * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ public static Result_ProbabilisticScorerDecodeErrorZ read(byte[] ser, org.ldk.structs.ProbabilisticScoringParameters arg_a, org.ldk.structs.NetworkGraph arg_b, org.ldk.structs.Logger arg_c) { - long ret = bindings.ProbabilisticScorer_read(ser, arg_a == null ? 0 : arg_a.ptr, arg_b == null ? 0 : arg_b.ptr, arg_c == null ? 0 : arg_c.ptr); + long ret = bindings.ProbabilisticScorer_read(ser, arg_a == null ? 0 : arg_a.ptr, arg_b == null ? 0 : arg_b.ptr, arg_c.ptr); Reference.reachabilityFence(ser); Reference.reachabilityFence(arg_a); Reference.reachabilityFence(arg_b); diff --git a/src/main/java/org/ldk/structs/RapidGossipSync.java b/src/main/java/org/ldk/structs/RapidGossipSync.java index d9b85257..9af3bb64 100644 --- a/src/main/java/org/ldk/structs/RapidGossipSync.java +++ b/src/main/java/org/ldk/structs/RapidGossipSync.java @@ -28,7 +28,7 @@ public class RapidGossipSync extends CommonBase { * Instantiate a new [`RapidGossipSync`] instance. */ public static RapidGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger) { - long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr); + long ret = bindings.RapidGossipSync_new(network_graph == null ? 0 : network_graph.ptr, logger.ptr); Reference.reachabilityFence(network_graph); Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java index 5bc5b473..b285d0c9 100644 --- a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java @@ -46,7 +46,7 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ public static Result_NetworkGraphDecodeErrorZ ok(Network o_network, Logger o_logger) { - long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_network, o_logger == null ? 0 : o_logger.ptr)); + long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_network, o_logger.ptr)); Reference.reachabilityFence(o_network); Reference.reachabilityFence(o_logger); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java index 3f13fb8c..0ced8185 100644 --- a/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ProbabilisticScorerDecodeErrorZ.java @@ -46,7 +46,7 @@ public class Result_ProbabilisticScorerDecodeErrorZ extends CommonBase { * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. */ public static Result_ProbabilisticScorerDecodeErrorZ ok(ProbabilisticScoringParameters o_params, NetworkGraph o_network_graph, Logger o_logger) { - long ret = bindings.CResult_ProbabilisticScorerDecodeErrorZ_ok(bindings.ProbabilisticScorer_new(o_params == null ? 0 : o_params.ptr, o_network_graph == null ? 0 : o_network_graph.ptr, o_logger == null ? 0 : o_logger.ptr)); + long ret = bindings.CResult_ProbabilisticScorerDecodeErrorZ_ok(bindings.ProbabilisticScorer_new(o_params == null ? 0 : o_params.ptr, o_network_graph == null ? 0 : o_network_graph.ptr, o_logger.ptr)); Reference.reachabilityFence(o_params); Reference.reachabilityFence(o_network_graph); Reference.reachabilityFence(o_logger); diff --git a/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.java index b3c4f4aa..bad96df5 100644 --- a/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.java @@ -46,7 +46,7 @@ public class Result_WriteableEcdsaChannelSignerDecodeErrorZ extends CommonBase { * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. */ public static Result_WriteableEcdsaChannelSignerDecodeErrorZ ok(org.ldk.structs.WriteableEcdsaChannelSigner o) { - long ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o == null ? 0 : o.ptr); + long ret = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_WriteableEcdsaChannelSignerDecodeErrorZ ret_hu_conv = Result_WriteableEcdsaChannelSignerDecodeErrorZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/ScorerAccountingForInFlightHtlcs.java b/src/main/java/org/ldk/structs/ScorerAccountingForInFlightHtlcs.java index ffc3dea9..c0dc28c7 100644 --- a/src/main/java/org/ldk/structs/ScorerAccountingForInFlightHtlcs.java +++ b/src/main/java/org/ldk/structs/ScorerAccountingForInFlightHtlcs.java @@ -29,7 +29,7 @@ public class ScorerAccountingForInFlightHtlcs extends CommonBase { * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ public static ScorerAccountingForInFlightHtlcs of(org.ldk.structs.Score scorer, org.ldk.structs.InFlightHtlcs inflight_htlcs) { - long ret = bindings.ScorerAccountingForInFlightHtlcs_new(scorer == null ? 0 : scorer.ptr, inflight_htlcs == null ? 0 : inflight_htlcs.ptr); + long ret = bindings.ScorerAccountingForInFlightHtlcs_new(scorer.ptr, inflight_htlcs == null ? 0 : inflight_htlcs.ptr); Reference.reachabilityFence(scorer); Reference.reachabilityFence(inflight_htlcs); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/SignerProvider.java b/src/main/java/org/ldk/structs/SignerProvider.java index 86a5cb7f..690e35c5 100644 --- a/src/main/java/org/ldk/structs/SignerProvider.java +++ b/src/main/java/org/ldk/structs/SignerProvider.java @@ -100,7 +100,7 @@ public class SignerProvider extends CommonBase { @Override public long derive_channel_signer(long channel_value_satoshis, byte[] channel_keys_id) { WriteableEcdsaChannelSigner ret = arg.derive_channel_signer(channel_value_satoshis, channel_keys_id); Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); + long result = ret.clone_ptr(); if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; return result; } diff --git a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java index ae83aef9..181512a3 100644 --- a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java @@ -76,7 +76,7 @@ public class TrustedCommitmentTransaction extends CommonBase { * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. */ public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, org.ldk.structs.DirectedChannelTransactionParameters channel_parameters, org.ldk.structs.EntropySource entropy_source) { - long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr, entropy_source == null ? 0 : entropy_source.ptr); + long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr, entropy_source.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(htlc_base_key); Reference.reachabilityFence(channel_parameters); diff --git a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java index 778492d1..e17ad1f1 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java @@ -45,7 +45,7 @@ public class TwoTuple_BlockHashChannelManagerZ extends CommonBase { * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ public static TwoTuple_BlockHashChannelManagerZ of(byte[] a, FeeEstimator b_fee_est, Watch b_chain_monitor, BroadcasterInterface b_tx_broadcaster, Router b_router, Logger b_logger, EntropySource b_entropy_source, NodeSigner b_node_signer, SignerProvider b_signer_provider, UserConfig b_config, ChainParameters b_params) { - long ret = bindings.C2Tuple_BlockHashChannelManagerZ_new(InternalUtils.check_arr_len(a, 32), bindings.ChannelManager_new(b_fee_est == null ? 0 : b_fee_est.ptr, b_chain_monitor == null ? 0 : b_chain_monitor.ptr, b_tx_broadcaster == null ? 0 : b_tx_broadcaster.ptr, b_router == null ? 0 : b_router.ptr, b_logger == null ? 0 : b_logger.ptr, b_entropy_source == null ? 0 : b_entropy_source.ptr, b_node_signer == null ? 0 : b_node_signer.ptr, b_signer_provider == null ? 0 : b_signer_provider.ptr, b_config == null ? 0 : b_config.ptr, b_params == null ? 0 : b_params.ptr)); + long ret = bindings.C2Tuple_BlockHashChannelManagerZ_new(InternalUtils.check_arr_len(a, 32), bindings.ChannelManager_new(b_fee_est.ptr, b_chain_monitor.ptr, b_tx_broadcaster.ptr, b_router.ptr, b_logger.ptr, b_entropy_source.ptr, b_node_signer.ptr, b_signer_provider.ptr, b_config == null ? 0 : b_config.ptr, b_params == null ? 0 : b_params.ptr)); Reference.reachabilityFence(a); Reference.reachabilityFence(b_fee_est); Reference.reachabilityFence(b_chain_monitor); diff --git a/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java b/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java index f6326afc..49e05327 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java @@ -64,7 +64,7 @@ public class TwoTuple_PublicKeyTypeZ extends CommonBase { * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ public static TwoTuple_PublicKeyTypeZ of(byte[] a, org.ldk.structs.Type b) { - long ret = bindings.C2Tuple_PublicKeyTypeZ_new(InternalUtils.check_arr_len(a, 33), b == null ? 0 : b.ptr); + long ret = bindings.C2Tuple_PublicKeyTypeZ_new(InternalUtils.check_arr_len(a, 33), b.ptr); Reference.reachabilityFence(a); Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index 513b48b4..0fc32fb5 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -116,7 +116,7 @@ public class UtilMethods { * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write */ public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, org.ldk.structs.EntropySource arg_a, org.ldk.structs.SignerProvider arg_b) { - long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg_a == null ? 0 : arg_a.ptr, arg_b == null ? 0 : arg_b.ptr); + long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg_a.ptr, arg_b.ptr); Reference.reachabilityFence(ser); Reference.reachabilityFence(arg_a); Reference.reachabilityFence(arg_b); @@ -145,7 +145,7 @@ public class UtilMethods { * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write */ public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, EntropySource arg_entropy_source, NodeSigner arg_node_signer, SignerProvider arg_signer_provider, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Router arg_router, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) { - long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_entropy_source == null ? 0 : arg_entropy_source.ptr, arg_node_signer == null ? 0 : arg_node_signer.ptr, arg_signer_provider == null ? 0 : arg_signer_provider.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_router == null ? 0 : arg_router.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null)); + long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_entropy_source.ptr, arg_node_signer.ptr, arg_signer_provider.ptr, arg_fee_estimator.ptr, arg_chain_monitor.ptr, arg_tx_broadcaster.ptr, arg_router.ptr, arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null)); Reference.reachabilityFence(ser); Reference.reachabilityFence(arg_entropy_source); Reference.reachabilityFence(arg_node_signer); @@ -190,7 +190,7 @@ public class UtilMethods { * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material */ public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.EntropySource entropy_source, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { - long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, entropy_source == null ? 0 : entropy_source.ptr, current_time, min_final_cltv_expiry_delta.ptr); + long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, entropy_source.ptr, current_time, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(keys); Reference.reachabilityFence(min_value_msat); Reference.reachabilityFence(invoice_expiry_delta_secs); @@ -512,7 +512,7 @@ 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, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, @Nullable ChannelDetails[] first_hops, org.ldk.structs.Logger logger, org.ldk.structs.Score scorer, byte[] random_seed_bytes) { - long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32)); + long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr).toArray() : null, logger.ptr, scorer.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32)); Reference.reachabilityFence(our_node_pubkey); Reference.reachabilityFence(route_params); Reference.reachabilityFence(network_graph); @@ -537,7 +537,7 @@ public class UtilMethods { * Re-uses logic from `find_route`, so the restrictions described there also apply here. */ public static Result_RouteLightningErrorZ build_route_from_hops(byte[] our_node_pubkey, byte[][] hops, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger, byte[] random_seed_bytes) { - long ret = bindings.build_route_from_hops(InternalUtils.check_arr_len(our_node_pubkey, 33), hops != null ? Arrays.stream(hops).map(hops_conv_8 -> InternalUtils.check_arr_len(hops_conv_8, 33)).toArray(byte[][]::new) : null, route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32)); + long ret = bindings.build_route_from_hops(InternalUtils.check_arr_len(our_node_pubkey, 33), hops != null ? Arrays.stream(hops).map(hops_conv_8 -> InternalUtils.check_arr_len(hops_conv_8, 33)).toArray(byte[][]::new) : null, route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32)); Reference.reachabilityFence(our_node_pubkey); Reference.reachabilityFence(hops); Reference.reachabilityFence(route_params); @@ -741,7 +741,7 @@ public class UtilMethods { * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) { - long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch); + long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(description); @@ -805,7 +805,7 @@ public class UtilMethods { * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) { - long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source == null ? 0 : entropy_source.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch); + long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch); Reference.reachabilityFence(amt_msat); Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(invoice_expiry_delta_secs); @@ -847,7 +847,7 @@ public class UtilMethods { * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { - long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); + long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); @@ -885,7 +885,7 @@ public class UtilMethods { * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { - long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); + long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); @@ -911,7 +911,7 @@ public class UtilMethods { * available and the current time is supplied by the caller. */ public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { - long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); + long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); @@ -938,7 +938,7 @@ public class UtilMethods { * available and the current time is supplied by the caller. */ public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { - long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); + long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); @@ -965,7 +965,7 @@ public class UtilMethods { * the payment hash is also involved outside the scope of lightning. */ public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) { - long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer == null ? 0 : node_signer.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32), min_final_cltv_expiry_delta.ptr); + long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32), min_final_cltv_expiry_delta.ptr); Reference.reachabilityFence(channelmanager); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(logger); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index b039192b..72dd3c31 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -76,7 +76,7 @@ JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclas arr_of_B_clz = (*env)->FindClass(env, "[B"); CHECK(arr_of_B_clz != NULL); arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz); - String_clz = (*env)->FindClass(env, "Ljava/lang/String;"); + String_clz = (*env)->FindClass(env, "java/lang/String"); CHECK(String_clz != NULL); String_clz = (*env)->NewGlobalRef(env, String_clz); } @@ -8153,7 +8153,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *en void* tweak_ptr = untag_ptr(tweak); CHECK_ACCESS(tweak_ptr); LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ + tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak)); LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); return tag_ptr(ret_conv, true); @@ -20929,6 +20929,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free(JNIEnv COption_ScalarZ_free(_res_conv); } +static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) { + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg); + int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig); + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 6a44bd7f..dba7f31e 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -74,7 +74,7 @@ JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclas arr_of_B_clz = (*env)->FindClass(env, "[B"); CHECK(arr_of_B_clz != NULL); arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz); - String_clz = (*env)->FindClass(env, "Ljava/lang/String;"); + String_clz = (*env)->FindClass(env, "java/lang/String"); CHECK(String_clz != NULL); String_clz = (*env)->NewGlobalRef(env, String_clz); } @@ -8151,7 +8151,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *en void* tweak_ptr = untag_ptr(tweak); CHECK_ACCESS(tweak_ptr); LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ + tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak)); LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); return tag_ptr(ret_conv, true); @@ -20927,6 +20927,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free(JNIEnv COption_ScalarZ_free(_res_conv); } +static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) { + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg); + int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig); + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index cdb12d6a..0003f22a 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -8727,6 +8727,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: COption_ScalarZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_ScalarZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_SharedSecretNoneZ_ok