X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fbindings.c;fp=ts%2Fbindings.c;h=91bffd579158860bd0439dc6f40bef5193c13cad;hb=f8c25e52ce878136043ddc4dbfac6c6640f1d4f6;hp=b39872cb21714a54d7a96804208e04fae0b76295;hpb=bbc02b4a3cfdb5f32cdd650fdcd4dc4e55ca1517;p=ldk-java 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);