Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 77d7a9b

Browse files
committed
cleanup(core): Remove useless core function
cclient_get_txn_to_approve is deprecated.
1 parent 3b4ce4d commit 77d7a9b

File tree

3 files changed

+0
-59
lines changed

3 files changed

+0
-59
lines changed

accelerator/common_core.c

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,6 @@ int cc_logger_release() {
2525
return 0;
2626
}
2727

28-
status_t cclient_get_txn_to_approve(const iota_client_service_t* const service, uint8_t const depth,
29-
ta_get_tips_res_t* res) {
30-
if (res == NULL) {
31-
ta_log_error("%s\n", "SC_TA_NULL");
32-
return SC_TA_NULL;
33-
}
34-
35-
status_t ret = SC_OK;
36-
get_transactions_to_approve_req_t* get_txn_req = get_transactions_to_approve_req_new();
37-
get_transactions_to_approve_res_t* get_txn_res = get_transactions_to_approve_res_new();
38-
if (get_txn_req == NULL || get_txn_res == NULL) {
39-
ret = SC_CCLIENT_OOM;
40-
ta_log_error("%s\n", "SC_CCLIENT_OOM");
41-
goto done;
42-
}
43-
// The depth at which Random Walk starts. Mininal is 3, and max is 15.
44-
get_transactions_to_approve_req_set_depth(get_txn_req, depth);
45-
46-
ret = iota_client_get_transactions_to_approve(service, get_txn_req, get_txn_res);
47-
if (ret) {
48-
ret = SC_CCLIENT_FAILED_RESPONSE;
49-
ta_log_error("%s\n", "SC_CCLIENT_FAILED_RESPONSE");
50-
goto done;
51-
}
52-
53-
ret = hash243_stack_push(&res->tips, get_txn_res->branch);
54-
if (ret) {
55-
ret = SC_CCLIENT_HASH;
56-
ta_log_error("%s\n", "SC_CCLIENT_HASH");
57-
goto done;
58-
}
59-
ret = hash243_stack_push(&res->tips, get_txn_res->trunk);
60-
if (ret) {
61-
ret = SC_CCLIENT_HASH;
62-
ta_log_error("%s\n", "SC_CCLIENT_HASH");
63-
}
64-
65-
done:
66-
get_transactions_to_approve_res_free(&get_txn_res);
67-
get_transactions_to_approve_req_free(&get_txn_req);
68-
return ret;
69-
}
70-
7128
status_t ta_attach_to_tangle(const attach_to_tangle_req_t* const req, attach_to_tangle_res_t* res) {
7229
status_t ret = SC_OK;
7330
bundle_transactions_t* bundle = NULL;

tests/test_common.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ APIMock APIMockObj;
1919
iota_config_t tangle;
2020
iota_client_service_t service;
2121

22-
TEST(GetTxnToApproveTest, TrunkBranchHashTest) {
23-
ta_get_tips_res_t* res = ta_get_tips_res_new();
24-
flex_trit_t hash_trits_1[FLEX_TRIT_SIZE_243], hash_trits_2[FLEX_TRIT_SIZE_243];
25-
flex_trits_from_trytes(hash_trits_1, NUM_TRITS_HASH, (const tryte_t*)TRYTES_81_1, NUM_TRYTES_HASH, NUM_TRYTES_HASH);
26-
flex_trits_from_trytes(hash_trits_2, NUM_TRITS_HASH, (const tryte_t*)TRYTES_81_2, NUM_TRYTES_HASH, NUM_TRYTES_HASH);
27-
28-
EXPECT_CALL(APIMockObj, iota_client_get_transactions_to_approve(_, _, _)).Times(AtLeast(1));
29-
30-
EXPECT_EQ(cclient_get_txn_to_approve(&service, 3, res), 0);
31-
EXPECT_FALSE(memcmp(res->tips->hash, hash_trits_1, sizeof(flex_trit_t) * FLEX_TRIT_SIZE_243));
32-
hash243_stack_pop(&res->tips);
33-
EXPECT_FALSE(memcmp(res->tips->hash, hash_trits_2, sizeof(flex_trit_t) * FLEX_TRIT_SIZE_243));
34-
ta_get_tips_res_free(&res);
35-
}
36-
3722
TEST(GenAdressTest, GetNewAddressTest) {
3823
tangle.seed = SEED;
3924
hash243_queue_entry_t* q_iter = NULL;

tests/test_define.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ extern "C" {
331331
#define MESSAGE_5 "MESSAGE5"
332332
#define MESSAGE_6 "MESSAGE6"
333333

334-
335334
#ifdef __cplusplus
336335
}
337336
#endif

0 commit comments

Comments
 (0)