Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<fix>(transaction): fix transaction struct coredump bug, use inherit TransactionData and builder interfaces. #211

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bcos-c-sdk/bcos_sdk_c_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ void bcos_sdk_c_handle_response(
if (errorPtr && errorPtr->errorCode() != 0)
{
resp->error = errorPtr->errorCode();
// not copy here because cpp sdk will release the errorPtr
resp->desc = (char*)errorPtr->errorMessage().c_str();
resp->data = NULL;
resp->size = 0;
Expand Down
42 changes: 21 additions & 21 deletions bcos-c-sdk/bcos_sdk_c_uti_tx_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,32 +643,32 @@ void bcos_sdk_destroy_transaction_data_struct(struct bcos_sdk_c_transaction_data
return;
}

if (transaction_data && transaction_data->chain_id)
if (transaction_data->chain_id)
{
bcos_sdk_c_free(transaction_data->chain_id);
}

if (transaction_data && transaction_data->group_id)
if (transaction_data->group_id)
{
bcos_sdk_c_free(transaction_data->group_id);
}

if (transaction_data && transaction_data->nonce)
if (transaction_data->nonce)
{
bcos_sdk_c_free(transaction_data->nonce);
}

if (transaction_data && transaction_data->to)
if (transaction_data->to)
{
bcos_sdk_c_free(transaction_data->to);
}

if (transaction_data && transaction_data->abi)
if (transaction_data->abi)
{
bcos_sdk_c_free((void*)transaction_data->abi);
}

if (transaction_data && transaction_data->input)
if (transaction_data->input)
{
if (transaction_data->input->buffer)
{
Expand Down Expand Up @@ -974,12 +974,12 @@ void bcos_sdk_destroy_transaction_struct(struct bcos_sdk_c_transaction* transact
return;
}

if (transaction && transaction->transaction_data)
if (transaction->transaction_data)
{
bcos_sdk_destroy_transaction_data_struct(transaction->transaction_data);
}

if (transaction && transaction->data_hash)
if (transaction->data_hash)
{
if (transaction->data_hash->buffer)
{
Expand All @@ -988,7 +988,7 @@ void bcos_sdk_destroy_transaction_struct(struct bcos_sdk_c_transaction* transact
bcos_sdk_c_free(transaction->data_hash);
}

if (transaction && transaction->signature)
if (transaction->signature)
{
if (transaction->signature->buffer)
{
Expand All @@ -997,7 +997,7 @@ void bcos_sdk_destroy_transaction_struct(struct bcos_sdk_c_transaction* transact
bcos_sdk_c_free(transaction->signature);
}

if (transaction && transaction->sender)
if (transaction->sender)
{
if (transaction->sender->buffer)
{
Expand All @@ -1006,7 +1006,7 @@ void bcos_sdk_destroy_transaction_struct(struct bcos_sdk_c_transaction* transact
bcos_sdk_c_free(transaction->sender);
}

if (transaction && transaction->extra_data)
if (transaction->extra_data)
{
bcos_sdk_c_free(transaction->extra_data);
}
Expand Down Expand Up @@ -1322,32 +1322,32 @@ void bcos_sdk_destroy_transaction_data_struct_v2(
return;
}

if (transaction_data && transaction_data->chain_id)
if (transaction_data->chain_id)
{
bcos_sdk_c_free(transaction_data->chain_id);
}

if (transaction_data && transaction_data->group_id)
if (transaction_data->group_id)
{
bcos_sdk_c_free(transaction_data->group_id);
}

if (transaction_data && transaction_data->nonce)
if (transaction_data->nonce)
{
bcos_sdk_c_free(transaction_data->nonce);
}

if (transaction_data && transaction_data->to)
if (transaction_data->to)
{
bcos_sdk_c_free(transaction_data->to);
}

if (transaction_data && transaction_data->abi)
if (transaction_data->abi)
{
bcos_sdk_c_free((void*)transaction_data->abi);
}

if (transaction_data && transaction_data->input)
if (transaction_data->input)
{
if (transaction_data->input->buffer)
{
Expand All @@ -1356,22 +1356,22 @@ void bcos_sdk_destroy_transaction_data_struct_v2(
bcos_sdk_c_free((void*)transaction_data->input);
}

if (transaction_data && transaction_data->value)
if (transaction_data->value)
{
bcos_sdk_c_free(transaction_data->value);
}

if (transaction_data && transaction_data->gas_price)
if (transaction_data->gas_price)
{
bcos_sdk_c_free(transaction_data->gas_price);
}

if (transaction_data && transaction_data->max_fee_per_gas)
if (transaction_data->max_fee_per_gas)
{
bcos_sdk_c_free(transaction_data->max_fee_per_gas);
}

if (transaction_data && transaction_data->max_priority_fee_per_gas)
if (transaction_data->max_priority_fee_per_gas)
{
bcos_sdk_c_free(transaction_data->max_priority_fee_per_gas);
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/java/jni/scripts/java2jni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function convert_java_to_jni() {
# convert_java_to_jni ${JAVA_SOURCE_PATH}

# classes="rpc.RpcJniObj amop.AmopJniObj event.EventSubJniObj BcosSDKJniObj"
classes="BcosSDKJniObj utilities.keypair.KeyPairJniObj utilities.tx.TransactionBuilderJniObj utilities.tx.TransactionBuilderV2JniObj utilities.tx.TransactionStructBuilderJniObj utilities.tx.TransactionStructBuilderV2JniObj utilities.receipt.ReceiptBuilderJniObj utilities.signature.SignatureJniObj"
classes="BcosSDKJniObj utilities.keypair.KeyPairJniObj utilities.tx.TransactionBuilderJniObj utilities.tx.TransactionBuilderV2JniObj utilities.tx.TransactionStructBuilderJniObj utilities.receipt.ReceiptBuilderJniObj utilities.signature.SignatureJniObj"

for class in ${classes}
do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void on_receive_rpc_response(struct bcos_sdk_c_struct_response* resp)

// byte[] data
jfieldID dataFieldID = env->GetFieldID(responseClass, "data", "[B");
if (errorMsgFieldID == NULL)
if (dataFieldID == NULL)
{
env->ExceptionDescribe();
env->DeleteGlobalRef(jcallback);
Expand Down
Loading
Loading