aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-02-18 12:53:13 +0100
committerChristian Grothoff <christian@grothoff.org>2024-02-18 12:53:13 +0100
commit2d9d970bca7df7a45b60877baa608956e57c00e1 (patch)
tree44ed9621526703a4717e3abef998710b4afb7e08 /src
parent2504699b3b79ed7203d7413d8bbc91ffd28b5481 (diff)
lproc is not unique if we have failed processes, handle multiple matches
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-proof.c2
-rw-r--r--src/exchangedb/pg_lookup_kyc_process_by_account.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c
index b9ec3563d..7885b8a31 100644
--- a/src/exchange/taler-exchange-httpd_kyc-proof.c
+++ b/src/exchange/taler-exchange-httpd_kyc-proof.c
@@ -444,7 +444,7 @@ TEH_handler_kyc_proof (
MHD_HTTP_INTERNAL_SERVER_ERROR,
"kyc-proof-internal-error",
TALER_EC_GENERIC_DB_STORE_FAILED,
- "lookup_kyc_requirement_by_account");
+ "lookup_kyc_process_by_account");
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
return respond_html_ec (rc,
MHD_HTTP_NOT_FOUND,
diff --git a/src/exchangedb/pg_lookup_kyc_process_by_account.c b/src/exchangedb/pg_lookup_kyc_process_by_account.c
index 79a9d6c8f..e8d9eaa94 100644
--- a/src/exchangedb/pg_lookup_kyc_process_by_account.c
+++ b/src/exchangedb/pg_lookup_kyc_process_by_account.c
@@ -60,7 +60,6 @@ TEH_PG_lookup_kyc_process_by_account (
*provider_account_id = NULL;
*provider_legitimization_id = NULL;
- /* Used in #postgres_lookup_kyc_process_by_account() */
PREPARE (pg,
"lookup_process_by_account",
"SELECT "
@@ -70,7 +69,10 @@ TEH_PG_lookup_kyc_process_by_account (
",provider_legitimization_id"
" FROM legitimization_processes"
" WHERE h_payto=$1"
- " AND provider_section=$2;");
+ " AND provider_section=$2"
+ " AND NOT finished"
+ " ORDER BY expiration_time DESC"
+ " LIMIT 1;");
return GNUNET_PQ_eval_prepared_singleton_select (
pg->conn,
"lookup_process_by_account",