commit f8354d4c7a4c177c055280f75abef4657753c543
parent 6308274e396f44fabecafd4cd0dff7af179b0c06
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Thu, 13 Jun 2024 16:47:13 +0200
cleanup2
Diffstat:
7 files changed, 40 insertions(+), 115 deletions(-)
diff --git a/src/donau/donau-httpd_batch-issue.c b/src/donau/donau-httpd_batch-issue.c
@@ -62,6 +62,7 @@ parse_json_bkp (struct DONAU_BlindedUniqueDonorIdentifierKeyPair *bkp,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ /* TODO: Check for duplicate blinded UDIs.*/
return GNUNET_OK;
}
diff --git a/src/json/donau_json.c b/src/json/donau_json.c
@@ -170,68 +170,6 @@ DONAU_JSON_spec_donation_unit_pub (const char *field,
}
-// static enum GNUNET_GenericReturnValue
-// parse_donation_unit_group (void *cls,
-// json_t *root,
-// struct GNUNET_JSON_Specification *spec)
-// {
-// struct DONAU_DonationUnitGroup *group = spec->ptr;
-// const char *cipher;
-// const char *currency = cls;
-// struct GNUNET_JSON_Specification gspec[] = {
-// GNUNET_JSON_spec_string ("cipher",
-// &cipher),
-// TALER_JSON_spec_amount ("value",
-// currency,
-// &group->value),
-// GNUNET_JSON_spec_end ()
-// };
-// const char *emsg;
-// unsigned int eline;
-
-// if (GNUNET_OK !=
-// GNUNET_JSON_parse (root,
-// gspec,
-// &emsg,
-// &eline))
-// {
-// GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-// "Failed to parse %s at %u: %s\n",
-// spec[eline].field,
-// eline,
-// emsg);
-// GNUNET_break_op (0);
-// return GNUNET_SYSERR;
-// }
-
-// group->cipher = string_to_cipher (cipher);
-// if (GNUNET_CRYPTO_BSA_INVALID == group->cipher)
-// {
-// GNUNET_break_op (0);
-// return GNUNET_SYSERR;
-// }
-
-// return GNUNET_OK;
-// }
-
-
-// struct GNUNET_JSON_Specification
-// DONAU_JSON_spec_donation_unit_group (const char *name,
-// const char *currency,
-// struct DONAU_DonationUnitGroup *group)
-// {
-// struct GNUNET_JSON_Specification ret = {
-// .cls = (void *) currency,
-// .parser = &parse_donation_unit_group,
-// .field = name,
-// .ptr = group,
-// .ptr_size = sizeof(*group)
-// };
-
-// return ret;
-// }
-
-
/**
* Parse given JSON object to blinded unique donation identifier.
*
diff --git a/src/lib/donau_api_charity_get.c b/src/lib/donau_api_charity_get.c
@@ -73,7 +73,7 @@ struct DONAU_CharityGetHandle
static enum GNUNET_GenericReturnValue
handle_charity_get_ok (const json_t *resp_obj,
struct DONAU_CharityGetHandle *cgh,
- struct DONAU_GetCharityResponse *gcresp)
+ struct DONAU_GetCharityResponse *gcresp)
{
struct DONAU_Charity *charity = &gcresp->details.ok.charity;
const char *name;
@@ -87,8 +87,8 @@ handle_charity_get_ok (const json_t *resp_obj,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("charity_pub",
&charity->charity_pub),
- GNUNET_JSON_spec_string ("name", &name),
- GNUNET_JSON_spec_string ("url", &url),
+ GNUNET_JSON_spec_string ("name", &name),
+ GNUNET_JSON_spec_string ("url", &url),
TALER_JSON_spec_amount_any ("max_per_year",
&charity->max_per_year),
TALER_JSON_spec_amount_any ("receipts_to_date",
@@ -149,7 +149,7 @@ handle_charity_get_finished (void *cls,
if (GNUNET_OK !=
handle_charity_get_ok (j,
cgh,
- &gcresp))
+ &gcresp))
{
gcresp.hr.http_status = 0;
gcresp.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
@@ -216,10 +216,10 @@ DONAU_charity_get (
cgh->cb_cls = cb_cls;
char arg_str[sizeof (id) * 2 + 32];
GNUNET_snprintf (arg_str,
- sizeof (arg_str),
- "charities/%llu",
- (unsigned long long)
- id);
+ sizeof (arg_str),
+ "charities/%llu",
+ (unsigned long long)
+ id);
cgh->url = TALER_url_join (url,
arg_str,
NULL);
@@ -240,9 +240,9 @@ DONAU_charity_get (
return NULL;
}
cgh->job = GNUNET_CURL_job_add_with_ct_json (ctx,
- eh,
- &handle_charity_get_finished,
- cgh);
+ eh,
+ &handle_charity_get_finished,
+ cgh);
return cgh;
}
diff --git a/src/lib/donau_api_handle.c b/src/lib/donau_api_handle.c
@@ -707,6 +707,7 @@ add_grp (void *cls,
return GNUNET_OK;
}
+
json_t *
DONAU_keys_to_json (const struct DONAU_Keys *kd)
{
diff --git a/src/testing/testing_api_cmd_donation_statement_get.c b/src/testing/testing_api_cmd_donation_statement_get.c
@@ -113,18 +113,18 @@ donation_statement_status_cb (void *cls,
for (unsigned int i = 0; i < ss->keys->num_sign_keys; i++)
{
- if (GNUNET_OK == DONAU_donation_statement_verify (
- &ss->donation_statement.total_amount,
- ss->donation_statement.year,
- ss->donation_statement.
- h_donor_tax_id,
- &dsr->details.ok.donau_pub,
- &ss->donation_statement.
- donation_statement_sig))
- {
- TALER_TESTING_interpreter_next (ss->is);
- return;
- }
+ if (GNUNET_OK == DONAU_donation_statement_verify (
+ &ss->donation_statement.total_amount,
+ ss->donation_statement.year,
+ ss->donation_statement.
+ h_donor_tax_id,
+ &dsr->details.ok.donau_pub,
+ &ss->donation_statement.
+ donation_statement_sig))
+ {
+ TALER_TESTING_interpreter_next (ss->is);
+ return;
+ }
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Verify donation statement signature failed!");
diff --git a/src/testing/testing_api_cmd_issue_receipts.c b/src/testing/testing_api_cmd_issue_receipts.c
@@ -251,14 +251,6 @@ cs_stage_two_callback (
struct DONAU_BlindedUniqueDonorIdentifier *blinded_udi =
&csr_data->ss->bkps[csr_data->position].blinded_udi;
- /* ignore multiple callbacks from the same csr request by checking
- if the corresponding blinded message is already initialized */
-// if (NULL != blinded_udi->blinded_message)
-// {
-// // FIXME: this should not happen.
-// return;
-// }
-
if (csrresp->hr.http_status != MHD_HTTP_CREATED)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -470,17 +462,7 @@ cleanup (void *cls,
DONAU_charity_issue_receipt_cancel (ss->birh);
ss->birh = NULL;
}
-
-// if (NULL != revealed_coins)
-// {
-// for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
-// {
-// TALER_blinded_denom_sig_free (&revealed_coins[cnt].coin_sig);
-// TALER_blinded_planchet_free (&revealed_coins[cnt].blinded_planchet);
-// }
-// GNUNET_free (revealed_coins);
-// revealed_coins = NULL;
-// }
+
GNUNET_free (ss);
}
diff --git a/src/testing/testing_api_cmd_submit_receipts.c b/src/testing/testing_api_cmd_submit_receipts.c
@@ -90,7 +90,8 @@ struct StatusState
*/
static void
submit_receipts_status_cb (void *cls,
- const struct DONAU_DonorReceiptsToStatementResult *rtsresp)
+ const struct
+ DONAU_DonorReceiptsToStatementResult *rtsresp)
{
struct StatusState *ss = cls;
@@ -154,14 +155,16 @@ status_run (void *cls,
const size_t *num_receipts;
receipts_cmd = TALER_TESTING_interpreter_lookup_command (is,
- ss->issue_receipt_reference);
+ ss->
+ issue_receipt_reference);
if (GNUNET_OK !=
- TALER_TESTING_get_trait_donation_receipts (receipts_cmd, &receipts) ||
- GNUNET_OK !=
- TALER_TESTING_get_trait_salted_tax_id_hash (receipts_cmd, &h_donor_tax_id) ||
- GNUNET_OK !=
- TALER_TESTING_get_trait_number_receipts (receipts_cmd, &num_receipts) )
+ TALER_TESTING_get_trait_donation_receipts (receipts_cmd, &receipts) ||
+ GNUNET_OK !=
+ TALER_TESTING_get_trait_salted_tax_id_hash (receipts_cmd,
+ &h_donor_tax_id) ||
+ GNUNET_OK !=
+ TALER_TESTING_get_trait_number_receipts (receipts_cmd, &num_receipts) )
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
@@ -178,7 +181,7 @@ status_run (void *cls,
ss->num_receipts,
ss->receipts,
ss->year,
- ss->h_donor_tax_id,
+ ss->h_donor_tax_id,
&submit_receipts_status_cb,
ss);
@@ -212,9 +215,9 @@ cleanup (void *cls,
struct TALER_TESTING_Command
TALER_TESTING_cmd_submit_receipts (const char *label,
- const char *issue_receipt_reference,
- const uint64_t year,
- unsigned int expected_response_code)
+ const char *issue_receipt_reference,
+ const uint64_t year,
+ unsigned int expected_response_code)
{
struct StatusState *ss;