gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: remove GET /exchanges endpoint a


From: gnunet
Subject: [taler-exchange] branch master updated: remove GET /exchanges endpoint as we are making the auditor single-exchange only; also fixes #8054
Date: Wed, 10 Jan 2024 14:51:56 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new fcce372a remove GET /exchanges endpoint as we are making the auditor 
single-exchange only; also fixes #8054
fcce372a is described below

commit fcce372afa485be2fc6e5abbbdfb1b6202d5f208
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jan 10 14:50:13 2024 +0100

    remove GET /exchanges endpoint as we are making the auditor single-exchange 
only; also fixes #8054
---
 src/auditor/Makefile.am                         |   1 -
 src/auditor/taler-auditor-httpd.c               |   4 -
 src/auditor/taler-auditor-httpd_exchanges.c     | 116 -------
 src/auditor/taler-auditor-httpd_exchanges.h     |  46 ---
 src/include/taler_auditor_service.h             | 104 ------
 src/include/taler_testing_lib.h                 | 406 +++++++++++-------------
 src/lib/Makefile.am                             |   5 +-
 src/lib/auditor_api_exchanges.c                 | 244 --------------
 src/testing/Makefile.am                         |   1 -
 src/testing/test_auditor_api.c                  |   3 -
 src/testing/testing_api_cmd_auditor_exchanges.c | 365 ---------------------
 11 files changed, 186 insertions(+), 1109 deletions(-)

diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index 2a51ed27..c3deedba 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -163,7 +163,6 @@ taler_helper_auditor_wire_LDADD = \
 taler_auditor_httpd_SOURCES = \
   taler-auditor-httpd.c taler-auditor-httpd.h \
   taler-auditor-httpd_deposit-confirmation.c 
taler-auditor-httpd_deposit-confirmation.h \
-  taler-auditor-httpd_exchanges.c taler-auditor-httpd_exchanges.h \
   taler-auditor-httpd_mhd.c taler-auditor-httpd_mhd.h
 taler_auditor_httpd_LDADD = \
   $(LIBGCRYPT_LIBS) \
diff --git a/src/auditor/taler-auditor-httpd.c 
b/src/auditor/taler-auditor-httpd.c
index c1853d84..0bb9c77d 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -31,7 +31,6 @@
 #include "taler_auditordb_lib.h"
 #include "taler_exchangedb_lib.h"
 #include "taler-auditor-httpd_deposit-confirmation.h"
-#include "taler-auditor-httpd_exchanges.h"
 #include "taler-auditor-httpd_mhd.h"
 #include "taler-auditor-httpd.h"
 
@@ -212,9 +211,6 @@ handle_mhd_request (void *cls,
 //    { "/deposit-confirmation", MHD_HTTP_METHOD_DELETE, "application/json",
 //      NULL, 0,
 //      &TAH_DEPOSIT_CONFIRMATION_delete, MHD_HTTP_OK },
-    { "/exchanges", MHD_HTTP_METHOD_GET, "application/json",
-      NULL, 0,
-      &TAH_EXCHANGES_handler, MHD_HTTP_OK },
     { "/config", MHD_HTTP_METHOD_GET, "application/json",
       NULL, 0,
       &handle_config, MHD_HTTP_OK },
diff --git a/src/auditor/taler-auditor-httpd_exchanges.c 
b/src/auditor/taler-auditor-httpd_exchanges.c
deleted file mode 100644
index f9a9e9e6..00000000
--- a/src/auditor/taler-auditor-httpd_exchanges.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-  This file is part of TALER
-  Copyright (C) 2014-2021 Taler Systems SA
-
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU Affero General Public License as published by the Free 
Software
-  Foundation; either version 3, or (at your option) any later version.
-
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
-
-  You should have received a copy of the GNU Affero General Public License 
along with
-  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-auditor-httpd_exchanges.c
- * @brief Handle /exchanges requests; returns list of exchanges we audit
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_json_lib.h>
-#include <jansson.h>
-#include <microhttpd.h>
-#include <pthread.h>
-#include "taler_json_lib.h"
-#include "taler_mhd_lib.h"
-#include "taler-auditor-httpd.h"
-#include "taler-auditor-httpd_exchanges.h"
-
-
-/**
- * Add exchange information to the list.
- *
- * @param[in,out] cls a `json_t *` array to extend
- * @param master_pub master public key of an exchange
- * @param exchange_url base URL of an exchange
- */
-static void
-add_exchange (void *cls,
-              const struct TALER_MasterPublicKeyP *master_pub,
-              const char *exchange_url)
-{
-  json_t *list = cls;
-  json_t *obj;
-
-  obj = GNUNET_JSON_PACK (
-    GNUNET_JSON_pack_data_auto ("master_pub",
-                                master_pub),
-    GNUNET_JSON_pack_string ("exchange_url",
-                             exchange_url));
-  GNUNET_break (0 ==
-                json_array_append_new (list,
-                                       obj));
-
-}
-
-
-/**
- * Handle a "/exchanges" request.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- * @return MHD result code
-  */
-MHD_RESULT
-TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
-                       struct MHD_Connection *connection,
-                       void **connection_cls,
-                       const char *upload_data,
-                       size_t *upload_data_size)
-{
-  json_t *ja;
-  enum GNUNET_DB_QueryStatus qs;
-
-  (void) rh;
-  (void) connection_cls;
-  (void) upload_data;
-  (void) upload_data_size;
-  if (GNUNET_SYSERR ==
-      TAH_plugin->preflight (TAH_plugin->cls))
-  {
-    GNUNET_break (0);
-    return TALER_MHD_reply_with_error (connection,
-                                       MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                       TALER_EC_GENERIC_DB_SETUP_FAILED,
-                                       NULL);
-  }
-  ja = json_array ();
-  GNUNET_break (NULL != ja);
-  qs = TAH_plugin->list_exchanges (TAH_plugin->cls,
-                                   &add_exchange,
-                                   ja);
-  if (0 > qs)
-  {
-    GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
-    json_decref (ja);
-    TALER_LOG_WARNING ("Failed to handle /exchanges in database\n");
-    return TALER_MHD_reply_with_error (connection,
-                                       MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                       TALER_EC_GENERIC_DB_FETCH_FAILED,
-                                       "exchanges");
-  }
-  return TALER_MHD_REPLY_JSON_PACK (
-    connection,
-    MHD_HTTP_OK,
-    GNUNET_JSON_pack_array_steal ("exchanges",
-                                  ja));
-}
-
-
-/* end of taler-auditor-httpd_exchanges.c */
diff --git a/src/auditor/taler-auditor-httpd_exchanges.h 
b/src/auditor/taler-auditor-httpd_exchanges.h
deleted file mode 100644
index c7d8dd5f..00000000
--- a/src/auditor/taler-auditor-httpd_exchanges.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-  This file is part of TALER
-  Copyright (C) 2018 Taler Systems SA
-
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU Affero General Public License as published by the Free 
Software
-  Foundation; either version 3, or (at your option) any later version.
-
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
-
-  You should have received a copy of the GNU Affero General Public License 
along with
-  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-auditor-httpd_exchanges.h
- * @brief Handle /exchanges requests
- * @author Christian Grothoff
- */
-#ifndef TALER_AUDITOR_HTTPD_EXCHANGES_H
-#define TALER_AUDITOR_HTTPD_EXCHANGES_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include <microhttpd.h>
-#include "taler-auditor-httpd.h"
-
-
-/**
- * Handle a "/exchanges" request.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- * @return MHD result code
-  */
-MHD_RESULT
-TAH_EXCHANGES_handler (struct TAH_RequestHandler *rh,
-                       struct MHD_Connection *connection,
-                       void **connection_cls,
-                       const char *upload_data,
-                       size_t *upload_data_size);
-
-#endif
diff --git a/src/include/taler_auditor_service.h 
b/src/include/taler_auditor_service.h
index 409faca7..75c3d0e2 100644
--- a/src/include/taler_auditor_service.h
+++ b/src/include/taler_auditor_service.h
@@ -338,108 +338,4 @@ TALER_AUDITOR_deposit_confirmation_cancel (
   struct TALER_AUDITOR_DepositConfirmationHandle *deposit_confirmation);
 
 
