-misc minor bugfixes

This commit is contained in:
Christian Grothoff 2023-02-21 14:44:31 +01:00
parent 95bd24916e
commit 7da69142b4
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
10 changed files with 49 additions and 22 deletions

View File

@ -885,8 +885,9 @@ handle_purse_decision (
report_row_inconsistency ("purse-request", report_row_inconsistency ("purse-request",
rowid, rowid,
"purse fee higher than balance"); "purse fee higher than balance");
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (TALER_ARL_currency, TALER_amount_set_zero (TALER_ARL_currency,
&balance_without_purse_fee); &balance_without_purse_fee));
} }
if (refunded) if (refunded)
@ -1021,8 +1022,9 @@ verify_purse_balance (void *cls,
report_row_inconsistency ("purse", report_row_inconsistency ("purse",
0, 0,
"purse fee higher than balance"); "purse fee higher than balance");
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (TALER_ARL_currency, TALER_amount_set_zero (TALER_ARL_currency,
&balance_without_purse_fee); &balance_without_purse_fee));
} }
if (0 != TALER_amount_cmp (&ps->exchange_balance, if (0 != TALER_amount_cmp (&ps->exchange_balance,

View File

@ -1081,8 +1081,9 @@ handle_reserve_closed (
} }
if (NULL == payto_uri) if (NULL == payto_uri)
{ {
if (0 != strcmp (rs->sender_account, if ( (NULL == rs->sender_account) ||
receiver_account)) (0 != strcmp (rs->sender_account,
receiver_account)) )
{ {
report_row_inconsistency ("reserves_close", report_row_inconsistency ("reserves_close",
rowid, rowid,
@ -1110,7 +1111,7 @@ handle_reserve_closed (
rowid, rowid,
"target account not verified, auditor does not know reserve"); "target account not verified, auditor does not know reserve");
} }
if (0 != strcmp (rs->sender_account, else if (0 != strcmp (rs->sender_account,
receiver_account)) receiver_account))
{ {
report_row_inconsistency ("reserves_close", report_row_inconsistency ("reserves_close",

View File

@ -150,12 +150,11 @@ extension_update_event_cb (void *cls,
{ {
TEH_age_restriction_enabled = true; TEH_age_restriction_enabled = true;
TEH_age_restriction_config = *conf; TEH_age_restriction_config = *conf;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"[age restriction] DB event has changed the config to %s with mask: %s\n", "[age restriction] DB event has changed the config to %s with mask: %s\n",
TEH_age_restriction_enabled ? "enabled": "DISABLED", TEH_age_restriction_enabled ? "enabled": "DISABLED",
TALER_age_mask_to_string (&conf->mask)); TALER_age_mask_to_string (&conf->mask));
}
} }
// Finally, call TEH_keys_update_states in order to refresh the cached // Finally, call TEH_keys_update_states in order to refresh the cached

View File

@ -56,7 +56,7 @@ TEH_handler_management_partners (
GNUNET_JSON_spec_timestamp ("start_date", GNUNET_JSON_spec_timestamp ("start_date",
&start_date), &start_date),
GNUNET_JSON_spec_timestamp ("end_date", GNUNET_JSON_spec_timestamp ("end_date",
&start_date), &end_date),
GNUNET_JSON_spec_relative_time ("wad_frequency", GNUNET_JSON_spec_relative_time ("wad_frequency",
&wad_frequency), &wad_frequency),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2022 Taler Systems SA Copyright (C) 2022-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software terms of the GNU General Public License as published by the Free Software
@ -17,6 +17,7 @@
* @file exchangedb/pg_reserves_in_insert.c * @file exchangedb/pg_reserves_in_insert.c
* @brief Implementation of the reserves_in_insert function for Postgres * @brief Implementation of the reserves_in_insert function for Postgres
* @author Christian Grothoff * @author Christian Grothoff
* @author Joseph Xu
*/ */
#include "platform.h" #include "platform.h"
#include "taler_error_codes.h" #include "taler_error_codes.h"
@ -689,7 +690,6 @@ TEH_PG_reserves_in_insert (void *cls,
{ {
unsigned int bs = GNUNET_MIN (batch_size, unsigned int bs = GNUNET_MIN (batch_size,
reserves_length - i); reserves_length - i);
bs = 1; // FIXME-JOSEPH: for now, until pg_notify is gone!
if (bs >= 8) if (bs >= 8)
{ {
qs1 = insert8 (pg, qs1 = insert8 (pg,
@ -763,7 +763,6 @@ TEH_PG_reserves_in_insert (void *cls,
t_duplicate |= transaction_duplicate[i + 1]; t_duplicate |= transaction_duplicate[i + 1];
t_duplicate |= transaction_duplicate[i + 2]; t_duplicate |= transaction_duplicate[i + 2];
t_duplicate |= transaction_duplicate[i + 3]; t_duplicate |= transaction_duplicate[i + 3];
// fprintf(stdout, "reserve_uuid : %ld %ld %ld %ld\n", reserve_uuid[i], reserve_uuid[i+1], reserve_uuid[i+2], reserve_uuid[i+3]);
i += 4; i += 4;
break; break;
case 3: case 3:
@ -793,7 +792,6 @@ TEH_PG_reserves_in_insert (void *cls,
results[i] = (t_duplicate) results[i] = (t_duplicate)
? GNUNET_DB_STATUS_SUCCESS_NO_RESULTS ? GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
: GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; : GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
// fprintf(stdout, "reserve_uuid : %ld %ld\n", reserve_uuid[i], reserve_uuid[i+1]);
i += 2; i += 2;
break; break;
case 1: case 1:
@ -817,7 +815,6 @@ TEH_PG_reserves_in_insert (void *cls,
} }
need_update |= conflicts[i]; need_update |= conflicts[i];
t_duplicate |= transaction_duplicate[i]; t_duplicate |= transaction_duplicate[i];
// fprintf(stdout, "reserve uuid : %ld c :%d t:%d\n", reserve_uuid[i], conflicts[i], transaction_duplicate[i]);
i += 1; i += 1;
break; break;
case 0: case 0:

View File

@ -208,6 +208,14 @@ TALER_EXCHANGE_purse_delete (
GNUNET_free (xhdr); GNUNET_free (xhdr);
} }
eh = TALER_EXCHANGE_curl_easy_get_ (pdh->url); eh = TALER_EXCHANGE_curl_easy_get_ (pdh->url);
if (NULL == eh)
{
GNUNET_break (0);
curl_slist_free_all (pdh->xhdr);
GNUNET_free (pdh->url);
GNUNET_free (pdh);
return NULL;
}
GNUNET_assert (CURLE_OK == GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh, curl_easy_setopt (eh,
CURLOPT_CUSTOMREQUEST, CURLOPT_CUSTOMREQUEST,

View File

@ -63,7 +63,11 @@ run_queries (sqlite3 *db)
TALER_amount_hton (&namount, TALER_amount_hton (&namount,
&hamount); &hamount);
json = json_object (); json = json_object ();
json_object_set_new (json, "foo", json_integer (42)); GNUNET_assert (NULL != json);
GNUNET_assert (0 ==
json_object_set_new (json,
"foo",
json_integer (42)));
GNUNET_assert (NULL != json); GNUNET_assert (NULL != json);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_SQ_prepare (db, GNUNET_SQ_prepare (db,

View File

@ -2198,7 +2198,14 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL); NULL);
if (0 == max_workers) if (0 == max_workers)
max_workers = sysconf (_SC_NPROCESSORS_CONF); {
long lret;
lret = sysconf (_SC_NPROCESSORS_CONF);
if (lret <= 0)
lret = 1;
max_workers = (unsigned int) lret;
}
for (unsigned int i = 0; i<max_workers; i++) for (unsigned int i = 0; i<max_workers; i++)
if (GNUNET_OK != if (GNUNET_OK !=
start_worker ()) start_worker ())

View File

@ -1986,7 +1986,15 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL); NULL);
if (0 == max_workers) if (0 == max_workers)
max_workers = sysconf (_SC_NPROCESSORS_CONF); {
long lret;
lret = sysconf (_SC_NPROCESSORS_CONF);
if (lret <= 0)
lret = 1;
max_workers = (unsigned int) lret;
}
for (unsigned int i = 0; i<max_workers; i++) for (unsigned int i = 0; i<max_workers; i++)
if (GNUNET_OK != if (GNUNET_OK !=
start_worker ()) start_worker ())

View File

@ -603,6 +603,7 @@ test_batch_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
case TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN: case TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN:
for (unsigned int i = 0; i<batch_size; i++) for (unsigned int i = 0; i<batch_size; i++)
TALER_blinded_denom_sig_free (&ds[i]); TALER_blinded_denom_sig_free (&ds[i]);
break;
default: default:
/* unexpected error */ /* unexpected error */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,