exchange

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

commit 5a977cbb8b074c34b2f4cb067e0d444559b971b6
parent 187acf135052b92fa2b1bf116b3957f1fe9d0090
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Sun, 16 Aug 2026 22:18:47 +0200

more fields that can be NULLable

Diffstat:
Msrc/exchangedb/iterate_kyc_references.c | 42++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/src/exchangedb/iterate_kyc_references.c b/src/exchangedb/iterate_kyc_references.c @@ -42,6 +42,11 @@ struct IteratorContext * Plugin context. */ struct TALER_EXCHANGEDB_PostgresContext *pg; + + /** + * Set to #GNUNET_SYSERR if a row could not be read. + */ + enum GNUNET_GenericReturnValue status; }; @@ -63,15 +68,26 @@ iterate_kyc_reference_cb (void *cls, for (unsigned int i = 0; i<num_results; i++) { char *kyc_provider_name_name; - char *provider_user_id; - char *legitimization_id; + char *provider_user_id = NULL; + char *legitimization_id = NULL; + bool no_user_id; + bool no_legitimization_id; + /* Both provider-side identifiers are NULL until the provider hands + them out -- and stay NULL for a process the exchange created for an + AML program that failed before one was started. Reading them as + non-NULL used to abort the whole iteration on the first such row, + silently truncating the caller's list. */ struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_string ("provider_name", &kyc_provider_name_name), - GNUNET_PQ_result_spec_string ("provider_user_id", - &provider_user_id), - GNUNET_PQ_result_spec_string ("provider_legitimization_id", - &legitimization_id), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("provider_user_id", + &provider_user_id), + &no_user_id), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("provider_legitimization_id", + &legitimization_id), + &no_legitimization_id), GNUNET_PQ_result_spec_end }; @@ -81,12 +97,13 @@ iterate_kyc_reference_cb (void *cls, i)) { GNUNET_break (0); + ic->status = GNUNET_SYSERR; return; } ic->cb (ic->cb_cls, kyc_provider_name_name, - provider_user_id, - legitimization_id); + no_user_id ? NULL : provider_user_id, + no_legitimization_id ? NULL : legitimization_id); GNUNET_PQ_cleanup_result (rs); } } @@ -106,8 +123,10 @@ TALER_EXCHANGEDB_iterate_kyc_references ( struct IteratorContext ic = { .cb = lpc, .cb_cls = lpc_cls, - .pg = pg + .pg = pg, + .status = GNUNET_OK }; + enum GNUNET_DB_QueryStatus qs; PREPARE (pg, "iterate_kyc_references", @@ -117,10 +136,13 @@ TALER_EXCHANGEDB_iterate_kyc_references ( ",provider_legitimization_id" " FROM legitimization_processes" " WHERE h_payto=$1;"); - return GNUNET_PQ_eval_prepared_multi_select ( + qs = GNUNET_PQ_eval_prepared_multi_select ( pg->conn, "iterate_kyc_references", params, &iterate_kyc_reference_cb, &ic); + if (GNUNET_OK != ic.status) + return GNUNET_DB_STATUS_HARD_ERROR; + return qs; }