-/**
- * Handle for /exchanges API returned by
- * #TALER_AUDITOR_list_exchanges() so that the operation can be
- * cancelled with #TALER_AUDITOR_list_exchanges_cancel()
- */
-struct TALER_AUDITOR_ListExchangesHandle;
-
-
-/**
- * Information about an exchange kept by the auditor.
- */
-struct TALER_AUDITOR_ExchangeInfo
-{
-  /**
-   * Master public key of the exchange.
-   */
-  struct TALER_MasterPublicKeyP master_pub;
-
-  /**
-   * Base URL of the exchange's API.
-   */
-  const char *exchange_url;
-};
-
-
-/**
- * Response to GET /exchanges request.
- */
-struct TALER_AUDITOR_ListExchangesResponse
-{
-  /**
-   * HTTP response.
-   */
-  struct TALER_AUDITOR_HttpResponse hr;
-
-  /**
-   * Details depending on HTTP status.
-   */
-  union
-  {
-
-    /**
-     * Details for #MHD_HTTP_OK.
-     */
-    struct
-    {
-
-      /**
-       * Length of the @e ei array.
-       */
-      unsigned int num_exchanges;
-
-      /**
-       * Array with information about exchanges
-       * audited by this auditor.
-       */
-      const struct TALER_AUDITOR_ExchangeInfo *ei;
-    } ok;
-  } details;
-};
-
-
-/**
- * Function called with the result from /exchanges.
- *
- * @param cls closure
- * @param ler response data
- */
-typedef void
-(*TALER_AUDITOR_ListExchangesResultCallback)(
-  void *cls,
-  const struct TALER_AUDITOR_ListExchangesResponse *ler);
-
-
-/**
- * Submit an /exchanges request to the auditor and get the
- * auditor's response.  If the auditor's reply is not
- * well-formed, we return an HTTP status code of zero to @a cb.
- *
- * @param ctx the context for CURL requests
- * @param url HTTP base URL for the auditor
- * @param cb the callback to call when a reply for this request is available
- * @param cb_cls closure for the above callback
- * @return a handle for this request; NULL if the inputs are invalid (i.e.
- *         signatures fail to verify).  In this case, the callback is not 
called.
- */
-struct TALER_AUDITOR_ListExchangesHandle *
-TALER_AUDITOR_list_exchanges (struct GNUNET_CURL_Context *ctx,
-                              const char *url,
-                              TALER_AUDITOR_ListExchangesResultCallback cb,
-                              void *cb_cls);
-
-
-/**
- * Cancel a list exchanges request.  This function cannot be used
- * on a request handle if a response is already served for it.
- *
- * @param leh the list exchanges request handle
- */
-void
-TALER_AUDITOR_list_exchanges_cancel (
-  struct TALER_AUDITOR_ListExchangesHandle *leh);
-
-
 #endif  /* _TALER_AUDITOR_SERVICE_H */
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 1e8ae9d8..43923fea 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -43,12 +43,12 @@
  * quite any time after the command "run" method has been called.
  */
 #define TALER_TESTING_FAIL(is) \
-        do \
-        { \
-          GNUNET_break (0); \
-          TALER_TESTING_interpreter_fail (is); \
-          return; \
-        } while (0)
+  do \
+  { \
+    GNUNET_break (0); \
+    TALER_TESTING_interpreter_fail (is); \
+    return; \
+  } while (0)
 
 
 /**
@@ -60,16 +60,16 @@
  * @param expected expected HTTP status code
  */
 #define TALER_TESTING_unexpected_status(is,status,expected)             \
-        do {                                                                  \
-          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
-                      "Unexpected response code %u (expected: %u) to command 
%s in %s:%u\n", \
-                      status,                                                 \
-                      expected,                                               \
-                      TALER_TESTING_interpreter_get_current_label (is),       \
-                      __FILE__,                                               \
-                      __LINE__);                                              \
-          TALER_TESTING_interpreter_fail (is);                                \
-        } while (0)
+  do {                                                                  \
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
+                "Unexpected response code %u (expected: %u) to command %s in 
%s:%u\n", \
+                status,                                                 \
+                expected,                                               \
+                TALER_TESTING_interpreter_get_current_label (is),       \
+                __FILE__,                                               \
+                __LINE__);                                              \
+    TALER_TESTING_interpreter_fail (is);                                \
+  } while (0)
 
 /**
  * Log an error message about us receiving an unexpected HTTP
@@ -82,18 +82,18 @@
  * @param body received JSON-reply
  */
 #define TALER_TESTING_unexpected_status_with_body(is,status,expected,body) \
-        do {                                                                  \
-          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
-                      "Unexpected response code %u (expected: %u) to "        \
-                      "command %s in %s:%u\nwith body:\n>>%s<<\n",            \
-                      status,                                                 \
-                      expected,                                               \
-                      TALER_TESTING_interpreter_get_current_label (is),       \
-                      __FILE__,                                               \
-                      __LINE__,                                               \
-                      json_dumps (body, JSON_INDENT (2)));                    \
-          TALER_TESTING_interpreter_fail (is);                                \
-        } while (0)
+  do {                                                                  \
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
+                "Unexpected response code %u (expected: %u) to "        \
+                "command %s in %s:%u\nwith body:\n>>%s<<\n",            \
+                status,                                                 \
+                expected,                                               \
+                TALER_TESTING_interpreter_get_current_label (is),       \
+                __FILE__,                                               \
+                __LINE__,                                               \
+                json_dumps (body, JSON_INDENT (2)));                    \
+    TALER_TESTING_interpreter_fail (is);                                \
+  } while (0)
 
 
 /**
@@ -104,14 +104,14 @@
  * @param label command label of the incomplete command
  */
 #define TALER_TESTING_command_incomplete(is,label)                      \
