gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: fix re-use of prepared statement


From: gnunet
Subject: [taler-merchant] branch master updated: fix re-use of prepared statement, and escaping
Date: Sun, 28 Jan 2024 23:40:15 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 417af3ad fix re-use of prepared statement, and escaping
417af3ad is described below

commit 417af3ad417198a5087306d5f0f959473ed8399e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jan 28 23:40:12 2024 +0100

    fix re-use of prepared statement, and escaping
---
 src/backend/taler-merchant-depositcheck.c | 32 +++++++++++++++++++++++++++++--
 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);
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]