summaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_lookup_kyc_process_by_account.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/pg_lookup_kyc_process_by_account.c')
-rw-r--r--src/exchangedb/pg_lookup_kyc_process_by_account.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/exchangedb/pg_lookup_kyc_process_by_account.c b/src/exchangedb/pg_lookup_kyc_process_by_account.c
index 6183ae7af..b077661c5 100644
--- a/src/exchangedb/pg_lookup_kyc_process_by_account.c
+++ b/src/exchangedb/pg_lookup_kyc_process_by_account.c
@@ -25,6 +25,7 @@
#include "pg_lookup_kyc_process_by_account.h"
#include "pg_helper.h"
+
enum GNUNET_DB_QueryStatus
TEH_PG_lookup_kyc_process_by_account (
void *cls,
@@ -59,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 "
@@ -69,7 +69,12 @@ 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"
+ /* Note: there *should* only be one unfinished
+ match, so this is just to be safe(r): */
+ " ORDER BY expiration_time DESC"
+ " LIMIT 1;");
return GNUNET_PQ_eval_prepared_singleton_select (
pg->conn,
"lookup_process_by_account",