-        do {                                                                  \
-          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
-                      "Command %s (%s:%u) did not complete (at %s)\n",        \
-                      label,                                                  \
-                      __FILE__,                                               \
-                      __LINE__,                                               \
-                      TALER_TESTING_interpreter_get_current_label (is));      \
-        } while (0)
+  do {                                                                  \
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
+                "Command %s (%s:%u) did not complete (at %s)\n",        \
+                label,                                                  \
+                __FILE__,                                               \
+                __LINE__,                                               \
+                TALER_TESTING_interpreter_get_current_label (is));      \
+  } while (0)
 
 
 /**
@@ -311,10 +311,10 @@ struct TALER_TESTING_Command
    * @return #GNUNET_OK on success
    */
   enum GNUNET_GenericReturnValue
-    (*traits)(void *cls,
-              const void **ret,
-              const char *trait,
-              unsigned int index);
+  (*traits)(void *cls,
+            const void **ret,
+            const char *trait,
+            unsigned int index);
 
   /**
    * When did the execution of this command start?
@@ -830,44 +830,6 @@ TALER_TESTING_cmd_deposit_confirmation_with_retry (
   struct TALER_TESTING_Command cmd);
 
 
-/**
- * Create a "list exchanges" command.
- *
- * @param label command label.
- * @param expected_response_code expected HTTP response code.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_exchanges (const char *label,
-                             unsigned int expected_response_code);
-
-
-/**
- * Create a "list exchanges" command and check whether
- * a particular exchange belongs to the returned bundle.
- *
- * @param label command label.
- * @param expected_response_code expected HTTP response code.
- * @param exchange_url URL of the exchange supposed to
- *  be included in the response.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_exchanges_with_url (const char *label,
-                                      unsigned int expected_response_code,
-                                      const char *exchange_url);
-
-/**
- * Modify an exchanges command to enable retries when we get
- * transient errors from the auditor.
- *
- * @param cmd a deposit confirmation command
- * @return the command with retries enabled
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_exchanges_with_retry (struct TALER_TESTING_Command cmd);
-
-
 /**
  * Create /admin/add-incoming command.
  *
@@ -1130,14 +1092,14 @@ TALER_TESTING_cmd_batch_withdraw_with_conflict (
                                          expected_response_code, \
                                          amount, \
                                          ...) \
-        TALER_TESTING_cmd_batch_withdraw_with_conflict ( \
-          (label), \
-          (reserve_reference), \
-          false, \
-          (age), \
-          (expected_response_code), \
-          (amount), \
-          __VA_ARGS__)
+  TALER_TESTING_cmd_batch_withdraw_with_conflict ( \
+    (label), \
+    (reserve_reference), \
+    false, \
+    (age), \
+    (expected_response_code), \
+    (amount), \
+    __VA_ARGS__)
 
 /**
  * Create an age-withdraw command, letting the caller specify
@@ -2267,7 +2229,7 @@ TALER_TESTING_cmd_oauth_with_birthdate (const char *label,
  * @param port the TCP port to listen on
  */
 #define TALER_TESTING_cmd_oauth(label, port) \
-        TALER_TESTING_cmd_oauth_with_birthdate ((label), NULL, (port))
+  TALER_TESTING_cmd_oauth_with_birthdate ((label), NULL, (port))
 
 
 /* ****************** P2P payment commands ****************** */
@@ -2596,13 +2558,13 @@ TALER_TESTING_get_trait (const struct 
TALER_TESTING_Trait *traits,
  * statically allocated data of type @a type.
  */
 #define TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type)   \
-        enum GNUNET_GenericReturnValue                          \
-        TALER_TESTING_get_trait_ ## name (                    \
-          const struct TALER_TESTING_Command *cmd,              \
-          type **ret);                                          \
-        struct TALER_TESTING_Trait                              \
-        TALER_TESTING_make_trait_ ## name (                   \
-          type * value);
+  enum GNUNET_GenericReturnValue                          \
+    TALER_TESTING_get_trait_ ## name (                    \
+    const struct TALER_TESTING_Command *cmd,              \
+    type **ret);                                          \
+  struct TALER_TESTING_Trait                              \
+    TALER_TESTING_make_trait_ ## name (                   \
+    type * value);
 
 
 /**
@@ -2610,27 +2572,27 @@ TALER_TESTING_get_trait (const struct 
TALER_TESTING_Trait *traits,
  * allocated data of type @a type.
  */
 #define TALER_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type)  \
-        enum GNUNET_GenericReturnValue                         \
-        TALER_TESTING_get_trait_ ## name (                   \
-          const struct TALER_TESTING_Command *cmd,             \
-          type * *ret)                                          \
-        {                                                      \
-          if (NULL == cmd->traits) return GNUNET_SYSERR;       \
-          return cmd->traits (cmd->cls,                        \
-                              (const void **) ret,             \
-                              TALER_S (name),                  \
-                              0);                              \
-        }                                                      \
-        struct TALER_TESTING_Trait                             \
-        TALER_TESTING_make_trait_ ## name (                  \
-          type * value)                                        \
-        {                                                      \
-          struct TALER_TESTING_Trait ret = {                   \
-            .trait_name = TALER_S (name),                      \
-            .ptr = (const void *) value                        \
-          };                                                   \
-          return ret;                                          \
-        }
+  enum GNUNET_GenericReturnValue                         \
+    TALER_TESTING_get_trait_ ## name (                   \
+    const struct TALER_TESTING_Command *cmd,             \
+    type **ret)                                          \
+  {                                                      \
+    if (NULL == cmd->traits) return GNUNET_SYSERR;       \
+    return cmd->traits (cmd->cls,                        \
+                        (const void **) ret,             \
+                        TALER_S (name),                  \
+                        0);                              \
+  }                                                      \
+  struct TALER_TESTING_Trait                             \
+    TALER_TESTING_make_trait_ ## name (                  \
+    type * value)                                        \
+  {                                                      \
+    struct TALER_TESTING_Trait ret = {                   \
+      .trait_name = TALER_S (name),                      \
+      .ptr = (const void *) value                        \
+    };                                                   \
+    return ret;                                          \
+  }
 
 
 /**
@@ -2638,15 +2600,15 @@ TALER_TESTING_get_trait (const struct 
TALER_TESTING_Trait *traits,
  * statically allocated data of type @a type.
  */
 #define TALER_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type)  \
