gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: implement #6136


From: gnunet
Subject: [taler-merchant] branch master updated: implement #6136
Date: Fri, 10 Apr 2020 22:07:13 +0200

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 c22eb34  implement #6136
c22eb34 is described below

commit c22eb34d925c55e1a07710c6f0e8df5b954dece7
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Apr 10 22:07:11 2020 +0200

    implement #6136
---
 src/backend/taler-merchant-httpd_exchanges.c | 11 +++++++++--
 src/backend/taler-merchant-httpd_pay.c       | 23 ++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_exchanges.c 
b/src/backend/taler-merchant-httpd_exchanges.c
index bd8905c..48670fa 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -29,6 +29,13 @@
  */
 #define RELOAD_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 
2)
 
+/**
+ * Delay after which we'll allow clients to force us to re-fetch key
+ * information from the exchange if we don't know the denomination key.
+ */
+#define FORCED_RELOAD_DELAY GNUNET_TIME_relative_multiply ( \
+    GNUNET_TIME_UNIT_MINUTES, 15)
+
 /**
  * Threshold after which exponential backoff should not increase.
  */
@@ -961,12 +968,12 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange,
   {
     /* increment exponential-backoff */
     exchange->retry_delay = RETRY_BACKOFF (exchange->retry_delay);
-    /* do not allow forced check until both backoff and #RELOAD_DELAY
+    /* do not allow forced check until both backoff and #FORCED_RELOAD_DELAY
        are satisified again */
     exchange->first_retry
       = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_max (
                                             exchange->retry_delay,
-                                            RELOAD_DELAY));
+                                            FORCED_RELOAD_DELAY));
     TALER_EXCHANGE_check_keys_current (exchange->conn,
                                        GNUNET_YES,
                                        GNUNET_NO);
diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index d10d960..4c1e236 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -370,6 +370,11 @@ struct PayContext
    */
   int suspended;
 
+  /**
+   * #GNUNET_YES if we already tried a forced /keys download.
+   */
+  int tried_force_keys;
+
   /**
    * Which operational mode is the /pay request made in?
    */
@@ -1208,6 +1213,9 @@ process_pay_with_exchange (void *cls,
     enum TALER_ErrorCode ec;
     unsigned int hc;
 
+    if (NULL != dc->dh)
+      continue; /* we were here before (can happen due to
+                   tried_force_keys logic), don't go again */
     if (GNUNET_YES == dc->found_in_db)
       continue;
     if (0 != strcmp (dc->exchange_url,
@@ -1217,9 +1225,22 @@ process_pay_with_exchange (void *cls,
                                                          &dc->denom);
     if (NULL == denom_details)
     {
-      /* FIXME: #6136 applies HERE */
       struct GNUNET_HashCode h_denom;
 
+      if (! pc->tried_force_keys)
+      {
+        /* let's try *forcing* a re-download of /keys from the exchange.
+           Maybe the wallet has seen /keys that we missed. */
+        pc->tried_force_keys = GNUNET_YES;
+        pc->fo = TMH_EXCHANGES_find_exchange (pc->current_exchange,
+                                              pc->wm->wire_method,
+                                              GNUNET_YES,
+                                              &process_pay_with_exchange,
+                                              pc);
+        if (NULL != pc->fo)
+          return;
+      }
+      /* Forcing failed or we already did it, give up */
       GNUNET_CRYPTO_rsa_public_key_hash (dc->denom.rsa_public_key,
                                          &h_denom);
       resume_pay_with_response (

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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