From: Matt Corallo Date: Sat, 20 Mar 2021 21:54:47 +0000 (-0400) Subject: Update auto-generated bindings X-Git-Tag: v0.0.98~7^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=d9af3c7d5fbc87035335d96b855bb9f1000a31a5;p=ldk-java Update auto-generated bindings --- diff --git a/liblightningjni_debug.so b/liblightningjni_debug.so index 57752d51..e25a23d0 100755 Binary files a/liblightningjni_debug.so and b/liblightningjni_debug.so differ diff --git a/liblightningjni_release.so b/liblightningjni_release.so index 5fec76cc..ebfbf2f3 100755 Binary files a/liblightningjni_release.so and b/liblightningjni_release.so differ diff --git a/src/main/java/org/ldk/enums/LDKAccessError.java b/src/main/java/org/ldk/enums/LDKAccessError.java index 2a4c57ff..c8e604c1 100644 --- a/src/main/java/org/ldk/enums/LDKAccessError.java +++ b/src/main/java/org/ldk/enums/LDKAccessError.java @@ -2,8 +2,6 @@ package org.ldk.enums; /** * An error when accessing the chain via [`Access`]. - * - * [`Access`]: trait.Access.html */ public enum LDKAccessError { LDKAccessError_UnknownChain, diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 99196cc4..a414060c 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -202,6 +202,11 @@ public class bindings { public long msg; SendShortIdsQuery(byte[] node_id, long msg) { this.node_id = node_id; this.msg = msg; } } + public final static class SendReplyChannelRange extends LDKMessageSendEvent { + public byte[] node_id; + public long msg; + SendReplyChannelRange(byte[] node_id, long msg) { this.node_id = node_id; this.msg = msg; } + } static native void init(); } static { LDKMessageSendEvent.init(); } @@ -758,6 +763,7 @@ public class bindings { void peer_disconnected(byte[] their_node_id, boolean no_connection_possible); void peer_connected(byte[] their_node_id, long msg); void handle_channel_reestablish(byte[] their_node_id, long msg); + void handle_channel_update(byte[] their_node_id, long msg); void handle_error(byte[] their_node_id, long msg); } public static native long LDKChannelMessageHandler_new(LDKChannelMessageHandler impl, LDKMessageSendEventsProvider MessageSendEventsProvider); @@ -797,6 +803,8 @@ public class bindings { public static native void ChannelMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_channel_reestablish LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_channel_reestablish(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_handle_channel_update LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg + public static native void ChannelMessageHandler_handle_channel_update(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_error LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_error(long this_arg, byte[] their_node_id, long msg); public interface LDKRoutingMessageHandler { @@ -1688,6 +1696,10 @@ public class bindings { public static native int ChannelConfig_get_fee_proportional_millionths(long this_ptr); // void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); public static native void ChannelConfig_set_fee_proportional_millionths(long this_ptr, int val); + // uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + public static native short ChannelConfig_get_cltv_expiry_delta(long this_ptr); + // void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); + public static native void ChannelConfig_set_cltv_expiry_delta(long this_ptr, short val); // bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); public static native boolean ChannelConfig_get_announced_channel(long this_ptr); // void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); @@ -1696,8 +1708,8 @@ public class bindings { public static native boolean ChannelConfig_get_commit_upfront_shutdown_pubkey(long this_ptr); // void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); public static native void ChannelConfig_set_commit_upfront_shutdown_pubkey(long this_ptr, boolean val); - // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); - public static native long ChannelConfig_new(int fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg); + // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); + public static native long ChannelConfig_new(int fee_proportional_millionths_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg); // struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); public static native long ChannelConfig_clone(long orig); // MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); @@ -2940,6 +2952,8 @@ public class bindings { public static native long ReplyShortChannelIdsEnd_read(byte[] ser); // struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); public static native byte[] ReplyShortChannelIdsEnd_write(long obj); + // MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); + public static native int QueryChannelRange_end_blocknum(long this_arg); // struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); public static native long QueryChannelRange_read(byte[] ser); // struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java index a32ef2d3..1cfc04d3 100644 --- a/src/main/java/org/ldk/structs/ChainMonitor.java +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -14,9 +14,8 @@ import java.util.Arrays; * or used independently to monitor channels remotely. See the [module-level documentation] for * details. * - * [`chain::Watch`]: ../trait.Watch.html - * [`ChannelManager`]: ../../ln/channelmanager/struct.ChannelManager.html - * [module-level documentation]: index.html + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [module-level documentation]: crate::chain::chainmonitor */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ChainMonitor extends CommonBase { @@ -37,10 +36,6 @@ public class ChainMonitor extends CommonBase { * calls must not exclude any transactions matching the new outputs nor any in-block * descendants of such transactions. It is not necessary to re-fetch the block to obtain * updated `txdata`. - * - * [`ChannelMonitor::block_connected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_connected - * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events - * [`chain::Filter`]: ../trait.Filter.html */ public void block_connected(byte[] header, TwoTuple[] txdata, int height) { bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(txdata_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_24.a, txdata_conv_24.b)).toArray(), height); @@ -51,8 +46,6 @@ public class ChainMonitor extends CommonBase { * Dispatches to per-channel monitors, which are responsible for updating their on-chain view * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for * details. - * - * [`ChannelMonitor::block_disconnected`]: ../channelmonitor/struct.ChannelMonitor.html#method.block_disconnected */ public void block_disconnected(byte[] header, int disconnected_height) { bindings.ChainMonitor_block_disconnected(this.ptr, header, disconnected_height); @@ -66,8 +59,6 @@ public class ChainMonitor extends CommonBase { * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may * always need to fetch full blocks absent another means for determining which blocks contain * transactions relevant to the watched channels. - * - * [`chain::Filter`]: ../trait.Filter.html */ public static ChainMonitor constructor_new(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) { long ret = bindings.ChainMonitor_new(chain_source == null ? 0 : chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr); diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java index c7a095bb..7f5f6d2e 100644 --- a/src/main/java/org/ldk/structs/ChannelConfig.java +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -42,6 +42,57 @@ public class ChannelConfig extends CommonBase { bindings.ChannelConfig_set_fee_proportional_millionths(this.ptr, val); } + /** + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + */ + public short get_cltv_expiry_delta() { + short ret = bindings.ChannelConfig_get_cltv_expiry_delta(this.ptr); + return ret; + } + + /** + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + */ + public void set_cltv_expiry_delta(short val) { + bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val); + } + /** * Set to announce the channel publicly and notify all nodes that they can route via this * channel. @@ -115,8 +166,8 @@ public class ChannelConfig extends CommonBase { /** * Constructs a new ChannelConfig given each field */ - public static ChannelConfig constructor_new(int fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { - long ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); + public static ChannelConfig constructor_new(int fee_proportional_millionths_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { + long ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); ChannelConfig ret_hu_conv = new ChannelConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelFeatures.java b/src/main/java/org/ldk/structs/ChannelFeatures.java index bac024ad..9d445f4f 100644 --- a/src/main/java/org/ldk/structs/ChannelFeatures.java +++ b/src/main/java/org/ldk/structs/ChannelFeatures.java @@ -39,9 +39,7 @@ public class ChannelFeatures extends CommonBase { } /** - * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`]. - * - * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS + * Creates a Features with the bits set which are known by the implementation */ public static ChannelFeatures constructor_known() { long ret = bindings.ChannelFeatures_known(); diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index 2b1a7eee..bf53b65c 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -44,18 +44,21 @@ public class ChannelHandshakeConfig extends CommonBase { } /** - * Set to the amount of time we require our counterparty to wait to claim their money. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). * - * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST - * be online to check for peer having broadcast a revoked transaction to steal our funds - * at least once every our_to_self_delay blocks. + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). * * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in * case of an honest unilateral channel close, which implicitly decrease the economic value of * our channel. * - * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel - * opening so you can tweak config to ask for more security, not less. + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. */ public short get_our_to_self_delay() { short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr); @@ -63,18 +66,21 @@ public class ChannelHandshakeConfig extends CommonBase { } /** - * Set to the amount of time we require our counterparty to wait to claim their money. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). * - * It's one of the main parameter of our security model. We (or one of our watchtowers) MUST - * be online to check for peer having broadcast a revoked transaction to steal our funds - * at least once every our_to_self_delay blocks. + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). * * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in * case of an honest unilateral channel close, which implicitly decrease the economic value of * our channel. * - * Default value: BREAKDOWN_TIMEOUT (currently 144), we enforce it as a minimum at channel - * opening so you can tweak config to ask for more security, not less. + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. */ public void set_our_to_self_delay(short val) { bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index 5eaedc16..c5bb6272 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -102,6 +102,10 @@ public class ChannelMessageHandler extends CommonBase { * Handle an incoming channel_reestablish message from the given peer. */ void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg); + /** + * Handle an incoming channel update from the given peer. + */ + void handle_channel_update(byte[] their_node_id, ChannelUpdate msg); /** * Handle an incoming error message from the given peer. */ @@ -187,6 +191,10 @@ public class ChannelMessageHandler extends CommonBase { ChannelReestablish msg_hu_conv = new ChannelReestablish(null, msg); arg.handle_channel_reestablish(their_node_id, msg_hu_conv); } + @Override public void handle_channel_update(byte[] their_node_id, long msg) { + ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg); + arg.handle_channel_update(their_node_id, msg_hu_conv); + } @Override public void handle_error(byte[] their_node_id, long msg) { ErrorMessage msg_hu_conv = new ErrorMessage(null, msg); arg.handle_error(their_node_id, msg_hu_conv); @@ -343,6 +351,14 @@ public class ChannelMessageHandler extends CommonBase { this.ptrs_to.add(msg); } + /** + * Handle an incoming channel update from the given peer. + */ + public void handle_channel_update(byte[] their_node_id, ChannelUpdate msg) { + bindings.ChannelMessageHandler_handle_channel_update(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); + this.ptrs_to.add(msg); + } + /** * Handle an incoming error message from the given peer. */ diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java index 1ab69bc7..e16b3797 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitor.java +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -133,8 +133,6 @@ public class ChannelMonitor extends CommonBase { /** * Get the list of HTLCs who's status has been updated on chain. This should be called by * ChannelManager via [`chain::Watch::release_pending_monitor_events`]. - * - * [`chain::Watch::release_pending_monitor_events`]: ../trait.Watch.html#tymethod.release_pending_monitor_events */ public MonitorEvent[] get_and_clear_pending_monitor_events() { long[] ret = bindings.ChannelMonitor_get_and_clear_pending_monitor_events(this.ptr); diff --git a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java index 4373180a..248ee9af 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java +++ b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java @@ -31,8 +31,6 @@ public class ChannelMonitorUpdate extends CommonBase { * The only instance where update_id values are not strictly increasing is the case where we * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See * its docs for more details. - * - * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html */ public long get_update_id() { long ret = bindings.ChannelMonitorUpdate_get_update_id(this.ptr); @@ -51,8 +49,6 @@ public class ChannelMonitorUpdate extends CommonBase { * The only instance where update_id values are not strictly increasing is the case where we * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See * its docs for more details. - * - * [`CLOSED_CHANNEL_UPDATE_ID`]: constant.CLOSED_CHANNEL_UPDATE_ID.html */ public void set_update_id(long val) { bindings.ChannelMonitorUpdate_set_update_id(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index 092c6561..776d95ed 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -20,11 +20,10 @@ import java.util.Arrays; * * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter` * should not block on I/O. Implementations should instead queue the newly monitored data to be - * processed later. Then, in order to block until the data has been processed, any `Watch` + * processed later. Then, in order to block until the data has been processed, any [`Watch`] * invocation that has called the `Filter` must return [`TemporaryFailure`]. * - * [`Watch`]: trait.Watch.html - * [`TemporaryFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.TemporaryFailure + * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki */ diff --git a/src/main/java/org/ldk/structs/HTLCUpdate.java b/src/main/java/org/ldk/structs/HTLCUpdate.java index 5951ab2e..e951269a 100644 --- a/src/main/java/org/ldk/structs/HTLCUpdate.java +++ b/src/main/java/org/ldk/structs/HTLCUpdate.java @@ -10,8 +10,6 @@ import java.util.Arrays; * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the * preimage claim backward will lead to loss of funds. - * - * [`chain::Watch`]: ../trait.Watch.html */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class HTLCUpdate extends CommonBase { diff --git a/src/main/java/org/ldk/structs/InitFeatures.java b/src/main/java/org/ldk/structs/InitFeatures.java index 38195c91..cf4e0b3d 100644 --- a/src/main/java/org/ldk/structs/InitFeatures.java +++ b/src/main/java/org/ldk/structs/InitFeatures.java @@ -39,9 +39,7 @@ public class InitFeatures extends CommonBase { } /** - * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`]. - * - * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS + * Creates a Features with the bits set which are known by the implementation */ public static InitFeatures constructor_known() { long ret = bindings.InitFeatures_known(); diff --git a/src/main/java/org/ldk/structs/InvoiceFeatures.java b/src/main/java/org/ldk/structs/InvoiceFeatures.java new file mode 100644 index 00000000..b5d81330 --- /dev/null +++ b/src/main/java/org/ldk/structs/InvoiceFeatures.java @@ -0,0 +1,68 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + + +/** + * Features used within an invoice. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class InvoiceFeatures extends CommonBase { + InvoiceFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.InvoiceFeatures_free(ptr); } + } + + /** + * Creates a copy of the InvoiceFeatures + */ + public InvoiceFeatures clone() { + long ret = bindings.InvoiceFeatures_clone(this.ptr); + InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Create a blank Features with no features set + */ + public static InvoiceFeatures constructor_empty() { + long ret = bindings.InvoiceFeatures_empty(); + InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Creates a Features with the bits set which are known by the implementation + */ + public static InvoiceFeatures constructor_known() { + long ret = bindings.InvoiceFeatures_known(); + InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read + */ + public byte[] write() { + byte[] ret = bindings.InvoiceFeatures_write(this.ptr); + return ret; + } + + /** + * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write + */ + public static Result_InvoiceFeaturesDecodeErrorZ constructor_read(byte[] ser) { + long ret = bindings.InvoiceFeatures_read(ser); + Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 8327eae7..36e816f8 100644 --- a/src/main/java/org/ldk/structs/MessageSendEvent.java +++ b/src/main/java/org/ldk/structs/MessageSendEvent.java @@ -75,6 +75,9 @@ public class MessageSendEvent extends CommonBase { if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendShortIdsQuery.class) { return new SendShortIdsQuery(ptr, (bindings.LDKMessageSendEvent.SendShortIdsQuery)raw_val); } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) { + return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -291,4 +294,16 @@ public class MessageSendEvent extends CommonBase { this.msg = msg_hu_conv; } } + public final static class SendReplyChannelRange extends MessageSendEvent { + public final byte[] node_id; + public final ReplyChannelRange msg; + private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + ReplyChannelRange msg_hu_conv = new ReplyChannelRange(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } + } } diff --git a/src/main/java/org/ldk/structs/NodeFeatures.java b/src/main/java/org/ldk/structs/NodeFeatures.java index b4d09e71..022a46f6 100644 --- a/src/main/java/org/ldk/structs/NodeFeatures.java +++ b/src/main/java/org/ldk/structs/NodeFeatures.java @@ -39,9 +39,7 @@ public class NodeFeatures extends CommonBase { } /** - * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`]. - * - * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS + * Creates a Features with the bits set which are known by the implementation */ public static NodeFeatures constructor_known() { long ret = bindings.NodeFeatures_known(); diff --git a/src/main/java/org/ldk/structs/Persist.java b/src/main/java/org/ldk/structs/Persist.java index ebb48ed9..ef36c425 100644 --- a/src/main/java/org/ldk/structs/Persist.java +++ b/src/main/java/org/ldk/structs/Persist.java @@ -40,11 +40,8 @@ public class Persist extends CommonBase { * stored channel data). Note that you **must** persist every new monitor to * disk. See the `Persist` trait documentation for more details. * - * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, + * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. - * - * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk - * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint id, ChannelMonitor data); /** @@ -67,14 +64,9 @@ public class Persist extends CommonBase { * them in batches. The size of each monitor grows `O(number of state updates)` * whereas updates are small and `O(1)`. * - * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, + * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, * [`ChannelMonitorUpdate::write`] for writing out an update, and * [`ChannelMonitorUpdateErr`] for requirements when returning errors. - * - * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1 - * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk - * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write - * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint id, ChannelMonitorUpdate update, ChannelMonitor data); } @@ -109,11 +101,8 @@ public class Persist extends CommonBase { * stored channel data). Note that you **must** persist every new monitor to * disk. See the `Persist` trait documentation for more details. * - * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, + * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. - * - * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk - * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint id, ChannelMonitor data) { long ret = bindings.Persist_persist_new_channel(this.ptr, id == null ? 0 : id.ptr & ~1, data == null ? 0 : data.ptr & ~1); @@ -143,14 +132,9 @@ public class Persist extends CommonBase { * them in batches. The size of each monitor grows `O(number of state updates)` * whereas updates are small and `O(1)`. * - * See [`ChannelMonitor::serialize_for_disk`] for writing out a `ChannelMonitor`, + * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, * [`ChannelMonitorUpdate::write`] for writing out an update, and * [`ChannelMonitorUpdateErr`] for requirements when returning errors. - * - * [`ChannelMonitor::update_monitor`]: struct.ChannelMonitor.html#impl-1 - * [`ChannelMonitor::serialize_for_disk`]: struct.ChannelMonitor.html#method.serialize_for_disk - * [`ChannelMonitorUpdate::write`]: struct.ChannelMonitorUpdate.html#method.write - * [`ChannelMonitorUpdateErr`]: enum.ChannelMonitorUpdateErr.html */ public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint id, ChannelMonitorUpdate update, ChannelMonitor data) { long ret = bindings.Persist_update_persisted_channel(this.ptr, id == null ? 0 : id.ptr & ~1, update == null ? 0 : update.ptr & ~1, data == null ? 0 : data.ptr & ~1); diff --git a/src/main/java/org/ldk/structs/QueryChannelRange.java b/src/main/java/org/ldk/structs/QueryChannelRange.java index 97d856ea..6b07c91f 100644 --- a/src/main/java/org/ldk/structs/QueryChannelRange.java +++ b/src/main/java/org/ldk/structs/QueryChannelRange.java @@ -86,6 +86,14 @@ public class QueryChannelRange extends CommonBase { return ret_hu_conv; } + /** + * \n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t + */ + public int end_blocknum() { + int ret = bindings.QueryChannelRange_end_blocknum(this.ptr); + return ret; + } + /** * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write */ diff --git a/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java new file mode 100644 index 00000000..0ea07879 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java @@ -0,0 +1,50 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { + private Result_InvoiceFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InvoiceFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_InvoiceFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_InvoiceFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_InvoiceFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_InvoiceFeaturesDecodeErrorZ_OK extends Result_InvoiceFeaturesDecodeErrorZ { + public final InvoiceFeatures res; + private Result_InvoiceFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(ptr); + InvoiceFeatures res_hu_conv = new InvoiceFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_InvoiceFeaturesDecodeErrorZ_OK(InvoiceFeatures res) { + this(null, bindings.CResult_InvoiceFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_InvoiceFeaturesDecodeErrorZ_Err extends Result_InvoiceFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_InvoiceFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_InvoiceFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_InvoiceFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java index 9f50b5c6..294ca4b3 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java @@ -79,7 +79,14 @@ public class UnsignedChannelUpdate extends CommonBase { } /** - * The number of blocks to subtract from incoming HTLC cltv_expiry values + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines + * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a + * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, + * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ public short get_cltv_expiry_delta() { short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr); @@ -87,7 +94,14 @@ public class UnsignedChannelUpdate extends CommonBase { } /** - * The number of blocks to subtract from incoming HTLC cltv_expiry values + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines + * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a + * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, + * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ public void set_cltv_expiry_delta(short val) { bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index 85602ac8..d560838a 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -24,9 +24,9 @@ import java.util.Arrays; * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle * multiple instances. * - * [`ChannelMonitor`]: channelmonitor/struct.ChannelMonitor.html - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html - * [`PermanentFailure`]: channelmonitor/enum.ChannelMonitorUpdateErr.html#variant.PermanentFailure + * [`ChannelMonitor`]: channelmonitor::ChannelMonitor + * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr + * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Watch extends CommonBase { @@ -50,9 +50,9 @@ public class Watch extends CommonBase { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * - * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch - * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected - * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected + * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch + * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected + * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ Result_NoneChannelMonitorUpdateErrZ watch_channel(OutPoint funding_txo, ChannelMonitor monitor); /** @@ -61,8 +61,8 @@ public class Watch extends CommonBase { * Implementations must call [`update_monitor`] with the given update. See * [`ChannelMonitorUpdateErr`] for invariants around returning an error. * - * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html + * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr */ Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update); /** @@ -109,9 +109,9 @@ public class Watch extends CommonBase { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * - * [`get_outputs_to_watch`]: channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch - * [`block_connected`]: channelmonitor/struct.ChannelMonitor.html#method.block_connected - * [`block_disconnected`]: channelmonitor/struct.ChannelMonitor.html#method.block_disconnected + * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch + * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected + * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ public Result_NoneChannelMonitorUpdateErrZ watch_channel(OutPoint funding_txo, ChannelMonitor monitor) { long ret = bindings.Watch_watch_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor == null ? 0 : monitor.ptr & ~1); @@ -127,8 +127,8 @@ public class Watch extends CommonBase { * Implementations must call [`update_monitor`] with the given update. See * [`ChannelMonitorUpdateErr`] for invariants around returning an error. * - * [`update_monitor`]: channelmonitor/struct.ChannelMonitor.html#method.update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor/enum.ChannelMonitorUpdateErr.html + * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr */ public Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) { long ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, update == null ? 0 : update.ptr & ~1); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index b36f9c34..0e201da0 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -777,6 +777,8 @@ static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL; static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL; static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL; static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL; +static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL; +static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) { LDKMessageSendEvent_SendAcceptChannel_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;")); @@ -868,6 +870,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL); LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL); + LDKMessageSendEvent_SendReplyChannelRange_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;")); + CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL); + LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "", "([BJ)V"); + CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr; @@ -1024,6 +1031,15 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f long msg_ref = (long)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref); } + case LDKMessageSendEvent_SendReplyChannelRange: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form); + LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg; + CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long msg_ref = (long)msg_var.inner & ~1; + return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref); + } default: abort(); } } @@ -2279,7 +2295,7 @@ static void LDKSign_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) { +LDKPublicKey get_per_commitment_point_LDKSign_jcall(const void* this_arg, uint64_t idx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2291,7 +2307,7 @@ LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); return ret_ref; } -LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) { +LDKThirtyTwoBytes release_commitment_secret_LDKSign_jcall(const void* this_arg, uint64_t idx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2303,7 +2319,7 @@ LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); return ret_ref; } -LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) { +LDKThirtyTwoBytes channel_keys_id_LDKSign_jcall(const void* this_arg) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2315,7 +2331,7 @@ LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) { (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); return ret_ref; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) { +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2334,7 +2350,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_j ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret); return ret_conv; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2353,7 +2369,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { +LDKCResult_SignatureNoneZ sign_justice_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2378,7 +2394,7 @@ LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, L ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { +LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2403,7 +2419,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* t ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) { +LDKCResult_SignatureNoneZ sign_closing_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction closing_tx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2418,7 +2434,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, L ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { +LDKCResult_SignatureNoneZ sign_channel_announcement_LDKSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2437,7 +2453,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { +void ready_channel_LDKSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2453,7 +2469,7 @@ void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref); } -LDKCVec_u8Z write_jcall(const void* this_arg) { +LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2508,18 +2524,18 @@ static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, int64_t LDKSign ret = { .this_arg = (void*) calls, - .get_per_commitment_point = get_per_commitment_point_jcall, - .release_commitment_secret = release_commitment_secret_jcall, - .channel_keys_id = channel_keys_id_jcall, - .sign_counterparty_commitment = sign_counterparty_commitment_jcall, - .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall, - .sign_justice_transaction = sign_justice_transaction_jcall, - .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall, - .sign_closing_transaction = sign_closing_transaction_jcall, - .sign_channel_announcement = sign_channel_announcement_jcall, - .ready_channel = ready_channel_jcall, + .get_per_commitment_point = get_per_commitment_point_LDKSign_jcall, + .release_commitment_secret = release_commitment_secret_LDKSign_jcall, + .channel_keys_id = channel_keys_id_LDKSign_jcall, + .sign_counterparty_commitment = sign_counterparty_commitment_LDKSign_jcall, + .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKSign_jcall, + .sign_justice_transaction = sign_justice_transaction_LDKSign_jcall, + .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKSign_jcall, + .sign_closing_transaction = sign_closing_transaction_LDKSign_jcall, + .sign_channel_announcement = sign_channel_announcement_LDKSign_jcall, + .ready_channel = ready_channel_LDKSign_jcall, .clone = LDKSign_JCalls_clone, - .write = write_jcall, + .write = write_LDKSign_jcall, .free = LDKSign_JCalls_free, .pubkeys = pubkeys_conv, .set_pubkeys = NULL, @@ -2991,7 +3007,7 @@ static void LDKWatch_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { +LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3016,7 +3032,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret); return ret_conv; } -LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { +LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3041,7 +3057,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_ar ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret); return ret_conv; } -LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) { +LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3085,9 +3101,9 @@ static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) { LDKWatch ret = { .this_arg = (void*) calls, - .watch_channel = watch_channel_jcall, - .update_channel = update_channel_jcall, - .release_pending_monitor_events = release_pending_monitor_events_jcall, + .watch_channel = watch_channel_LDKWatch_jcall, + .update_channel = update_channel_LDKWatch_jcall, + .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall, .free = LDKWatch_JCalls_free, }; return ret; @@ -3158,7 +3174,7 @@ static void LDKBroadcasterInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) { +void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) { LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3187,7 +3203,7 @@ static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, LDKBroadcasterInterface ret = { .this_arg = (void*) calls, - .broadcast_transaction = broadcast_transaction_jcall, + .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall, .free = LDKBroadcasterInterface_JCalls_free, }; return ret; @@ -3246,7 +3262,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKSecretKey get_node_secret_jcall(const void* this_arg) { +LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3258,7 +3274,7 @@ LDKSecretKey get_node_secret_jcall(const void* this_arg) { (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes); return ret_ref; } -LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { +LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3271,7 +3287,7 @@ LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); return ret_ref; } -LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { +LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3283,7 +3299,7 @@ LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); return ret_ref; } -LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { +LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3294,7 +3310,7 @@ LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t ch ret_conv = Sign_clone(ret); return ret_conv; } -LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { +LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3306,7 +3322,7 @@ LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); return ret_ref; } -LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) { +LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3347,12 +3363,12 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j LDKKeysInterface ret = { .this_arg = (void*) calls, - .get_node_secret = get_node_secret_jcall, - .get_destination_script = get_destination_script_jcall, - .get_shutdown_pubkey = get_shutdown_pubkey_jcall, - .get_channel_signer = get_channel_signer_jcall, - .get_secure_random_bytes = get_secure_random_bytes_jcall, - .read_chan_signer = read_chan_signer_jcall, + .get_node_secret = get_node_secret_LDKKeysInterface_jcall, + .get_destination_script = get_destination_script_LDKKeysInterface_jcall, + .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall, + .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall, + .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, + .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .free = LDKKeysInterface_JCalls_free, }; return ret; @@ -3425,7 +3441,7 @@ static void LDKFeeEstimator_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { +uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3451,7 +3467,7 @@ static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, job LDKFeeEstimator ret = { .this_arg = (void*) calls, - .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall, + .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall, .free = LDKFeeEstimator_JCalls_free, }; return ret; @@ -3483,7 +3499,7 @@ static void LDKLogger_JCalls_free(void* this_arg) { FREE(j_calls); } } -void log_jcall(const void* this_arg, const char* record) { +void log_LDKLogger_jcall(const void* this_arg, const char* record) { LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3510,7 +3526,7 @@ static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) { LDKLogger ret = { .this_arg = (void*) calls, - .log = log_jcall, + .log = log_LDKLogger_jcall, .free = LDKLogger_JCalls_free, }; return ret; @@ -4585,7 +4601,7 @@ static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) { +LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4625,7 +4641,7 @@ static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JN LDKMessageSendEventsProvider ret = { .this_arg = (void*) calls, - .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall, + .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall, .free = LDKMessageSendEventsProvider_JCalls_free, }; return ret; @@ -4666,7 +4682,7 @@ static void LDKEventsProvider_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) { +LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4706,7 +4722,7 @@ static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, LDKEventsProvider ret = { .this_arg = (void*) calls, - .get_and_clear_pending_events = get_and_clear_pending_events_jcall, + .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall, .free = LDKEventsProvider_JCalls_free, }; return ret; @@ -4747,7 +4763,7 @@ static void LDKAccess_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { +LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4777,7 +4793,7 @@ static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) { LDKAccess ret = { .this_arg = (void*) calls, - .get_utxo = get_utxo_jcall, + .get_utxo = get_utxo_LDKAccess_jcall, .free = LDKAccess_JCalls_free, }; return ret; @@ -4814,7 +4830,7 @@ static void LDKListen_JCalls_free(void* this_arg) { FREE(j_calls); } } -void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { +void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4825,7 +4841,7 @@ void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t heig CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height); } -void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { +void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4854,8 +4870,8 @@ static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) { LDKListen ret = { .this_arg = (void*) calls, - .block_connected = block_connected_jcall, - .block_disconnected = block_disconnected_jcall, + .block_connected = block_connected_LDKListen_jcall, + .block_disconnected = block_disconnected_LDKListen_jcall, .free = LDKListen_JCalls_free, }; return ret; @@ -4899,7 +4915,7 @@ static void LDKFilter_JCalls_free(void* this_arg) { FREE(j_calls); } } -void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) { +void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4912,7 +4928,7 @@ void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8sl CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr); } -void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) { +void register_output_LDKFilter_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -4950,8 +4966,8 @@ static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) { LDKFilter ret = { .this_arg = (void*) calls, - .register_tx = register_tx_jcall, - .register_output = register_output_jcall, + .register_tx = register_tx_LDKFilter_jcall, + .register_output = register_output_LDKFilter_jcall, .free = LDKFilter_JCalls_free, }; return ret; @@ -5002,7 +5018,7 @@ static void LDKPersist_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) { +LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5028,7 +5044,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* th ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret); return ret_conv; } -LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) { +LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5081,8 +5097,8 @@ static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) { LDKPersist ret = { .this_arg = (void*) calls, - .persist_new_channel = persist_new_channel_jcall, - .update_persisted_channel = update_persisted_channel_jcall, + .persist_new_channel = persist_new_channel_LDKPersist_jcall, + .update_persisted_channel = update_persisted_channel_LDKPersist_jcall, .free = LDKPersist_JCalls_free, }; return ret; @@ -5146,6 +5162,7 @@ typedef struct LDKChannelMessageHandler_JCalls { jmethodID peer_disconnected_meth; jmethodID peer_connected_meth; jmethodID handle_channel_reestablish_meth; + jmethodID handle_channel_update_meth; jmethodID handle_error_meth; } LDKChannelMessageHandler_JCalls; static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { @@ -5157,7 +5174,7 @@ static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { +void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5182,7 +5199,7 @@ void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref); } -void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { +void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5207,7 +5224,7 @@ void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_i CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref); } -void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) { +void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5225,7 +5242,7 @@ void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_ CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref); } -void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) { +void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5243,7 +5260,7 @@ void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_i CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref); } -void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) { +void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5261,7 +5278,7 @@ void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_i CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref); } -void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { +void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5287,7 +5304,7 @@ void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, con CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); } -void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { +void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5305,7 +5322,7 @@ void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_i CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref); } -void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) { +void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5323,7 +5340,7 @@ void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_ CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref); } -void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) { +void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5341,7 +5358,7 @@ void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_n CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref); } -void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) { +void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5359,7 +5376,7 @@ void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref); } -void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) { +void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5377,7 +5394,7 @@ void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref); } -void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) { +void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5395,7 +5412,7 @@ void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_nod CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref); } -void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) { +void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5413,7 +5430,7 @@ void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_i CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref); } -void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) { +void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5431,7 +5448,7 @@ void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, c CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref); } -void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) { +void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5449,7 +5466,7 @@ void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey the CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref); } -void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5459,7 +5476,7 @@ void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, b CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible); } -void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { +void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5477,7 +5494,7 @@ void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, cons CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref); } -void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) { +void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5495,7 +5512,25 @@ void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_n CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref); } -void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) { +void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + JNIEnv *env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); + int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + LDKChannelUpdate msg_var = *msg; + msg_var = ChannelUpdate_clone(msg); + CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long msg_ref = (long)msg_var.inner; + if (msg_var.is_owned) { + msg_ref |= 1; + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref); +} +void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5562,30 +5597,33 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->peer_connected_meth != NULL); calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V"); CHECK(calls->handle_channel_reestablish_meth != NULL); + calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V"); + CHECK(calls->handle_channel_update_meth != NULL); calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V"); CHECK(calls->handle_error_meth != NULL); LDKChannelMessageHandler ret = { .this_arg = (void*) calls, - .handle_open_channel = handle_open_channel_jcall, - .handle_accept_channel = handle_accept_channel_jcall, - .handle_funding_created = handle_funding_created_jcall, - .handle_funding_signed = handle_funding_signed_jcall, - .handle_funding_locked = handle_funding_locked_jcall, - .handle_shutdown = handle_shutdown_jcall, - .handle_closing_signed = handle_closing_signed_jcall, - .handle_update_add_htlc = handle_update_add_htlc_jcall, - .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall, - .handle_update_fail_htlc = handle_update_fail_htlc_jcall, - .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall, - .handle_commitment_signed = handle_commitment_signed_jcall, - .handle_revoke_and_ack = handle_revoke_and_ack_jcall, - .handle_update_fee = handle_update_fee_jcall, - .handle_announcement_signatures = handle_announcement_signatures_jcall, - .peer_disconnected = peer_disconnected_jcall, - .peer_connected = peer_connected_jcall, - .handle_channel_reestablish = handle_channel_reestablish_jcall, - .handle_error = handle_error_jcall, + .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall, + .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall, + .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall, + .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall, + .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall, + .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall, + .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall, + .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall, + .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall, + .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall, + .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall, + .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall, + .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall, + .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall, + .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall, + .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall, + .peer_connected = peer_connected_LDKChannelMessageHandler_jcall, + .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall, + .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall, + .handle_error = handle_error_LDKChannelMessageHandler_jcall, .free = LDKChannelMessageHandler_JCalls_free, .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider), }; @@ -5803,6 +5841,17 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1); + LDKPublicKey their_node_id_ref; + CHECK((*env)->GetArrayLength(env, their_node_id) == 33); + (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1); LDKPublicKey their_node_id_ref; @@ -5840,7 +5889,7 @@ static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) { +LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5859,7 +5908,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_a ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret); return ret_conv; } -LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) { +LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5878,7 +5927,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* thi ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret); return ret_conv; } -LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) { +LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5897,7 +5946,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret); return ret_conv; } -void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) { +void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5906,7 +5955,7 @@ void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFa CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update); } -LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { +LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5929,7 +5978,7 @@ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); return ret_constr; } -LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { +LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5956,7 +6005,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); return ret_constr; } -void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5974,7 +6023,7 @@ void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref); } -LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) { +LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -5994,7 +6043,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret); return ret_conv; } -LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) { +LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6014,7 +6063,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const vo ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret); return ret_conv; } -LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) { +LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6034,7 +6083,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret); return ret_conv; } -LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) { +LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6092,17 +6141,17 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en LDKRoutingMessageHandler ret = { .this_arg = (void*) calls, - .handle_node_announcement = handle_node_announcement_jcall, - .handle_channel_announcement = handle_channel_announcement_jcall, - .handle_channel_update = handle_channel_update_jcall, - .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall, - .get_next_channel_announcements = get_next_channel_announcements_jcall, - .get_next_node_announcements = get_next_node_announcements_jcall, - .sync_routing_table = sync_routing_table_jcall, - .handle_reply_channel_range = handle_reply_channel_range_jcall, - .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall, - .handle_query_channel_range = handle_query_channel_range_jcall, - .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall, + .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall, + .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall, + .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall, + .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall, + .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall, + .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall, + .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall, + .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall, + .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, + .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, + .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall, .free = LDKRoutingMessageHandler_JCalls_free, .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider), }; @@ -6273,7 +6322,7 @@ static void LDKSocketDescriptor_JCalls_free(void* this_arg) { FREE(j_calls); } } -uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) { +uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6284,7 +6333,7 @@ uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) { CHECK(obj != NULL); return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read); } -void disconnect_socket_jcall(void* this_arg) { +void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6292,7 +6341,7 @@ void disconnect_socket_jcall(void* this_arg) { CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth); } -bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) { +bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6302,7 +6351,7 @@ bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) { CHECK(obj != NULL); return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone); } -uint64_t hash_jcall(const void* this_arg) { +uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -6333,10 +6382,10 @@ static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass LDKSocketDescriptor ret = { .this_arg = (void*) calls, - .send_data = send_data_jcall, - .disconnect_socket = disconnect_socket_jcall, - .eq = eq_jcall, - .hash = hash_jcall, + .send_data = send_data_LDKSocketDescriptor_jcall, + .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall, + .eq = eq_LDKSocketDescriptor_jcall, + .hash = hash_LDKSocketDescriptor_jcall, .clone = LDKSocketDescriptor_JCalls_clone, .free = LDKSocketDescriptor_JCalls_free, }; @@ -10189,6 +10238,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1propo ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val); } +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKChannelConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val); +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelConfig this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -10219,8 +10283,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1up ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) { - LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) { + LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -16900,6 +16964,14 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd return ret_arr; } +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKQueryChannelRange this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index c102c708..cb791791 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -3079,6 +3079,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1c JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish (JNIEnv *, jclass, jlong, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelMessageHandler_handle_channel_update + * Signature: (J[BJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update + (JNIEnv *, jclass, jlong, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_handle_error @@ -6575,6 +6583,22 @@ JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1propo JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths (JNIEnv *, jclass, jlong, jint); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelConfig_get_cltv_expiry_delta + * Signature: (J)S + */ +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelConfig_set_cltv_expiry_delta + * Signature: (JS)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong, jshort); + /* * Class: org_ldk_impl_bindings * Method: ChannelConfig_get_announced_channel @@ -6610,10 +6634,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1up /* * Class: org_ldk_impl_bindings * Method: ChannelConfig_new - * Signature: (IZZ)J + * Signature: (ISZZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new - (JNIEnv *, jclass, jint, jboolean, jboolean); + (JNIEnv *, jclass, jint, jshort, jboolean, jboolean); /* * Class: org_ldk_impl_bindings @@ -11583,6 +11607,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: QueryChannelRange_end_blocknum + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: QueryChannelRange_read diff --git a/ts/bindings.c b/ts/bindings.c index b39872cb..91bffd57 100644 --- a/ts/bindings.c +++ b/ts/bindings.c @@ -642,6 +642,15 @@ uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ long msg_ref = (long)msg_var.inner & ~1; return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref; } + case LDKMessageSendEvent_SendReplyChannelRange: { + int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33); + LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg; + CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long msg_ref = (long)msg_var.inner & ~1; + return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref; + } default: abort(); } } @@ -1766,7 +1775,7 @@ static void LDKSign_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) { +LDKPublicKey get_per_commitment_point_LDKSign_jcall(const void* this_arg, uint64_t idx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx); LDKPublicKey ret_ref; @@ -1774,7 +1783,7 @@ LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33); return ret_ref; } -LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) { +LDKThirtyTwoBytes release_commitment_secret_LDKSign_jcall(const void* this_arg, uint64_t idx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx); LDKThirtyTwoBytes ret_ref; @@ -1782,7 +1791,7 @@ LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); return ret_ref; } -LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) { +LDKThirtyTwoBytes channel_keys_id_LDKSign_jcall(const void* this_arg) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth); LDKThirtyTwoBytes ret_ref; @@ -1790,7 +1799,7 @@ LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) { memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); return ret_ref; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) { +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKCommitmentTransaction commitment_tx_var = *commitment_tx; commitment_tx_var = CommitmentTransaction_clone(commitment_tx); @@ -1805,7 +1814,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_j ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret); return ret_conv; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx); @@ -1820,7 +1829,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { +LDKCResult_SignatureNoneZ sign_justice_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKTransaction justice_tx_var = justice_tx; int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -1841,7 +1850,7 @@ LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, L ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { +LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKTransaction htlc_tx_var = htlc_tx; int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -1862,7 +1871,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* t ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) { +LDKCResult_SignatureNoneZ sign_closing_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction closing_tx) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKTransaction closing_tx_var = closing_tx; int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -1873,7 +1882,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, L ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { +LDKCResult_SignatureNoneZ sign_channel_announcement_LDKSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKUnsignedChannelAnnouncement msg_var = *msg; msg_var = UnsignedChannelAnnouncement_clone(msg); @@ -1888,7 +1897,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret); return ret_conv; } -void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { +void ready_channel_LDKSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters); @@ -1900,7 +1909,7 @@ void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * } js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref); } -LDKCVec_u8Z write_jcall(const void* this_arg) { +LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->write_meth); LDKCVec_u8Z ret_ref; @@ -1926,18 +1935,18 @@ static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, uint3 LDKSign ret = { .this_arg = (void*) calls, - .get_per_commitment_point = get_per_commitment_point_jcall, - .release_commitment_secret = release_commitment_secret_jcall, - .channel_keys_id = channel_keys_id_jcall, - .sign_counterparty_commitment = sign_counterparty_commitment_jcall, - .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall, - .sign_justice_transaction = sign_justice_transaction_jcall, - .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall, - .sign_closing_transaction = sign_closing_transaction_jcall, - .sign_channel_announcement = sign_channel_announcement_jcall, - .ready_channel = ready_channel_jcall, + .get_per_commitment_point = get_per_commitment_point_LDKSign_jcall, + .release_commitment_secret = release_commitment_secret_LDKSign_jcall, + .channel_keys_id = channel_keys_id_LDKSign_jcall, + .sign_counterparty_commitment = sign_counterparty_commitment_LDKSign_jcall, + .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKSign_jcall, + .sign_justice_transaction = sign_justice_transaction_LDKSign_jcall, + .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKSign_jcall, + .sign_closing_transaction = sign_closing_transaction_LDKSign_jcall, + .sign_channel_announcement = sign_channel_announcement_LDKSign_jcall, + .ready_channel = ready_channel_LDKSign_jcall, .clone = LDKSign_JCalls_clone, - .write = write_jcall, + .write = write_LDKSign_jcall, .free = LDKSign_JCalls_free, .pubkeys = pubkeys_conv, .set_pubkeys = NULL, @@ -2336,7 +2345,7 @@ static void LDKWatch_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { +LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; LDKOutPoint funding_txo_var = funding_txo; CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -2357,7 +2366,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret); return ret_conv; } -LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { +LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; LDKOutPoint funding_txo_var = funding_txo; CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -2378,7 +2387,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_ar ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret); return ret_conv; } -LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) { +LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth); LDKCVec_MonitorEventZ ret_constr; @@ -2408,9 +2417,9 @@ static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) { LDKWatch ret = { .this_arg = (void*) calls, - .watch_channel = watch_channel_jcall, - .update_channel = update_channel_jcall, - .release_pending_monitor_events = release_pending_monitor_events_jcall, + .watch_channel = watch_channel_LDKWatch_jcall, + .update_channel = update_channel_LDKWatch_jcall, + .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall, .free = LDKWatch_JCalls_free, }; return ret; @@ -2476,7 +2485,7 @@ static void LDKBroadcasterInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) { +void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) { LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg; LDKTransaction tx_var = tx; int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -2496,7 +2505,7 @@ static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS O LDKBroadcasterInterface ret = { .this_arg = (void*) calls, - .broadcast_transaction = broadcast_transaction_jcall, + .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall, .free = LDKBroadcasterInterface_JCalls_free, }; return ret; @@ -2556,7 +2565,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKSecretKey get_node_secret_jcall(const void* this_arg) { +LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth); LDKSecretKey ret_ref; @@ -2564,7 +2573,7 @@ LDKSecretKey get_node_secret_jcall(const void* this_arg) { memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32); return ret_ref; } -LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { +LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth); LDKCVec_u8Z ret_ref; @@ -2573,7 +2582,7 @@ LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen); return ret_ref; } -LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { +LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth); LDKPublicKey ret_ref; @@ -2581,14 +2590,14 @@ LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33); return ret_ref; } -LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { +LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis); LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1); ret_conv = Sign_clone(ret); return ret_conv; } -LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { +LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth); LDKThirtyTwoBytes ret_ref; @@ -2596,7 +2605,7 @@ LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); return ret_ref; } -LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) { +LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; LDKu8slice reader_var = reader; int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -2618,12 +2627,12 @@ static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Referenc LDKKeysInterface ret = { .this_arg = (void*) calls, - .get_node_secret = get_node_secret_jcall, - .get_destination_script = get_destination_script_jcall, - .get_shutdown_pubkey = get_shutdown_pubkey_jcall, - .get_channel_signer = get_channel_signer_jcall, - .get_secure_random_bytes = get_secure_random_bytes_jcall, - .read_chan_signer = read_chan_signer_jcall, + .get_node_secret = get_node_secret_LDKKeysInterface_jcall, + .get_destination_script = get_destination_script_LDKKeysInterface_jcall, + .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall, + .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall, + .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, + .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .free = LDKKeysInterface_JCalls_free, }; return ret; @@ -2691,7 +2700,7 @@ static void LDKFeeEstimator_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { +uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target); return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv); @@ -2708,7 +2717,7 @@ static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference LDKFeeEstimator ret = { .this_arg = (void*) calls, - .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall, + .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall, .free = LDKFeeEstimator_JCalls_free, }; return ret; @@ -2736,7 +2745,7 @@ static void LDKLogger_JCalls_free(void* this_arg) { FREE(j_calls); } } -void log_jcall(const void* this_arg, const char* record) { +void log_LDKLogger_jcall(const void* this_arg, const char* record) { LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg; const char* record_str = record; jstring record_conv = str_ref_to_ts(record_str, strlen(record_str)); @@ -2754,7 +2763,7 @@ static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) { LDKLogger ret = { .this_arg = (void*) calls, - .log = log_jcall, + .log = log_LDKLogger_jcall, .free = LDKLogger_JCalls_free, }; return ret; @@ -3818,7 +3827,7 @@ static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) { +LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth); LDKCVec_MessageSendEventZ ret_constr; @@ -3848,7 +3857,7 @@ static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/* LDKMessageSendEventsProvider ret = { .this_arg = (void*) calls, - .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall, + .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall, .free = LDKMessageSendEventsProvider_JCalls_free, }; return ret; @@ -3884,7 +3893,7 @@ static void LDKEventsProvider_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) { +LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth); LDKCVec_EventZ ret_constr; @@ -3914,7 +3923,7 @@ static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Refere LDKEventsProvider ret = { .this_arg = (void*) calls, - .get_and_clear_pending_events = get_and_clear_pending_events_jcall, + .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall, .free = LDKEventsProvider_JCalls_free, }; return ret; @@ -3950,7 +3959,7 @@ static void LDKAccess_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { +LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32); @@ -3971,7 +3980,7 @@ static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) { LDKAccess ret = { .this_arg = (void*) calls, - .get_utxo = get_utxo_jcall, + .get_utxo = get_utxo_LDKAccess_jcall, .free = LDKAccess_JCalls_free, }; return ret; @@ -4005,14 +4014,14 @@ static void LDKListen_JCalls_free(void* this_arg) { FREE(j_calls); } } -void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { +void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; LDKu8slice block_var = block; int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen); js_invoke_function_2(j_calls->block_connected_meth, block_arr, height); } -void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { +void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(header_arr + 4), *header, 80); @@ -4030,8 +4039,8 @@ static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) { LDKListen ret = { .this_arg = (void*) calls, - .block_connected = block_connected_jcall, - .block_disconnected = block_disconnected_jcall, + .block_connected = block_connected_LDKListen_jcall, + .block_disconnected = block_disconnected_LDKListen_jcall, .free = LDKListen_JCalls_free, }; return ret; @@ -4071,7 +4080,7 @@ static void LDKFilter_JCalls_free(void* this_arg) { FREE(j_calls); } } -void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) { +void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(txid_arr + 4), *txid, 32); @@ -4080,7 +4089,7 @@ void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8sl memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen); js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr); } -void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) { +void register_output_LDKFilter_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; LDKOutPoint outpoint_var = *outpoint; outpoint_var = OutPoint_clone(outpoint); @@ -4107,8 +4116,8 @@ static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) { LDKFilter ret = { .this_arg = (void*) calls, - .register_tx = register_tx_jcall, - .register_output = register_output_jcall, + .register_tx = register_tx_LDKFilter_jcall, + .register_output = register_output_LDKFilter_jcall, .free = LDKFilter_JCalls_free, }; return ret; @@ -4154,7 +4163,7 @@ static void LDKPersist_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) { +LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; LDKOutPoint id_var = id; CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -4176,7 +4185,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* th ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret); return ret_conv; } -LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) { +LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; LDKOutPoint id_var = id; CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -4218,8 +4227,8 @@ static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) LDKPersist ret = { .this_arg = (void*) calls, - .persist_new_channel = persist_new_channel_jcall, - .update_persisted_channel = update_persisted_channel_jcall, + .persist_new_channel = persist_new_channel_LDKPersist_jcall, + .update_persisted_channel = update_persisted_channel_LDKPersist_jcall, .free = LDKPersist_JCalls_free, }; return ret; @@ -4281,6 +4290,7 @@ typedef struct LDKChannelMessageHandler_JCalls { uint32_t peer_disconnected_meth; uint32_t peer_connected_meth; uint32_t handle_channel_reestablish_meth; + uint32_t handle_channel_update_meth; uint32_t handle_error_meth; } LDKChannelMessageHandler_JCalls; static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { @@ -4304,11 +4314,12 @@ static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { js_free(j_calls->peer_disconnected_meth); js_free(j_calls->peer_connected_meth); js_free(j_calls->handle_channel_reestablish_meth); + js_free(j_calls->handle_channel_update_meth); js_free(j_calls->handle_error_meth); FREE(j_calls); } } -void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { +void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4329,7 +4340,7 @@ void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, } js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref); } -void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { +void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4350,7 +4361,7 @@ void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_i } js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref); } -void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) { +void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4364,7 +4375,7 @@ void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_ } js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref); } -void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) { +void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4378,7 +4389,7 @@ void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_i } js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref); } -void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) { +void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4392,7 +4403,7 @@ void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_i } js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref); } -void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { +void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4414,7 +4425,7 @@ void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, con } js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); } -void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { +void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4428,7 +4439,7 @@ void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_i } js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref); } -void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) { +void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4442,7 +4453,7 @@ void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_ } js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref); } -void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) { +void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4456,7 +4467,7 @@ void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_n } js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref); } -void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) { +void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4470,7 +4481,7 @@ void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node } js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref); } -void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) { +void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4484,7 +4495,7 @@ void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey } js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref); } -void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) { +void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4498,7 +4509,7 @@ void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_nod } js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref); } -void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) { +void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4512,7 +4523,7 @@ void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_i } js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref); } -void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) { +void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4526,7 +4537,7 @@ void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, c } js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref); } -void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) { +void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4540,13 +4551,13 @@ void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey the } js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref); } -void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible); } -void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { +void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4560,7 +4571,7 @@ void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, cons } js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref); } -void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) { +void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4574,7 +4585,21 @@ void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_n } js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref); } -void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) { +void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) { + LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; + int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); + LDKChannelUpdate msg_var = *msg; + msg_var = ChannelUpdate_clone(msg); + CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long msg_ref = (long)msg_var.inner; + if (msg_var.is_owned) { + msg_ref |= 1; + } + js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref); +} +void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4601,25 +4626,26 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS LDKChannelMessageHandler ret = { .this_arg = (void*) calls, - .handle_open_channel = handle_open_channel_jcall, - .handle_accept_channel = handle_accept_channel_jcall, - .handle_funding_created = handle_funding_created_jcall, - .handle_funding_signed = handle_funding_signed_jcall, - .handle_funding_locked = handle_funding_locked_jcall, - .handle_shutdown = handle_shutdown_jcall, - .handle_closing_signed = handle_closing_signed_jcall, - .handle_update_add_htlc = handle_update_add_htlc_jcall, - .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall, - .handle_update_fail_htlc = handle_update_fail_htlc_jcall, - .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall, - .handle_commitment_signed = handle_commitment_signed_jcall, - .handle_revoke_and_ack = handle_revoke_and_ack_jcall, - .handle_update_fee = handle_update_fee_jcall, - .handle_announcement_signatures = handle_announcement_signatures_jcall, - .peer_disconnected = peer_disconnected_jcall, - .peer_connected = peer_connected_jcall, - .handle_channel_reestablish = handle_channel_reestablish_jcall, - .handle_error = handle_error_jcall, + .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall, + .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall, + .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall, + .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall, + .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall, + .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall, + .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall, + .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall, + .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall, + .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall, + .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall, + .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall, + .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall, + .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall, + .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall, + .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall, + .peer_connected = peer_connected_LDKChannelMessageHandler_jcall, + .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall, + .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall, + .handle_error = handle_error_LDKChannelMessageHandler_jcall, .free = LDKChannelMessageHandler_JCalls_free, .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider), }; @@ -4837,6 +4863,17 @@ void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_cha (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } +void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) { + LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1); + LDKPublicKey their_node_id_ref; + CHECK(*((uint32_t*)their_node_id) == 33); + memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33); + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); +} + void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) { LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1); LDKPublicKey their_node_id_ref; @@ -4880,7 +4917,7 @@ static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) { +LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; LDKNodeAnnouncement msg_var = *msg; msg_var = NodeAnnouncement_clone(msg); @@ -4895,7 +4932,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_a ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret); return ret_conv; } -LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) { +LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; LDKChannelAnnouncement msg_var = *msg; msg_var = ChannelAnnouncement_clone(msg); @@ -4910,7 +4947,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* thi ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret); return ret_conv; } -LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) { +LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; LDKChannelUpdate msg_var = *msg; msg_var = ChannelUpdate_clone(msg); @@ -4925,12 +4962,12 @@ LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret); return ret_conv; } -void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) { +void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; long ret_update = (long)update; js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update); } -LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { +LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr; @@ -4948,7 +4985,7 @@ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel } return ret_constr; } -LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { +LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33); @@ -4970,7 +5007,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg } return ret_constr; } -void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -4984,7 +5021,7 @@ void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, } js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref); } -LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) { +LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -5000,7 +5037,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret); return ret_conv; } -LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) { +LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -5016,7 +5053,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const vo ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret); return ret_conv; } -LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) { +LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -5032,7 +5069,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret); return ret_conv; } -LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) { +LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); @@ -5061,17 +5098,17 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS LDKRoutingMessageHandler ret = { .this_arg = (void*) calls, - .handle_node_announcement = handle_node_announcement_jcall, - .handle_channel_announcement = handle_channel_announcement_jcall, - .handle_channel_update = handle_channel_update_jcall, - .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall, - .get_next_channel_announcements = get_next_channel_announcements_jcall, - .get_next_node_announcements = get_next_node_announcements_jcall, - .sync_routing_table = sync_routing_table_jcall, - .handle_reply_channel_range = handle_reply_channel_range_jcall, - .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall, - .handle_query_channel_range = handle_query_channel_range_jcall, - .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall, + .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall, + .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall, + .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall, + .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall, + .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall, + .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall, + .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall, + .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall, + .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, + .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, + .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall, .free = LDKRoutingMessageHandler_JCalls_free, .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider), }; @@ -5239,24 +5276,24 @@ static void LDKSocketDescriptor_JCalls_free(void* this_arg) { FREE(j_calls); } } -uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) { +uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; LDKu8slice data_var = data; int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen); return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read); } -void disconnect_socket_jcall(void* this_arg) { +void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; js_invoke_function_0(j_calls->disconnect_socket_meth); } -bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) { +bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor"); *other_arg_clone = SocketDescriptor_clone(other_arg); return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone); } -uint64_t hash_jcall(const void* this_arg) { +uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; return js_invoke_function_0(j_calls->hash_meth); } @@ -5272,10 +5309,10 @@ static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Re LDKSocketDescriptor ret = { .this_arg = (void*) calls, - .send_data = send_data_jcall, - .disconnect_socket = disconnect_socket_jcall, - .eq = eq_jcall, - .hash = hash_jcall, + .send_data = send_data_LDKSocketDescriptor_jcall, + .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall, + .eq = eq_LDKSocketDescriptor_jcall, + .hash = hash_LDKSocketDescriptor_jcall, .clone = LDKSocketDescriptor_JCalls_clone, .free = LDKSocketDescriptor_JCalls_free, }; @@ -9104,6 +9141,21 @@ void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportion ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val); } +int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKChannelConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { + LDKChannelConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val); +} + jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) { LDKChannelConfig this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -9134,8 +9186,8 @@ void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) { - LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); +uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) { + LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -15650,6 +15702,14 @@ int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_w return ret_arr; } +int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) { + LDKQueryChannelRange this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv); + return ret_val; +} + uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); diff --git a/ts/bindings.ts b/ts/bindings.ts index efa5422f..6de31bc4 100644 --- a/ts/bindings.ts +++ b/ts/bindings.ts @@ -317,6 +317,11 @@ public static native long new_empty_slice_vec(); public number msg; SendShortIdsQuery(Uint8Array node_id, number msg) { this.node_id = node_id; this.msg = msg; } } + export class SendReplyChannelRange extends LDKMessageSendEvent { + public Uint8Array node_id; + public number msg; + SendReplyChannelRange(Uint8Array node_id, number msg) { this.node_id = node_id; this.msg = msg; } + } static native void init(); } static { LDKMessageSendEvent.init(); } @@ -1214,6 +1219,7 @@ public static native long new_empty_slice_vec(); peer_disconnected (their_node_id: Uint8Array, no_connection_possible: boolean): void; peer_connected (their_node_id: Uint8Array, msg: number): void; handle_channel_reestablish (their_node_id: Uint8Array, msg: number): void; + handle_channel_update (their_node_id: Uint8Array, msg: number): void; handle_error (their_node_id: Uint8Array, msg: number): void; } @@ -1368,6 +1374,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelMessageHandler_handle_channel_reestablish(this_arg, encodeArray(their_node_id), msg); // debug statements here } + // void ChannelMessageHandler_handle_channel_update LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg + export function ChannelMessageHandler_handle_channel_update(this_arg: number, their_node_id: Uint8Array, msg: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelMessageHandler_handle_channel_update(this_arg, encodeArray(their_node_id), msg); + // debug statements here + } // void ChannelMessageHandler_handle_error LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg export function ChannelMessageHandler_handle_error(this_arg: number, their_node_id: Uint8Array, msg: number): void { if(!isWasmInitialized) { @@ -4893,6 +4907,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelConfig_set_fee_proportional_millionths(this_ptr, val); // debug statements here } + // uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + export function ChannelConfig_get_cltv_expiry_delta(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelConfig_get_cltv_expiry_delta(this_ptr); + return nativeResponseValue; + } + // void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); + export function ChannelConfig_set_cltv_expiry_delta(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelConfig_set_cltv_expiry_delta(this_ptr, val); + // debug statements here + } // bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); export function ChannelConfig_get_announced_channel(this_ptr: number): boolean { if(!isWasmInitialized) { @@ -4925,12 +4955,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); - export function ChannelConfig_new(fee_proportional_millionths_arg: number, announced_channel_arg: boolean, commit_upfront_shutdown_pubkey_arg: boolean): number { + // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg); + export function ChannelConfig_new(fee_proportional_millionths_arg: number, cltv_expiry_delta_arg: number, announced_channel_arg: boolean, commit_upfront_shutdown_pubkey_arg: boolean): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); + const nativeResponseValue = wasm.ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); return nativeResponseValue; } // struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); @@ -9901,6 +9931,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ReplyShortChannelIdsEnd_write(obj); return decodeArray(nativeResponseValue); } + // MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); + export function QueryChannelRange_end_blocknum(this_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.QueryChannelRange_end_blocknum(this_arg); + return nativeResponseValue; + } // struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); export function QueryChannelRange_read(ser: Uint8Array): number { if(!isWasmInitialized) { diff --git a/ts/structs/ChannelConfig.ts b/ts/structs/ChannelConfig.ts index 9bdf48c6..afb53fb0 100644 --- a/ts/structs/ChannelConfig.ts +++ b/ts/structs/ChannelConfig.ts @@ -27,6 +27,15 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelConfig_set_fee_proportional_millionths(this.ptr, val); } + public number get_cltv_expiry_delta() { + number ret = bindings.ChannelConfig_get_cltv_expiry_delta(this.ptr); + return ret; + } + + public void set_cltv_expiry_delta(number val) { + bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val); + } + public boolean get_announced_channel() { boolean ret = bindings.ChannelConfig_get_announced_channel(this.ptr); return ret; @@ -45,8 +54,8 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val); } - public static ChannelConfig constructor_new(number fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { - number ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); + public static ChannelConfig constructor_new(number fee_proportional_millionths_arg, number cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { + number ret = bindings.ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg); const ret_hu_conv: ChannelConfig = new ChannelConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/ChannelMessageHandler.ts b/ts/structs/ChannelMessageHandler.ts index a9ffbd7c..41e892fe 100644 --- a/ts/structs/ChannelMessageHandler.ts +++ b/ts/structs/ChannelMessageHandler.ts @@ -127,6 +127,11 @@ import * as bindings from '../bindings' // TODO: figure out location arg.handle_channel_reestablish(their_node_id, msg_hu_conv); }, + handle_channel_update (their_node_id: Uint8Array, msg: number): void { + const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg); + arg.handle_channel_update(their_node_id, msg_hu_conv); + }, + handle_error (their_node_id: Uint8Array, msg: number): void { const msg_hu_conv: ErrorMessage = new ErrorMessage(null, msg); arg.handle_error(their_node_id, msg_hu_conv); @@ -157,6 +162,7 @@ import * as bindings from '../bindings' // TODO: figure out location peer_disconnected(their_node_id: Uint8Array, no_connection_possible: boolean): void; peer_connected(their_node_id: Uint8Array, msg: Init): void; handle_channel_reestablish(their_node_id: Uint8Array, msg: ChannelReestablish): void; + handle_channel_update(their_node_id: Uint8Array, msg: ChannelUpdate): void; handle_error(their_node_id: Uint8Array, msg: ErrorMessage): void; } @@ -256,6 +262,11 @@ import * as bindings from '../bindings' // TODO: figure out location this.ptrs_to.add(msg); } + public void handle_channel_update(Uint8Array their_node_id, ChannelUpdate msg) { + bindings.ChannelMessageHandler_handle_channel_update(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); + this.ptrs_to.add(msg); + } + public void handle_error(Uint8Array their_node_id, ErrorMessage msg) { bindings.ChannelMessageHandler_handle_error(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); this.ptrs_to.add(msg); diff --git a/ts/structs/InvoiceFeatures.ts b/ts/structs/InvoiceFeatures.ts new file mode 100644 index 00000000..ba5f0bf0 --- /dev/null +++ b/ts/structs/InvoiceFeatures.ts @@ -0,0 +1,53 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class InvoiceFeatures extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.InvoiceFeatures_free(this.ptr); + } + } + public InvoiceFeatures clone() { + number ret = bindings.InvoiceFeatures_clone(this.ptr); + const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static InvoiceFeatures constructor_empty() { + number ret = bindings.InvoiceFeatures_empty(); + const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static InvoiceFeatures constructor_known() { + number ret = bindings.InvoiceFeatures_known(); + const ret_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public Uint8Array write() { + Uint8Array ret = bindings.InvoiceFeatures_write(this.ptr); + return ret; + } + + public static Result_InvoiceFeaturesDecodeErrorZ constructor_read(Uint8Array ser) { + number ret = bindings.InvoiceFeatures_read(ser); + Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/MessageSendEvent.ts b/ts/structs/MessageSendEvent.ts index 7c8ebdfa..38998e25 100644 --- a/ts/structs/MessageSendEvent.ts +++ b/ts/structs/MessageSendEvent.ts @@ -64,6 +64,9 @@ export default class MessageSendEvent extends CommonBase { if (raw_val instanceof bindings.LDKMessageSendEvent.SendShortIdsQuery) { return new SendShortIdsQuery(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKMessageSendEvent.SendReplyChannelRange) { + return new SendReplyChannelRange(this.ptr, raw_val); + } throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } @@ -281,3 +284,15 @@ export class SendShortIdsQuery extends MessageSendEvent { this.msg = msg_hu_conv; } } +export class SendReplyChannelRange extends MessageSendEvent { + public node_id: Uint8Array; + public msg: ReplyChannelRange; + private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.SendReplyChannelRange) { + super(null, ptr); + this.node_id = obj.node_id; + const msg: number = obj.msg; + const msg_hu_conv: ReplyChannelRange = new ReplyChannelRange(null, msg); + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } +} diff --git a/ts/structs/QueryChannelRange.ts b/ts/structs/QueryChannelRange.ts index 4a4a6e22..1b6be47b 100644 --- a/ts/structs/QueryChannelRange.ts +++ b/ts/structs/QueryChannelRange.ts @@ -59,6 +59,11 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public number end_blocknum() { + number ret = bindings.QueryChannelRange_end_blocknum(this.ptr); + return ret; + } + public static Result_QueryChannelRangeDecodeErrorZ constructor_read(Uint8Array ser) { number ret = bindings.QueryChannelRange_read(ser); Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); diff --git a/ts/structs/Result_InvoiceFeaturesDecodeErrorZ.ts b/ts/structs/Result_InvoiceFeaturesDecodeErrorZ.ts new file mode 100644 index 00000000..ac13a5ae --- /dev/null +++ b/ts/structs/Result_InvoiceFeaturesDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { + private Result_InvoiceFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InvoiceFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_InvoiceFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_InvoiceFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_InvoiceFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_InvoiceFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_InvoiceFeaturesDecodeErrorZ_OK extends Result_InvoiceFeaturesDecodeErrorZ { + public final InvoiceFeatures res; + private Result_InvoiceFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(ptr); + const res_hu_conv: InvoiceFeatures = new InvoiceFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_InvoiceFeaturesDecodeErrorZ_OK(InvoiceFeatures res) { + this(null, bindings.CResult_InvoiceFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_InvoiceFeaturesDecodeErrorZ_Err extends Result_InvoiceFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_InvoiceFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(ptr); + const err_hu_conv: DecodeError = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_InvoiceFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_InvoiceFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +}