exchange

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

commit 7d40a312835d2ce3ab93ef10189c70123421b222
parent d76c47abb9eadad9b6a7e283f316d851cda5d2fb
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  6 Mar 2024 09:46:09 +0100

-more logical DB notify for aggregator

Diffstat:
Msrc/exchange/taler-exchange-aggregator.c | 20++++++++++++++++++--
Msrc/exchangedb/pg_aggregate.c | 15++-------------
2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c @@ -28,6 +28,7 @@ #include "taler_json_lib.h" #include "taler_kyclogic_lib.h" #include "taler_bank_service.h" +#include "taler_dbevents.h" /** @@ -824,15 +825,30 @@ do_aggregate (struct AggregationUnit *au) { case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Serialization issue during aggregation; trying again later!\n"); + "Serialization issue during aggregation; trying again later!\n") + ; return GNUNET_NO; case GNUNET_DB_STATUS_HARD_ERROR: GNUNET_break (0); global_ret = EXIT_FAILURE; return GNUNET_SYSERR; default: - return GNUNET_OK; + break; + } + { + struct TALER_CoinDepositEventP rep = { + .header.size = htons (sizeof (rep)), + .header.type = htons (TALER_DBEVENT_EXCHANGE_DEPOSIT_STATUS_CHANGED), + .merchant_pub = au->merchant_pub + }; + + db_plugin->event_notify (db_plugin->cls, + &rep.header, + NULL, + 0); } + return GNUNET_OK; + } diff --git a/src/exchangedb/pg_aggregate.c b/src/exchangedb/pg_aggregate.c @@ -122,7 +122,8 @@ TEH_PG_aggregate ( " SELECT batch_deposit_serial_id,$4" " FROM bdep)" "SELECT" /* calculate totals (deposits, refunds and fees) */ - " CAST(COALESCE(SUM((cdep.amount).val),0) AS INT8) AS sum_deposit_value" /* cast needed, otherwise we get NUMBER */ + " CAST(COALESCE(SUM((cdep.amount).val),0) AS INT8) AS sum_deposit_value" + /* cast needed, otherwise we get NUMBER */ " ,COALESCE(SUM((cdep.amount).frac),0) AS sum_deposit_fraction" /* SUM over INT returns INT8 */ " ,CAST(COALESCE(SUM((ref.refund).val),0) AS INT8) AS sum_refund_value" " ,COALESCE(SUM((ref.refund).frac),0) AS sum_refund_fraction" @@ -174,18 +175,6 @@ TEH_PG_aggregate ( total)); return qs; } - { - struct TALER_CoinDepositEventP rep = { - .header.size = htons (sizeof (rep)), - .header.type = htons (TALER_DBEVENT_EXCHANGE_DEPOSIT_STATUS_CHANGED), - .merchant_pub = *merchant_pub - }; - - TEH_PG_event_notify (pg, - &rep.header, - NULL, - 0); - } GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (pg->currency, &sum_deposit));