diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-01-28 23:40:12 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-01-28 23:40:12 +0100 |
commit | 417af3ad417198a5087306d5f0f959473ed8399e (patch) | |
tree | 6637d0e67c9ccf62e792f0dba8b2b6fa3696d11a | |
parent | a08b70f6244fafa2664f694cf28c0e3d128a9a0b (diff) |
fix re-use of prepared statement, and escaping
-rw-r--r-- | src/backend/taler-merchant-depositcheck.c | 32 | ||||
-rw-r--r-- | src/backenddb/pg_select_account_by_uri.c | 8 |
2 files changed, 34 insertions, 6 deletions
diff --git a/src/backend/taler-merchant-depositcheck.c b/src/backend/taler-merchant-depositcheck.c index ecb6b24e..cc0aaae5 100644 --- a/src/backend/taler-merchant-depositcheck.c +++ b/src/backend/taler-merchant-depositcheck.c @@ -31,6 +31,11 @@ */ #define CONCURRENCY_LIMIT 32 +/** + * How long do we not try a deposit check if the deposit + * was put on hold due to a KYC/AML block? + */ +#define KYC_RETRY_DELAY GNUNET_TIME_UNIT_HOURS /** * Information we keep per exchange. @@ -484,8 +489,7 @@ deposit_get_cb (void *cls, qs = db_plugin->update_deposit_confirmation_status ( db_plugin->cls, w->deposit_serial, - false, /* we are blocked on KYC, wire_pending is now false */ - /* FIXME: once the KYC is done, is there logic to get this back to TRUE? */ + true, /* wire_pending is still true! */ GNUNET_TIME_absolute_to_timestamp (future_retry), w->retry_backoff, "Exchange reported 202 Accepted but no KYC block"); @@ -496,6 +500,30 @@ deposit_get_cb (void *cls, return; } } + else + { + future_retry + = GNUNET_TIME_absolute_max ( + future_retry, + GNUNET_TIME_relative_to_absolute ( + KYC_RETRY_DELAY)); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Bumping wire transfer deadline in DB to %s as that is when we will retry\n", + GNUNET_TIME_absolute2s (future_retry)); + qs = db_plugin->update_deposit_confirmation_status ( + db_plugin->cls, + w->deposit_serial, + true, /* FIXME: should we set this to 'false' as we are awaiting KYC? */ + GNUNET_TIME_absolute_to_timestamp (future_retry), + w->retry_backoff, + "Exchange reported 202 Accepted due to KYC/AML block"); + if (qs < 0) + { + GNUNET_break (0); + GNUNET_SCHEDULER_shutdown (); + return; + } + } break; } default: diff --git a/src/backenddb/pg_select_account_by_uri.c b/src/backenddb/pg_select_account_by_uri.c index e987dfc3..fd05793f 100644 --- a/src/backenddb/pg_select_account_by_uri.c +++ b/src/backenddb/pg_select_account_by_uri.c @@ -61,7 +61,7 @@ TMH_PG_select_account_by_uri (void *cls, ad->payto_uri = GNUNET_strdup (payto_uri); check_connection (pg); PREPARE (pg, - "select_account", + "select_account_by_uri", "SELECT" " salt" ",h_wire" @@ -73,10 +73,10 @@ TMH_PG_select_account_by_uri (void *cls, " (SELECT merchant_serial " " FROM merchant_instances" " WHERE merchant_id=$1)" - " AND REGEXP_REPLACE(payto_uri,'\?.*','')" - " =REGEXP_REPLACE($2,'\?.*','')"); + " AND REGEXP_REPLACE(payto_uri,'\\?.*','')" + " =REGEXP_REPLACE($2,'\\?.*','')"); return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, - "select_account", + "select_account_by_uri", params, rs); } |