exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit aad92c22c4a4fa25e74109517e332559d57e356f
parent 3eee9d787fea13c1aeff4992120d6af9ca8b1cf6
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 21 Apr 2026 21:20:11 +0200

-cov fixes

Diffstat:
Msrc/auditordb/start.c | 3++-
Msrc/exchange/taler-exchange-httpd_common_kyc.c | 6++++--
Msrc/exchange/taler-exchange-httpd_get-aml-OFFICER_PUB-accounts.c | 2+-
Msrc/exchange/taler-exchange-httpd_post-kyc-wallet.c | 3++-
Msrc/exchange/taler-exchange-httpd_post-withdraw.c | 7++++++-
Msrc/lib/exchange_api_get-kyc-proof-PROVIDER_NAME.c | 7++++---
Msrc/testing/testing_api_cmd_coin_history.c | 1+
Msrc/util/secmod_cs.c | 3+++
Msrc/util/secmod_rsa.c | 3+++
9 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/auditordb/start.c b/src/auditordb/start.c @@ -32,7 +32,8 @@ TALER_AUDITORDB_start (struct TALER_AUDITORDB_PostgresContext *pg) GNUNET_PQ_EXECUTE_STATEMENT_END }; - TALER_AUDITORDB_preflight (pg); + GNUNET_break (GNUNET_OK == + TALER_AUDITORDB_preflight (pg)); if (GNUNET_OK != GNUNET_PQ_exec_statements (pg->conn, es)) diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c @@ -192,7 +192,8 @@ kyc_aml_finished ( } GNUNET_async_scope_enter (&kat->scope, &old_scope); - TALER_EXCHANGEDB_preflight (TEH_pg); + GNUNET_break (GNUNET_OK == + TALER_EXCHANGEDB_preflight (TEH_pg)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "AML program finished with status %d\n", (int) apr->status); @@ -1539,7 +1540,8 @@ current_rules_cb ( goto cleanup; } /* return success! */ - TALER_EXCHANGEDB_preflight (TEH_pg); + GNUNET_break (GNUNET_OK == + TALER_EXCHANGEDB_preflight (TEH_pg)); lch->async_task = GNUNET_SCHEDULER_add_now ( &async_return_legi_result, diff --git a/src/exchange/taler-exchange-httpd_get-aml-OFFICER_PUB-accounts.c b/src/exchange/taler-exchange-httpd_get-aml-OFFICER_PUB-accounts.c @@ -195,7 +195,7 @@ record_cb ( time_t tt; epayto = TALER_escape_xml (payto.full_payto); - if ( (NULL == comments) && + if ( (0 == strlen (comments)) && (GNUNET_TIME_absolute_is_never (open_time.abs_time)) ) comments = "transacted amounts below limits that trigger account opening"; diff --git a/src/exchange/taler-exchange-httpd_post-kyc-wallet.c b/src/exchange/taler-exchange-httpd_post-kyc-wallet.c @@ -184,7 +184,8 @@ legi_result_cb ( { struct KycRequestContext *krc = cls; - TALER_EXCHANGEDB_preflight (TEH_pg); + GNUNET_break (GNUNET_OK == + TALER_EXCHANGEDB_preflight (TEH_pg)); krc->lch = NULL; krc->http_status = lcr->http_status; krc->response = lcr->response; diff --git a/src/exchange/taler-exchange-httpd_post-withdraw.c b/src/exchange/taler-exchange-httpd_post-withdraw.c @@ -672,6 +672,10 @@ phase_prepare_transaction ( return; } + /* This invariant should hold because + num_coins <= TALER_MAX_COINS. Still good + to check explicitly. */ + GNUNET_assert (num_cs_r_values <= 64); /* Now save the choices for the selected bits */ for (size_t i = 0; i < num_cs_r_values; i++) { @@ -679,8 +683,9 @@ phase_prepare_transaction ( struct TALER_BlindedDenominationSignature *sig = &wc->request.withdraw.denom_sigs[idx]; - uint8_t bit = sig->blinded_sig->details.blinded_cs_answer.b; + uint64_t bit = sig->blinded_sig->details.blinded_cs_answer.b; + GNUNET_assert (bit <= 1); /* well, should actually be 0 or 1 */ wc->request.withdraw.cs_r_choices |= bit << i; GNUNET_static_assert ( TALER_MAX_COINS <= diff --git a/src/lib/exchange_api_get-kyc-proof-PROVIDER_NAME.c b/src/lib/exchange_api_get-kyc-proof-PROVIDER_NAME.c @@ -266,9 +266,10 @@ TALER_EXCHANGE_get_kyc_proof_start ( } /* disable location following, we want to learn the result of a 303 redirect! */ - curl_easy_setopt (gkph->eh, - CURLOPT_FOLLOWLOCATION, - 0L); + GNUNET_assert (CURLE_OK == + curl_easy_setopt (gkph->eh, + CURLOPT_FOLLOWLOCATION, + 0L)); gkph->job = GNUNET_CURL_job_add_raw (gkph->ctx, gkph->eh, NULL, diff --git a/src/testing/testing_api_cmd_coin_history.c b/src/testing/testing_api_cmd_coin_history.c @@ -398,6 +398,7 @@ coin_history_cb (void *cls, dk = TALER_EXCHANGE_get_denomination_key_by_hash ( TALER_TESTING_get_keys (is), &rs->details.ok.h_denom_pub); + GNUNET_assert (NULL != dk); memset (found, 0, sizeof (found)); diff --git a/src/util/secmod_cs.c b/src/util/secmod_cs.c @@ -1750,6 +1750,9 @@ create_missing_keys (struct TALER_SECMOD_Options *opt, anchor_end)) { GNUNET_break (0); + GNUNET_assert (0 == pthread_mutex_unlock (&keys_lock)); + globals->global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); return; } anchor_start = anchor_end; diff --git a/src/util/secmod_rsa.c b/src/util/secmod_rsa.c @@ -1484,6 +1484,9 @@ create_missing_keys (struct TALER_SECMOD_Options *opt, anchor_end)) { GNUNET_break (0); + GNUNET_assert (0 == pthread_mutex_unlock (&keys_lock)); + globals->global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); return; } anchor_start = anchor_end;