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

Commit 0acae98

Browse files
author
Yu Wei Wu
committed
feat(config): Move pow init/destroy to cofig
1 parent 8441c1b commit 0acae98

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

accelerator/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ cc_library(
4444
"//request",
4545
"//response",
4646
"//utils:cache",
47-
"//utils:pow",
4847
"@com_github_uthash//:uthash",
4948
"@entangled//common/model:bundle",
5049
"@entangled//utils:time",
@@ -58,6 +57,7 @@ cc_library(
5857
visibility = ["//visibility:public"],
5958
deps = [
6059
":ta_errors",
60+
"//utils:pow",
6161
"@entangled//cclient/api",
6262
"@entangled//cclient/types",
6363
],

accelerator/common_core.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "common_core.h"
22
#include <sys/time.h>
33
#include "utils/cache.h"
4-
#include "utils/pow.h"
54

65
status_t cclient_get_txn_to_approve(const iota_client_service_t* const service,
76
uint8_t const depth,
@@ -115,7 +114,6 @@ status_t ta_attach_to_tangle(const attach_to_tangle_req_t* const req,
115114
char cache_key[NUM_TRYTES_HASH] = {0};
116115
char cache_value[NUM_TRYTES_SERIALIZED_TRANSACTION] = {0};
117116
cache_t* cache = cache_init();
118-
pow_init();
119117

120118
// create bundle
121119
bundle_transactions_new(&bundle);
@@ -157,7 +155,6 @@ status_t ta_attach_to_tangle(const attach_to_tangle_req_t* const req,
157155

158156
done:
159157
cache_stop(&cache);
160-
pow_destroy();
161158
bundle_transactions_free(&bundle);
162159
return ret;
163160
}

accelerator/config.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ status_t ta_config_init(ta_config_t* const info, iota_config_t* const tangle,
4141
}
4242
iota_client_extended_init();
4343

44+
pow_init();
45+
4446
return ret;
4547
}
4648

4749
void ta_config_destroy(iota_client_service_t* const service) {
4850
log_info(logger_id, "Destroying IRI connection\n");
4951
iota_client_extended_destroy();
5052
iota_client_core_destroy(service);
53+
54+
pow_destroy();
5155
logger_helper_release(logger_id);
5256
}

accelerator/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "cclient/api/core/core_api.h"
66
#include "cclient/api/extended/extended_api.h"
77
#include "cclient/types/types.h"
8+
#include "utils/pow.h"
89

910
#ifdef __cplusplus
1011
extern "C" {

utils/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ cc_library(
1717
srcs = ["pow.c"],
1818
hdrs = ["pow.h"],
1919
deps = [
20-
"//accelerator:ta_config",
2120
"//accelerator:ta_errors",
2221
"//third_party:dcurl",
2322
"@entangled//cclient/types",

0 commit comments

Comments
 (0)