summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-15 14:39:18 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-15 14:39:18 +0100
commit0325a79631d1abba7fdf414748a34c0e8bca55c3 (patch)
treea72220e8676b5d1d6dfdc67af8936cd4ea4b5d6c /src/exchangedb/plugin_exchangedb_postgres.c
parentc67df6369993c99e2557cbe3db059633d6cc867e (diff)
downloadexchange-0325a79631d1abba7fdf414748a34c0e8bca55c3.tar.gz
exchange-0325a79631d1abba7fdf414748a34c0e8bca55c3.tar.bz2
exchange-0325a79631d1abba7fdf414748a34c0e8bca55c3.zip
avoid duplication
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index f9f3fd16f..6e77cb232 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -385,6 +385,14 @@ prepare_statements (struct PostgresClosure *pg)
" SET kyc_ok=TRUE"
" WHERE wire_target_serial_id=$1",
1),
+ GNUNET_PQ_make_prepare (
+ "get_kyc_h_payto",
+ "SELECT"
+ " h_payto"
+ " FROM wire_targets"
+ " WHERE wire_target_serial_id=$1"
+ " LIMIT 1;",
+ 1),
/* Used in #postgres_get_kyc_status() */
GNUNET_PQ_make_prepare (
"get_kyc_status",
@@ -3804,10 +3812,33 @@ postgres_set_kyc_ok (void *cls,
GNUNET_PQ_query_param_uint64 (&payment_target_uuid),
GNUNET_PQ_query_param_end
};
+ struct TALER_KycCompletedEventP rep = {
+ .header.size = htons (sizeof (rep)),
+ .header.type = htons (TALER_DBEVENT_EXCHANGE_KYC_COMPLETED)
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_auto_from_type ("h_payto",
+ &rep.h_payto),
+ GNUNET_PQ_result_spec_end
+ };
+ enum GNUNET_DB_QueryStatus qs;
- return GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "set_kyc_ok",
- params);
+ qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "set_kyc_ok",
+ params);
+ if (qs <= 0)
+ return qs;
+ qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "get_kyc_h_payto",
+ params,
+ rs);
+ if (qs <= 0)
+ return qs;
+ postgres_event_notify (pg,
+ &rep.header,
+ NULL,
+ 0);
+ return qs;
}
@@ -5684,9 +5715,10 @@ postgres_ensure_coin_known (void *cls,
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
- return TALER_EXCHANGEDB_CKS_SOFT_FAIL;
- case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ return TALER_EXCHANGEDB_CKS_SOFT_FAIL;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
GNUNET_break (0);
return TALER_EXCHANGEDB_CKS_HARD_FAIL;