exchange

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

commit 5d25c0479b59f406d9c92ddd577b5b230dce033d
parent ddd8b2f834c45416b5e53ff1d9b18f034f6c6464
Author: Florian Dold <dold@taler.net>
Date:   Mon, 27 Jul 2026 20:43:28 +0200

exchangedb: tolerate NULL jnew_rules when listing AML decisions

Diffstat:
Msrc/exchangedb/iterate_aml_decisions.c | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/exchangedb/iterate_aml_decisions.c b/src/exchangedb/iterate_aml_decisions.c @@ -19,6 +19,7 @@ * @author Christian Grothoff */ #include "taler/taler_pq_lib.h" +#include "taler/taler_kyclogic_lib.h" #include "exchange-database/iterate_aml_decisions.h" #include "helper.h" @@ -77,7 +78,8 @@ handle_aml_result (void *cls, bool is_wallet; bool to_investigate; bool is_active; - json_t *account_rules; + json_t *account_rules = NULL; + json_t *default_rules = NULL; struct TALER_FullPayto payto; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("outcome_serial_id", @@ -98,8 +100,10 @@ handle_aml_result (void *cls, TALER_PQ_result_spec_json ("jproperties", &jproperties), NULL), - TALER_PQ_result_spec_json ("jnew_rules", - &account_rules), + GNUNET_PQ_result_spec_allow_null ( + TALER_PQ_result_spec_json ("jnew_rules", + &account_rules), + NULL), GNUNET_PQ_result_spec_bool ("to_investigate", &to_investigate), GNUNET_PQ_result_spec_bool ("is_active", @@ -120,6 +124,15 @@ handle_aml_result (void *cls, } if (GNUNET_TIME_absolute_is_past (expiration_time)) is_active = false; + if (NULL == account_rules) + { + /* A NULL rule set means the account is on the exchange's default + rules (see exchange_do_insert_successor_measure), not that it has + no limits. Report the defaults so the caller always gets a valid + rule set. */ + default_rules = TALER_KYCLOGIC_get_default_legi_rules (is_wallet); + account_rules = default_rules; + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Returning AML decisions for `%s' (%s)\n", TALER_B2S (&h_payto), @@ -138,6 +151,7 @@ handle_aml_result (void *cls, is_wallet, payto, account_rules); + json_decref (default_rules); GNUNET_PQ_cleanup_result (rs); } }