exchange

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

commit a3de445abaac98b781f42c9b9e493bed3d53140d
parent d2b7506b5cf5954304f3ae49a9ccea1f1bdd03cc
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 21 Aug 2024 17:56:16 +0200

fix get_balance zeroing

Diffstat:
Msrc/auditordb/pg_get_balance.c | 17++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/auditordb/pg_get_balance.c b/src/auditordb/pg_get_balance.c @@ -80,12 +80,13 @@ balance_cb (void *cls, GNUNET_assert (num_results <= ctx->len); for (unsigned int i = 0; i < num_results; i++) { + bool is_missing; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_allow_null ( TALER_PQ_result_spec_amount ("balance", pg->currency, ctx->dst[i]), - NULL), + &is_missing), GNUNET_PQ_result_spec_end }; @@ -98,6 +99,12 @@ balance_cb (void *cls, ctx->failure = true; return; } + if (is_missing) + { + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (pg->currency, + ctx->dst[i])); + } ctx->off++; } } @@ -113,6 +120,9 @@ TAH_PG_get_balance (void *cls, unsigned int cnt = 1; va_list ap; + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (pg->currency, + balance_value)); va_start (ap, balance_value); while (NULL != va_arg (ap, @@ -123,8 +133,9 @@ TAH_PG_get_balance (void *cls, cnt++; dst = va_arg (ap, struct TALER_Amount *); - TALER_amount_set_zero (pg->currency, - dst); + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (pg->currency, + dst)); } va_end (ap); {