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

View File

@ -1081,8 +1081,9 @@ handle_reserve_closed (
}
if (NULL == payto_uri)
{
if (0 != strcmp (rs->sender_account,
receiver_account))
if ( (NULL == rs->sender_account) ||
(0 != strcmp (rs->sender_account,
receiver_account)) )
{
report_row_inconsistency ("reserves_close",
rowid,
@ -1110,7 +1111,7 @@ handle_reserve_closed (
rowid,
"target account not verified, auditor does not know reserve");
}
if (0 != strcmp (rs->sender_account,
else if (0 != strcmp (rs->sender_account,
receiver_account))
{
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_config = *conf;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"[age restriction] DB event has changed the config to %s with mask: %s\n",
TEH_age_restriction_enabled ? "enabled": "DISABLED",
TALER_age_mask_to_string (&conf->mask));
}
}
// 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",
&start_date),
GNUNET_JSON_spec_timestamp ("end_date",
&start_date),
&end_date),
GNUNET_JSON_spec_relative_time ("wad_frequency",
&wad_frequency),
GNUNET_JSON_spec_end ()

View File

@ -1,6 +1,6 @@
/*
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
terms of the GNU General Public License as published by the Free Software
@ -17,6 +17,7 @@
* @file exchangedb/pg_reserves_in_insert.c
* @brief Implementation of the reserves_in_insert function for Postgres
* @author Christian Grothoff
* @author Joseph Xu
*/
#include "platform.h"
#include "taler_error_codes.h"
@ -689,7 +690,6 @@ TEH_PG_reserves_in_insert (void *cls,
{
unsigned int bs = GNUNET_MIN (batch_size,
reserves_length - i);
bs = 1; // FIXME-JOSEPH: for now, until pg_notify is gone!
if (bs >= 8)
{
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 + 2];
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;
break;
case 3:
@ -793,7 +792,6 @@ TEH_PG_reserves_in_insert (void *cls,
results[i] = (t_duplicate)
? GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
: GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
// fprintf(stdout, "reserve_uuid : %ld %ld\n", reserve_uuid[i], reserve_uuid[i+1]);
i += 2;
break;
case 1:
@ -817,7 +815,6 @@ TEH_PG_reserves_in_insert (void *cls,
}
need_update |= conflicts[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;
break;
case 0:

View File

@ -208,6 +208,14 @@ TALER_EXCHANGE_purse_delete (
GNUNET_free (xhdr);
}
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 ==
curl_easy_setopt (eh,
CURLOPT_CUSTOMREQUEST,

View File

@ -63,7 +63,11 @@ run_queries (sqlite3 *db)
TALER_amount_hton (&namount,
&hamount);
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 (GNUNET_OK ==
GNUNET_SQ_prepare (db,

View File

@ -2198,7 +2198,14 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
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++)
if (GNUNET_OK !=
start_worker ())

View File

@ -1986,7 +1986,15 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
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++)
if (GNUNET_OK !=
start_worker ())

View File

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