-        enum GNUNET_GenericReturnValue                          \
-        TALER_TESTING_get_trait_ ## name (                    \
-          const struct TALER_TESTING_Command *cmd,              \
-          unsigned int index,                                   \
-          type **ret);                                          \
-        struct TALER_TESTING_Trait                              \
-        TALER_TESTING_make_trait_ ## name (                   \
-          unsigned int index,                                   \
-          type *value);
+  enum GNUNET_GenericReturnValue                          \
+    TALER_TESTING_get_trait_ ## name (                    \
+    const struct TALER_TESTING_Command *cmd,              \
+    unsigned int index,                                   \
+    type **ret);                                          \
+  struct TALER_TESTING_Trait                              \
+    TALER_TESTING_make_trait_ ## name (                   \
+    unsigned int index,                                   \
+    type * value);
 
 
 /**
@@ -2654,116 +2616,116 @@ TALER_TESTING_get_trait (const struct 
TALER_TESTING_Trait *traits,
  * allocated data of type @a type.
  */
 #define TALER_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \
-        enum GNUNET_GenericReturnValue                         \
-        TALER_TESTING_get_trait_ ## name (                   \
-          const struct TALER_TESTING_Command *cmd,             \
-          unsigned int index,                                  \
-          type * *ret)                                          \
-        {                                                      \
-          if (NULL == cmd->traits) return GNUNET_SYSERR;       \
-          return cmd->traits (cmd->cls,                        \
-                              (const void **) ret,             \
-                              TALER_S (name),                  \
-                              index);                          \
-        }                                                      \
-        struct TALER_TESTING_Trait                             \
-        TALER_TESTING_make_trait_ ## name (                  \
-          unsigned int index,                                  \
-          type * value)                                        \
-        {                                                      \
-          struct TALER_TESTING_Trait ret = {                   \
-            .index = index,                                    \
-            .trait_name = TALER_S (name),                      \
-            .ptr = (const void *) value                        \
-          };                                                   \
-          return ret;                                          \
-        }
+  enum GNUNET_GenericReturnValue                         \
+    TALER_TESTING_get_trait_ ## name (                   \
+    const struct TALER_TESTING_Command *cmd,             \
+    unsigned int index,                                  \
+    type **ret)                                          \
+  {                                                      \
+    if (NULL == cmd->traits) return GNUNET_SYSERR;       \
+    return cmd->traits (cmd->cls,                        \
+                        (const void **) ret,             \
+                        TALER_S (name),                  \
+                        index);                          \
+  }                                                      \
+  struct TALER_TESTING_Trait                             \
+    TALER_TESTING_make_trait_ ## name (                  \
+    unsigned int index,                                  \
+    type * value)                                        \
+  {                                                      \
+    struct TALER_TESTING_Trait ret = {                   \
+      .index = index,                                    \
+      .trait_name = TALER_S (name),                      \
+      .ptr = (const void *) value                        \
+    };                                                   \
+    return ret;                                          \
+  }
 
 
 /**
  * Call #op on all simple traits.
  */
 #define TALER_TESTING_SIMPLE_TRAITS(op) \
