keys_var = PreCalculatedTxCreationKeys_clone(keys);
CHECK((((long)keys_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&keys_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long keys_ref = (long)keys_var.inner & ~1;
+ long keys_ref = (long)keys_var.inner;
+ if (keys_var.is_owned) {
+ keys_ref |= 1;
+ }
LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
+ long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner;
+ if (holder_commitment_tx_var.is_owned) {
+ holder_commitment_tx_ref |= 1;
+ }
jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
CHECK(obj != NULL);
LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx_ref);
holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
+ long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner;
+ if (holder_commitment_tx_var.is_owned) {
+ holder_commitment_tx_ref |= 1;
+ }
jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
CHECK(obj != NULL);
LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx_ref);
htlc_var = HTLCOutputInCommitment_clone(htlc);
CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long htlc_ref = (long)htlc_var.inner & ~1;
+ long htlc_ref = (long)htlc_var.inner;
+ if (htlc_var.is_owned) {
+ htlc_ref |= 1;
+ }
jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
CHECK(obj != NULL);
LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
htlc_var = HTLCOutputInCommitment_clone(htlc);
CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long htlc_ref = (long)htlc_var.inner & ~1;
+ long htlc_ref = (long)htlc_var.inner;
+ if (htlc_var.is_owned) {
+ htlc_ref |= 1;
+ }
jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
CHECK(obj != NULL);
LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
msg_var = UnsignedChannelAnnouncement_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 & ~1;
+ 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);
LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
channel_points_var = ChannelPublicKeys_clone(channel_points);
CHECK((((long)channel_points_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&channel_points_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long channel_points_ref = (long)channel_points_var.inner & ~1;
+ long channel_points_ref = (long)channel_points_var.inner;
+ if (channel_points_var.is_owned) {
+ channel_points_ref |= 1;
+ }
jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
CHECK(obj != NULL);
return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points_ref, counterparty_selected_contest_delay, holder_selected_contest_delay);
outpoint_var = OutPoint_clone(outpoint);
CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- long outpoint_ref = (long)outpoint_var.inner & ~1;
+ long outpoint_ref = (long)outpoint_var.inner;
+ if (outpoint_var.is_owned) {
+ outpoint_ref |= 1;
+ }
LDKu8slice script_pubkey_var = script_pubkey;
jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
(*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
msg_var = OpenChannel_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 & ~1;
+ 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_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
msg_var = AcceptChannel_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 & ~1;
+ 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_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
msg_var = FundingCreated_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 & ~1;
+ 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_funding_created_meth, their_node_id_arr, msg_ref);
msg_var = FundingSigned_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 & ~1;
+ 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_funding_signed_meth, their_node_id_arr, msg_ref);
msg_var = FundingLocked_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 & ~1;
+ 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_funding_locked_meth, their_node_id_arr, msg_ref);
msg_var = Shutdown_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 & ~1;
+ 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_shutdown_meth, their_node_id_arr, msg_ref);
msg_var = ClosingSigned_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 & ~1;
+ 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_closing_signed_meth, their_node_id_arr, msg_ref);
msg_var = UpdateAddHTLC_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 & ~1;
+ 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_update_add_htlc_meth, their_node_id_arr, msg_ref);
msg_var = UpdateFulfillHTLC_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 & ~1;
+ 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_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
msg_var = UpdateFailHTLC_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 & ~1;
+ 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_update_fail_htlc_meth, their_node_id_arr, msg_ref);
msg_var = UpdateFailMalformedHTLC_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 & ~1;
+ 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_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
msg_var = CommitmentSigned_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 & ~1;
+ 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_commitment_signed_meth, their_node_id_arr, msg_ref);
msg_var = RevokeAndACK_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 & ~1;
+ 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_revoke_and_ack_meth, their_node_id_arr, msg_ref);
msg_var = UpdateFee_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 & ~1;
+ 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_update_fee_meth, their_node_id_arr, msg_ref);
msg_var = AnnouncementSignatures_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 & ~1;
+ 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_announcement_signatures_meth, their_node_id_arr, msg_ref);
msg_var = Init_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 & ~1;
+ 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->peer_connected_meth, their_node_id_arr, msg_ref);
msg_var = ChannelReestablish_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 & ~1;
+ 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_reestablish_meth, their_node_id_arr, msg_ref);
msg_var = ErrorMessage_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 & ~1;
+ 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_error_meth, their_node_id_arr, msg_ref);
msg_var = NodeAnnouncement_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 & ~1;
+ 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);
LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
msg_var = ChannelAnnouncement_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 & ~1;
+ 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);
LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
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 & ~1;
+ 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);
LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);