aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-03-19 15:54:05 +0100
committerChristian Grothoff <grothoff@gnunet.org>2022-03-19 15:54:05 +0100
commitc4690a44bce7e1bc003065df09cd739a9ca9dc5e (patch)
treeae14801a7b6c6e9a49e273e423e2f66c1b740f41 /src
parent685837ad280c83abae5f8a14f91c5968b720df8c (diff)
downloadexchange-c4690a44bce7e1bc003065df09cd739a9ca9dc5e.tar.xz
-minor code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/lib/exchange_api_handle.c29
-rw-r--r--src/testing/testing_api_cmd_deposit.c18
-rw-r--r--src/testing/testing_api_helpers_exchange.c3
-rw-r--r--src/testing/testing_api_loop.c31
4 files changed, 45 insertions, 36 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index ff4686a56..7649d43ea 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -131,7 +131,7 @@ struct TEAH_AuditorListEntry
* Flag indicating that the auditor is available and that protocol
* version compatibility is given.
*/
- int is_up;
+ bool is_up;
};
@@ -207,7 +207,7 @@ TEAH_get_auditors_for_dc (struct TALER_EXCHANGE_Handle *h,
{
struct TEAH_AuditorInteractionEntry *aie;
- if (GNUNET_NO == ale->is_up)
+ if (! ale->is_up)
continue;
aie = ac (ac_cls,
ale->ah,
@@ -344,7 +344,6 @@ parse_json_denomkey (const char *currency,
GNUNET_JSON_spec_end ()
};
-
if (GNUNET_OK !=
GNUNET_JSON_parse (denom_key_obj,
spec,
@@ -353,7 +352,6 @@ parse_json_denomkey (const char *currency,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
-
TALER_denom_pub_hash (&denom_key->key,
&denom_key->h_key);
if (NULL != hash_context)
@@ -553,7 +551,7 @@ auditor_version_cb (
}
return;
}
- ale->is_up = GNUNET_YES;
+ ale->is_up = true;
}
@@ -591,7 +589,8 @@ update_auditors (struct TALER_EXCHANGE_Handle *exchange)
continue; /* found, no need to add */
/* new auditor, add */
- TALER_LOG_DEBUG ("Found new auditor!\n");
+ TALER_LOG_DEBUG ("Found new auditor %s!\n",
+ auditor->auditor_url);
ale = GNUNET_new (struct TEAH_AuditorListEntry);
ale->auditor_pub = auditor->auditor_pub;
ale->auditor_url = GNUNET_strdup (auditor->auditor_url);
@@ -836,16 +835,22 @@ decode_keys_json (const json_t *resp_obj,
* "age_restricted_denoms"
*/
struct
- { char *name;
+ {
+ char *name;
struct GNUNET_HashContext *hc;
- bool is_optional_age_restriction;}
+ bool is_optional_age_restriction;
+ }
hive[2] = {
- { "denoms",
+ {
+ "denoms",
hash_context,
- false },
- { "age_restricted_denoms",
+ false
+ },
+ {
+ "age_restricted_denoms",
hash_context_restricted,
- true }
+ true
+ }
};
for (size_t s = 0; s < sizeof(hive) / sizeof(hive[0]); s++)
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index 2b9486ca5..2f55a318c 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -241,6 +241,7 @@ deposit_cb (void *cls,
ds->backoff = GNUNET_TIME_randomized_backoff (ds->backoff,
MAX_BACKOFF);
ds->is->commands[ds->is->ip].num_tries++;
+ GNUNET_assert (NULL == ds->retry_task);
ds->retry_task
= GNUNET_SCHEDULER_add_delayed (ds->backoff,
&do_retry,
@@ -452,6 +453,7 @@ deposit_run (void *cls,
coin_priv,
&coin_sig);
}
+ GNUNET_assert (NULL == ds->dh);
ds->dh = TALER_EXCHANGE_deposit (is->exchange,
&ds->amount,
ds->wire_deadline,
@@ -552,14 +554,14 @@ deposit_traits (void *cls,
TALER_TESTING_interpreter_fail (ds->is);
return GNUNET_NO;
}
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_coin_priv (coin_cmd,
- ds->coin_index,
- &coin_spent_priv) ||
- (GNUNET_OK !=
- TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
- ds->coin_index,
- &age_commitment_proof)))
+ if ( (GNUNET_OK !=
+ TALER_TESTING_get_trait_coin_priv (coin_cmd,
+ ds->coin_index,
+ &coin_spent_priv)) ||
+ (GNUNET_OK !=
+ TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
+ ds->coin_index,
+ &age_commitment_proof)) )
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ds->is);
diff --git a/src/testing/testing_api_helpers_exchange.c b/src/testing/testing_api_helpers_exchange.c
index c2c5136e1..c47a1c2fb 100644
--- a/src/testing/testing_api_helpers_exchange.c
+++ b/src/testing/testing_api_helpers_exchange.c
@@ -720,7 +720,8 @@ TALER_TESTING_setup_with_exchange_cfg (
return GNUNET_NO;
}
- if (0 == strcmp ("tcp", serve))
+ if (0 == strcmp ("tcp",
+ serve))
{
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg,
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 784d3c9ec..0cd1fa51d 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -270,17 +270,14 @@ do_shutdown (void *cls)
label = is->commands[is->ip].label;
if (NULL == label)
label = "END";
-
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Executing shutdown at `%s'\n",
label);
-
for (unsigned int j = 0;
NULL != (cmd = &is->commands[j])->label;
j++)
cmd->cleanup (cmd->cls,
cmd);
-
if (NULL != is->exchange)
{
TALER_LOG_DEBUG ("Disconnecting the exchange\n");
@@ -292,6 +289,11 @@ do_shutdown (void *cls)
GNUNET_SCHEDULER_cancel (is->task);
is->task = NULL;
}
+ if (NULL != is->fakebank)
+ {
+ TALER_FAKEBANK_stop (is->fakebank);
+ is->fakebank = NULL;
+ }
if (NULL != is->ctx)
{
GNUNET_CURL_fini (is->ctx);
@@ -312,11 +314,6 @@ do_shutdown (void *cls)
GNUNET_SCHEDULER_cancel (is->child_death_task);
is->child_death_task = NULL;
}
- if (NULL != is->fakebank)
- {
- TALER_FAKEBANK_stop (is->fakebank);
- is->fakebank = NULL;
- }
GNUNET_free (is->commands);
}
@@ -620,6 +617,11 @@ do_abort (void *cls)
TALER_EXCHANGE_disconnect (is->exchange);
is->exchange = NULL;
}
+ if (NULL != is->fakebank)
+ {
+ TALER_FAKEBANK_stop (is->fakebank);
+ is->fakebank = NULL;
+ }
if (NULL != is->ctx)
{
GNUNET_CURL_fini (is->ctx);
@@ -822,18 +824,17 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb,
return GNUNET_SYSERR;
sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
GNUNET_assert (NULL != sigpipe);
- shc_chld = GNUNET_SIGNAL_handler_install
- (GNUNET_SIGCHLD,
- &sighandler_child_death);
- is.ctx = GNUNET_CURL_init
- (&GNUNET_CURL_gnunet_scheduler_reschedule,
- &is.rc);
+ shc_chld = GNUNET_SIGNAL_handler_install (
+ GNUNET_SIGCHLD,
+ &sighandler_child_death);
+ is.ctx = GNUNET_CURL_init (
+ &GNUNET_CURL_gnunet_scheduler_reschedule,
+ &is.rc);
GNUNET_CURL_enable_async_scope_header (is.ctx,
"Taler-Correlation-Id");
GNUNET_assert (NULL != is.ctx);
is.rc = GNUNET_CURL_gnunet_rc_create (is.ctx);
-
/* Blocking */
if (GNUNET_YES == exchange_connect)
GNUNET_SCHEDULER_run (&main_wrapper_exchange_connect,