-        op (bank_row, const uint64_t)                                    \
-        op (officer_pub, const struct TALER_AmlOfficerPublicKeyP)        \
-        op (officer_priv, const struct TALER_AmlOfficerPrivateKeyP)      \
-        op (officer_name, const char)                                    \
-        op (aml_decision, enum TALER_AmlDecisionState)                   \
-        op (aml_justification, const char)                               \
-        op (auditor_priv, const struct TALER_AuditorPrivateKeyP)         \
-        op (auditor_pub, const struct TALER_AuditorPublicKeyP)           \
-        op (master_priv, const struct TALER_MasterPrivateKeyP)           \
-        op (master_pub, const struct TALER_MasterPublicKeyP)             \
-        op (purse_priv, const struct TALER_PurseContractPrivateKeyP)     \
-        op (purse_pub, const struct TALER_PurseContractPublicKeyP)       \
-        op (merge_priv, const struct TALER_PurseMergePrivateKeyP)        \
-        op (merge_pub, const struct TALER_PurseMergePublicKeyP)          \
-        op (contract_priv, const struct TALER_ContractDiffiePrivateP)    \
-        op (reserve_priv, const struct TALER_ReservePrivateKeyP)         \
-        op (reserve_sig, const struct TALER_ReserveSignatureP)           \
-        op (h_payto, const struct TALER_PaytoHashP)                      \
-        op (planchet_secret, const struct TALER_PlanchetMasterSecretP)   \
-        op (refresh_secret, const struct TALER_RefreshMasterSecretP)     \
-        op (reserve_pub, const struct TALER_ReservePublicKeyP)           \
-        op (merchant_priv, const struct TALER_MerchantPrivateKeyP)       \
-        op (merchant_pub, const struct TALER_MerchantPublicKeyP)         \
-        op (merchant_sig, const struct TALER_MerchantSignatureP)         \
-        op (wtid, const struct TALER_WireTransferIdentifierRawP)         \
-        op (bank_auth_data, const struct TALER_BANK_AuthenticationData)  \
-        op (contract_terms, const json_t)                                \
-        op (wire_details, const json_t)                                  \
-        op (exchange_url, const char)                                    \
-        op (auditor_url, const char)                                     \
-        op (exchange_bank_account_url, const char)                       \
-        op (taler_uri, const char)                                       \
-        op (payto_uri, const char)                                       \
-        op (kyc_url, const char)                                         \
-        op (web_url, const char)                                         \
-        op (row, const uint64_t)                                         \
-        op (legi_requirement_row, const uint64_t)                        \
-        op (array_length, const unsigned int)                            \
-        op (credit_payto_uri, const char)                                \
-        op (debit_payto_uri, const char)                                 \
-        op (order_id, const char)                                        \
-        op (amount, const struct TALER_Amount)                           \
-        op (amount_with_fee, const struct TALER_Amount)                  \
-        op (batch_cmds, struct TALER_TESTING_Command)                    \
-        op (uuid, const struct GNUNET_Uuid)                              \
-        op (fresh_coins, const struct TALER_TESTING_FreshCoinData *)     \
-        op (claim_token, const struct TALER_ClaimTokenP)                 \
-        op (relative_time, const struct GNUNET_TIME_Relative)            \
-        op (fakebank, struct TALER_FAKEBANK_Handle)                      \
-        op (keys, struct TALER_EXCHANGE_Keys)                            \
-        op (process, struct GNUNET_OS_Process *)
+  op (bank_row, const uint64_t)                                    \
+  op (officer_pub, const struct TALER_AmlOfficerPublicKeyP)        \
+  op (officer_priv, const struct TALER_AmlOfficerPrivateKeyP)      \
+  op (officer_name, const char)                                    \
+  op (aml_decision, enum TALER_AmlDecisionState)                   \
+  op (aml_justification, const char)                               \
+  op (auditor_priv, const struct TALER_AuditorPrivateKeyP)         \
+  op (auditor_pub, const struct TALER_AuditorPublicKeyP)           \
+  op (master_priv, const struct TALER_MasterPrivateKeyP)           \
+  op (master_pub, const struct TALER_MasterPublicKeyP)             \
+  op (purse_priv, const struct TALER_PurseContractPrivateKeyP)     \
+  op (purse_pub, const struct TALER_PurseContractPublicKeyP)       \
+  op (merge_priv, const struct TALER_PurseMergePrivateKeyP)        \
+  op (merge_pub, const struct TALER_PurseMergePublicKeyP)          \
+  op (contract_priv, const struct TALER_ContractDiffiePrivateP)    \
+  op (reserve_priv, const struct TALER_ReservePrivateKeyP)         \
+  op (reserve_sig, const struct TALER_ReserveSignatureP)           \
+  op (h_payto, const struct TALER_PaytoHashP)                      \
+  op (planchet_secret, const struct TALER_PlanchetMasterSecretP)   \
+  op (refresh_secret, const struct TALER_RefreshMasterSecretP)     \
+  op (reserve_pub, const struct TALER_ReservePublicKeyP)           \
+  op (merchant_priv, const struct TALER_MerchantPrivateKeyP)       \
+  op (merchant_pub, const struct TALER_MerchantPublicKeyP)         \
+  op (merchant_sig, const struct TALER_MerchantSignatureP)         \
+  op (wtid, const struct TALER_WireTransferIdentifierRawP)         \
+  op (bank_auth_data, const struct TALER_BANK_AuthenticationData)  \
+  op (contract_terms, const json_t)                                \
+  op (wire_details, const json_t)                                  \
+  op (exchange_url, const char)                                    \
+  op (auditor_url, const char)                                     \
+  op (exchange_bank_account_url, const char)                       \
+  op (taler_uri, const char)                                       \
+  op (payto_uri, const char)                                       \
+  op (kyc_url, const char)                                         \
+  op (web_url, const char)                                         \
+  op (row, const uint64_t)                                         \
+  op (legi_requirement_row, const uint64_t)                        \
+  op (array_length, const unsigned int)                            \
+  op (credit_payto_uri, const char)                                \
+  op (debit_payto_uri, const char)                                 \
+  op (order_id, const char)                                        \
+  op (amount, const struct TALER_Amount)                           \
+  op (amount_with_fee, const struct TALER_Amount)                  \
+  op (batch_cmds, struct TALER_TESTING_Command)                    \
+  op (uuid, const struct GNUNET_Uuid)                              \
+  op (fresh_coins, const struct TALER_TESTING_FreshCoinData *)     \
+  op (claim_token, const struct TALER_ClaimTokenP)                 \
+  op (relative_time, const struct GNUNET_TIME_Relative)            \
+  op (fakebank, struct TALER_FAKEBANK_Handle)                      \
+  op (keys, struct TALER_EXCHANGE_Keys)                            \
+  op (process, struct GNUNET_OS_Process *)
 
 
 /**
  * Call #op on all indexed traits.
  */
 #define TALER_TESTING_INDEXED_TRAITS(op)                                \
-        op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey)            \
-        op (denom_sig, const struct TALER_DenominationSignature)              \
-        op (amounts, const struct TALER_Amount)                               \
-        op (deposit_amount, const struct TALER_Amount)                        \
-        op (deposit_fee_amount, const struct TALER_Amount)                    \
-        op (age_commitment, const struct TALER_AgeCommitment)                 \
-        op (age_commitment_proof, const struct TALER_AgeCommitmentProof)      \
-        op (h_age_commitment, const struct TALER_AgeCommitmentHash)           \
-        op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \
-        op (coin_history, const struct TALER_EXCHANGE_CoinHistoryEntry) \
-        op (planchet_secrets, const struct TALER_PlanchetMasterSecretP)       \
-        op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues)     \
-        op (coin_priv, const struct TALER_CoinSpendPrivateKeyP)               \
-        op (coin_pub, const struct TALER_CoinSpendPublicKeyP)                 \
-        op (coin_sig, const struct TALER_CoinSpendSignatureP)                 \
-        op (absolute_time, const struct GNUNET_TIME_Absolute)                 \
-        op (timestamp, const struct GNUNET_TIME_Timestamp)                    \
-        op (wire_deadline, const struct GNUNET_TIME_Timestamp)                \
-        op (refund_deadline, const struct GNUNET_TIME_Timestamp)              \
-        op (exchange_pub, const struct TALER_ExchangePublicKeyP)              \
-        op (exchange_sig, const struct TALER_ExchangeSignatureP)              \
-        op (blinding_key, const union GNUNET_CRYPTO_BlindingSecretP)         \
-        op (h_blinded_coin, const struct TALER_BlindedCoinHashP)
+  op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey)            \
+  op (denom_sig, const struct TALER_DenominationSignature)              \
+  op (amounts, const struct TALER_Amount)                               \
+  op (deposit_amount, const struct TALER_Amount)                        \
+  op (deposit_fee_amount, const struct TALER_Amount)                    \
+  op (age_commitment, const struct TALER_AgeCommitment)                 \
+  op (age_commitment_proof, const struct TALER_AgeCommitmentProof)      \
+  op (h_age_commitment, const struct TALER_AgeCommitmentHash)           \
+  op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \
+  op (coin_history, const struct TALER_EXCHANGE_CoinHistoryEntry) \
+  op (planchet_secrets, const struct TALER_PlanchetMasterSecretP)       \
+  op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues)     \
+  op (coin_priv, const struct TALER_CoinSpendPrivateKeyP)               \
+  op (coin_pub, const struct TALER_CoinSpendPublicKeyP)                 \
+  op (coin_sig, const struct TALER_CoinSpendSignatureP)                 \
+  op (absolute_time, const struct GNUNET_TIME_Absolute)                 \
+  op (timestamp, const struct GNUNET_TIME_Timestamp)                    \
+  op (wire_deadline, const struct GNUNET_TIME_Timestamp)                \
+  op (refund_deadline, const struct GNUNET_TIME_Timestamp)              \
+  op (exchange_pub, const struct TALER_ExchangePublicKeyP)              \
+  op (exchange_sig, const struct TALER_ExchangeSignatureP)              \
+  op (blinding_key, const union GNUNET_CRYPTO_BlindingSecretP)         \
+  op (h_blinded_coin, const struct TALER_BlindedCoinHashP)
 
 TALER_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT)
 
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 1291fd3a..5d4f54b5 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -75,7 +75,7 @@ libtalerexchange_la_SOURCES = \
   exchange_api_reserves_history.c \
   exchange_api_reserves_open.c \
   exchange_api_stefan.c \
-  exchange_api_transfers_get.c 
+  exchange_api_transfers_get.c
 libtalerexchange_la_LIBADD = \
   libtalerauditor.la \
   $(top_builddir)/src/json/libtalerjson.la \
@@ -97,8 +97,7 @@ libtalerauditor_la_LDFLAGS = \
 libtalerauditor_la_SOURCES = \
   auditor_api_curl_defaults.c auditor_api_curl_defaults.h \
   auditor_api_get_config.c \
-  auditor_api_deposit_confirmation.c \
-  auditor_api_exchanges.c
+  auditor_api_deposit_confirmation.c
 libtalerauditor_la_LIBADD = \
   $(top_builddir)/src/curl/libtalercurl.la \
   $(top_builddir)/src/json/libtalerjson.la \
diff --git a/src/lib/auditor_api_exchanges.c b/src/lib/auditor_api_exchanges.c
deleted file mode 100644
index 1988c2fa..00000000
--- a/src/lib/auditor_api_exchanges.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-  This file is part of TALER
-  Copyright (C) 2014-2018 Taler Systems SA
-
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU General Public License as published by the Free Software
-  Foundation; either version 3, or (at your option) any later version.
-
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  TALER; see the file COPYING.  If not, see
-  <http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/auditor_api_exchanges.c
- * @brief Implementation of the /exchanges request of the auditor's HTTP API
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include <jansson.h>
-#include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_json_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_json_lib.h"
-#include "taler_auditor_service.h"
-#include "taler_util.h"
-#include "taler_curl_lib.h"
-#include "taler_signatures.h"
-#include "auditor_api_curl_defaults.h"
-
-/**
- * How many exchanges do we allow a single auditor to
- * audit at most?
- */
-#define MAX_EXCHANGES 1024
-
-
-/**
- * @brief A ListExchanges Handle
- */
-struct TALER_AUDITOR_ListExchangesHandle
-{
-
-  /**
-   * The url for this request.
-   */
-  char *url;
-
-  /**
-   * Handle for the request.
-   */
-  struct GNUNET_CURL_Job *job;
-
-  /**
-   * Function to call with the result.
-   */
-  TALER_AUDITOR_ListExchangesResultCallback cb;
-
-  /**
-   * Closure for @a cb.
-   */
-  void *cb_cls;
-
-};
-
-
-/**
- * Function called when we're done processing the
- * HTTP /exchanges request.
- *
- * @param cls the `struct TALER_AUDITOR_ListExchangesHandle`
- * @param response_code HTTP response code, 0 on error
- * @param djson parsed JSON result, NULL on error
- */
-static void
-handle_exchanges_finished (void *cls,
-                           long response_code,
-                           const void *djson)
-{
-  const json_t *json = djson;
-  const json_t *ja;
-  unsigned int ja_len;
-  struct TALER_AUDITOR_ListExchangesHandle *leh = cls;
-  struct TALER_AUDITOR_ListExchangesResponse ler = {
-    .hr.reply = json,
-    .hr.http_status = (unsigned int) response_code
-  };
-
-  leh->job = NULL;
-  switch (response_code)
-  {
-  case 0:
-    ler.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
-    break;
-  case MHD_HTTP_OK:
-    ja = json_object_get (json,
-                          "exchanges");
-    if ( (NULL == ja) ||
-         (! json_is_array (ja)) )
-    {
-      GNUNET_break (0);
-      ler.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
-      ler.hr.http_status = 0;
-      break;
-    }
-
-    ja_len = json_array_size (ja);
-    if (ja_len > MAX_EXCHANGES)
-    {
-      GNUNET_break (0);
-      ler.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
-      ler.hr.http_status = 0;
-      break;
-    }
-    {
-      struct TALER_AUDITOR_ExchangeInfo ei[GNUNET_NZL (ja_len)];
-      bool ok = true;
-
-      for (unsigned int i = 0; i<ja_len; i++)
-      {
-        struct GNUNET_JSON_Specification spec[] = {
-          GNUNET_JSON_spec_fixed_auto ("master_pub",
-                                       &ei[i].master_pub),
-          TALER_JSON_spec_web_url ("exchange_url",
-                                   &ei[i].exchange_url),
-          GNUNET_JSON_spec_end ()
-        };
-
-        if (GNUNET_OK !=
-            GNUNET_JSON_parse (json_array_get (ja,
-                                               i),
-                               spec,
-                               NULL, NULL))
-        {
-          GNUNET_break_op (0);
-          ok = false;
-          ler.hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
-          ler.hr.http_status = 0;
-          break;
-        }
-      }
-      if (! ok)
-        break;
-      ler.details.ok.ei = ei;
-      ler.details.ok.num_exchanges = ja_len;
-      leh->cb (leh->cb_cls,
-               &ler);
-      TALER_AUDITOR_list_exchanges_cancel (leh);
-      return;
-    }
-  case MHD_HTTP_BAD_REQUEST:
-    /* This should never happen, either us or the auditor is buggy
-       (or API version conflict); just pass JSON reply to the application */
-    ler.hr.ec = TALER_JSON_get_error_code (json);
-    ler.hr.hint = TALER_JSON_get_error_hint (json);
-    break;
-  case MHD_HTTP_NOT_FOUND:
-    /* Nothing really to verify, this should never
-       happen, we should pass the JSON reply to the application */
-    ler.hr.ec = TALER_JSON_get_error_code (json);
-    ler.hr.hint = TALER_JSON_get_error_hint (json);
-    break;
-  case MHD_HTTP_INTERNAL_SERVER_ERROR:
-    /* Server had an internal issue; we should retry, but this API
-       leaves this to the application */
-    ler.hr.ec = TALER_JSON_get_error_code (json);
-    ler.hr.hint = TALER_JSON_get_error_hint (json);
-    break;
-  default:
-    /* unexpected response code */
-    ler.hr.ec = TALER_JSON_get_error_code (json);
-    ler.hr.hint = TALER_JSON_get_error_hint (json);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u/%d for auditor list-exchanges 
request\n",
-                (unsigned int) response_code,
-                (int) ler.hr.ec);
-    GNUNET_break_op (0);
-    break;
-  }
-  if (NULL != leh->cb)
-    leh->cb (leh->cb_cls,
-             &ler);
-  TALER_AUDITOR_list_exchanges_cancel (leh);
-}
-
-
-struct TALER_AUDITOR_ListExchangesHandle *
-TALER_AUDITOR_list_exchanges (struct GNUNET_CURL_Context *ctx,
-                              const char *url,
-                              TALER_AUDITOR_ListExchangesResultCallback cb,
-                              void *cb_cls)
-{
-  struct TALER_AUDITOR_ListExchangesHandle *leh;
-  CURL *eh;
-
-  leh = GNUNET_new (struct TALER_AUDITOR_ListExchangesHandle);
-  leh->cb = cb;
-  leh->cb_cls = cb_cls;
-  leh->url = TALER_url_join (url,
-                             "exchanges",
-                             NULL);
-  if (NULL == leh->url)
-  {
-    GNUNET_free (leh);
-    return NULL;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "URL for list-exchanges: `%s'\n",
-              leh->url);
-  eh = TALER_AUDITOR_curl_easy_get_ (leh->url);
-  if (NULL == eh)
-  {
-    GNUNET_break (0);
-    GNUNET_free (leh->url);
-    GNUNET_free (leh);
-    return NULL;
-  }
-  leh->job = GNUNET_CURL_job_add (ctx,
-                                  eh,
-                                  &handle_exchanges_finished,
-                                  leh);
-  return leh;
-}
-
-
-void
-TALER_AUDITOR_list_exchanges_cancel (
-  struct TALER_AUDITOR_ListExchangesHandle *leh)
-{
-  if (NULL != leh->job)
-  {
-    GNUNET_CURL_job_cancel (leh->job);
-    leh->job = NULL;
-  }
-  GNUNET_free (leh->url);
-  GNUNET_free (leh);
-}
-
-
-/* end of auditor_api_exchanges.c */
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index ae713ab6..f1e7f1cc 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -45,7 +45,6 @@ libtalertesting_la_SOURCES = \
   testing_api_cmd_auditor_add.c \
   testing_api_cmd_auditor_del.c \
   testing_api_cmd_auditor_deposit_confirmation.c \
-  testing_api_cmd_auditor_exchanges.c \
   testing_api_cmd_auditor_exec_auditor.c \
   testing_api_cmd_auditor_exec_auditor_dbinit.c \
   testing_api_cmd_bank_admin_add_incoming.c \
diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c
index ac147d93..3810c601 100644
--- a/src/testing/test_auditor_api.c
+++ b/src/testing/test_auditor_api.c
@@ -663,9 +663,6 @@ run (void *cls,
     TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline",
                                             config_file),
     CMD_RUN_AUDITOR ("virgin-auditor"),
-    TALER_TESTING_cmd_exchanges_with_url ("check-exchange",
-                                          MHD_HTTP_OK,
-                                          "http://localhost:8081/";),
     TALER_TESTING_cmd_batch ("massive-deposit-confirms",
                              massive_deposit_confirms),
     TALER_TESTING_cmd_batch ("withdraw",
diff --git a/src/testing/testing_api_cmd_auditor_exchanges.c 
b/src/testing/testing_api_cmd_auditor_exchanges.c
deleted file mode 100644
index c554e5b8..00000000
--- a/src/testing/testing_api_cmd_auditor_exchanges.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
-  This file is part of TALER
-  Copyright (C) 2018-2023 Taler Systems SA
-
-  TALER is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 3, or (at your
-  option) any later version.
-
-  TALER is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public
-  License along with TALER; see the file COPYING.  If not, see
-  <http://www.gnu.org/licenses/>
-*/
-/**
- * @file testing/testing_api_cmd_auditor_exchanges.c
- * @brief command for testing /exchanges of the auditor
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include "taler_auditor_service.h"
-#include "taler_testing_lib.h"
-#include "taler_signatures.h"
-#include "backoff.h"
-
-/**
- * How long do we wait AT MOST when retrying?
- */
-#define MAX_BACKOFF GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MILLISECONDS, 100)
-
-
-/**
- * How often do we retry before giving up?
- */
-#define NUM_RETRIES 5
-
-
-/**
- * State for a "deposit confirmation" CMD.
- */
-struct ExchangesState
-{
-
-  /**
-   * Exchanges handle while operation is running.
-   */
-  struct TALER_AUDITOR_ListExchangesHandle *leh;
-
-  /**
-   * Interpreter state.
-   */
-  struct TALER_TESTING_Interpreter *is;
-
-  /**
-   * Task scheduled to try later.
-   */
-  struct GNUNET_SCHEDULER_Task *retry_task;
-
-  /**
-   * How long do we wait until we retry?
-   */
-  struct GNUNET_TIME_Relative backoff;
-
-  /**
-   * Expected HTTP response code.
-   */
-  unsigned int expected_response_code;
-
-  /**
-   * URL of the exchange expected to be included in the response.
-   */
-  const char *exchange_url;
-
-  /**
-   * How often should we retry on (transient) failures?
-   */
-  unsigned int do_retry;
-
-};
-
-
-/**
- * Run the command.
- *
- * @param cls closure.
- * @param cmd the command to execute.
- * @param is the interpreter state.
- */
-static void
-exchanges_run (void *cls,
-               const struct TALER_TESTING_Command *cmd,
-               struct TALER_TESTING_Interpreter *is);
-
-
-/**
- * Task scheduled to re-try #exchanges_run.
- *
- * @param cls a `struct ExchangesState`
- */
-static void
-do_retry (void *cls)
-{
-  struct ExchangesState *es = cls;
-
-  es->retry_task = NULL;
-  TALER_TESTING_touch_cmd (es->is);
-  exchanges_run (es,
-                 NULL,
-                 es->is);
-}
-
-
-/**
- * Callback to analyze the /exchanges response.
- *
- * @param cls closure of type struct ExchangesState*
- * @param ler Response to the GET /exchanges request
- */
-static void
-exchanges_cb (void *cls,
-              const struct TALER_AUDITOR_ListExchangesResponse *ler)
-{
-  struct ExchangesState *es = cls;
-  const struct TALER_AUDITOR_HttpResponse *hr = &ler->hr;
-
-  es->leh = NULL;
-  if (es->expected_response_code != hr->http_status)
-  {
-    if (0 != es->do_retry)
-    {
-      es->do_retry--;
-      if ( (0 == hr->http_status) ||
-           (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec) ||
-           (MHD_HTTP_INTERNAL_SERVER_ERROR == hr->http_status) )
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                    "Retrying list exchanges failed with %u/%d\n",
-                    hr->http_status,
-                    (int) hr->ec);
-        /* on DB conflicts, do not use backoff */
-        if (TALER_EC_GENERIC_DB_SOFT_FAILURE == hr->ec)
-          es->backoff = GNUNET_TIME_UNIT_ZERO;
-        else
-          es->backoff = GNUNET_TIME_randomized_backoff (es->backoff,
-                                                        MAX_BACKOFF);
-        TALER_TESTING_inc_tries (es->is);
-        es->retry_task = GNUNET_SCHEDULER_add_delayed (es->backoff,
-                                                       &do_retry,
-                                                       es);
-        return;
-      }
-    }
-    TALER_TESTING_unexpected_status (es->is,
-                                     hr->http_status,
-                                     es->expected_response_code);
-    return;
-  }
-  if (MHD_HTTP_OK != hr->http_status)
-  {
-    TALER_TESTING_interpreter_next (es->is);
-    return;
-  }
-  if (NULL != es->exchange_url)
-  {
-    bool found = false;
-    unsigned int num_exchanges = ler->details.ok.num_exchanges;
-    const struct TALER_AUDITOR_ExchangeInfo *ei = ler->details.ok.ei;
-
-    for (unsigned int i = 0;
-         i<num_exchanges;
-         i++)
-      if (0 == strcmp (es->exchange_url,
-                       ei[i].exchange_url))
-        found = true;
-    if (! found)
-    {
-      TALER_LOG_ERROR ("Exchange '%s' doesn't exist at this auditor\n",
-                       es->exchange_url);
-      TALER_TESTING_interpreter_fail (es->is);
-      return;
-    }
-    TALER_LOG_DEBUG ("Exchange '%s' exists at this auditor!\n",
-                     es->exchange_url);
-  }
-  TALER_TESTING_interpreter_next (es->is);
-}
-
-
-/**
- * Run the command.
- *
- * @param cls closure.
- * @param cmd the command to execute.
- * @param is the interpreter state.
- */
-static void
-exchanges_run (void *cls,
-               const struct TALER_TESTING_Command *cmd,
-               struct TALER_TESTING_Interpreter *is)
-{
-  struct ExchangesState *es = cls;
-  const struct TALER_TESTING_Command *auditor_cmd;
-  const char *auditor_url;
-
-  (void) cmd;
-  auditor_cmd = TALER_TESTING_interpreter_get_command (is,
-                                                       "auditor");
-  if (NULL == auditor_cmd)
-  {
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (is);
-    return;
-  }
-  if (GNUNET_OK !=
-      TALER_TESTING_get_trait_auditor_url (auditor_cmd,
-                                           &auditor_url))
-  {
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (is);
-    return;
-  }
-  es->is = is;
-  es->leh = TALER_AUDITOR_list_exchanges (
-    TALER_TESTING_interpreter_get_context (is),
-    auditor_url,
-    &exchanges_cb,
-    es);
-  if (NULL == es->leh)
-  {
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (is);
-    return;
-  }
-  return;
-}
-
-
-/**
- * Free the state of a "exchanges" CMD, and possibly cancel a
- * pending operation thereof.
- *
- * @param cls closure, a `struct ExchangesState`
- * @param cmd the command which is being cleaned up.
- */
-static void
-exchanges_cleanup (void *cls,
-                   const struct TALER_TESTING_Command *cmd)
-{
-  struct ExchangesState *es = cls;
-
-  if (NULL != es->leh)
-  {
-    TALER_TESTING_command_incomplete (es->is,
-                                      cmd->label);
-    TALER_AUDITOR_list_exchanges_cancel (es->leh);
-    es->leh = NULL;
-  }
-  if (NULL != es->retry_task)
-  {
-    GNUNET_SCHEDULER_cancel (es->retry_task);
-    es->retry_task = NULL;
-  }
-  GNUNET_free (es);
-}
-
-
-/**
- * Offer internal data to other commands.
- *
- * @param cls closure.
- * @param[out] ret set to the wanted data.
- * @param trait name of the trait.
- * @param index index number of the traits to be returned.
- * @return #GNUNET_OK on success
- */
-static enum GNUNET_GenericReturnValue
-exchanges_traits (void *cls,
-                  const void **ret,
-                  const char *trait,
-                  unsigned int index)
-{
-  (void) cls;
-  (void) ret;
-  (void) trait;
-  (void) index;
-  /* Must define this function because some callbacks
-   * look for certain traits on _all_ the commands. */
-  return GNUNET_SYSERR;
-}
-
-
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_exchanges (const char *label,
-                             unsigned int expected_response_code)
-{
-  struct ExchangesState *es;
-
-  es = GNUNET_new (struct ExchangesState);
-  es->expected_response_code = expected_response_code;
-
-  {
-    struct TALER_TESTING_Command cmd = {
-      .cls = es,
-      .label = label,
-      .run = &exchanges_run,
-      .cleanup = &exchanges_cleanup,
-      .traits = &exchanges_traits
-    };
-
-    return cmd;
-  }
-}
-
-
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_exchanges_with_url (const char *label,
-                                      unsigned int expected_response_code,
-                                      const char *exchange_url)
-{
-  struct ExchangesState *es;
-
-  es = GNUNET_new (struct ExchangesState);
-  es->expected_response_code = expected_response_code;
-  es->exchange_url = exchange_url;
-  {
-    struct TALER_TESTING_Command cmd = {
-      .cls = es,
-      .label = label,
-      .run = &exchanges_run,
-      .cleanup = &exchanges_cleanup,
-      .traits = &exchanges_traits
-    };
-
-    return cmd;
-  }
-}
-
-
-/**
- * Modify an exchanges command to enable retries when we get
- * transient errors from the auditor.
- *
- * @param cmd a deposit confirmation command
- * @return the command with retries enabled
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_exchanges_with_retry (struct TALER_TESTING_Command cmd)
-{
-  struct ExchangesState *es;
-
-  GNUNET_assert (&exchanges_run == cmd.run);
-  es = cmd.cls;
-  es->do_retry = NUM_RETRIES;
-  return cmd;
-}
-
-
-/* end of testing_auditor_api_cmd_exchanges.c */

-- 
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]