gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -more exchange API atomization


From: gnunet
Subject: [taler-exchange] branch master updated: -more exchange API atomization
Date: Thu, 22 Jun 2023 20:42:13 +0200

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 999dae7c -more exchange API atomization
999dae7c is described below

commit 999dae7c5d0c37473e486fa38816a3f35c42dba9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jun 22 20:42:10 2023 +0200

    -more exchange API atomization
---
 src/include/taler_exchange_service.h       |  6 ++++--
 src/lib/exchange_api_purse_delete.c        | 20 ++++++--------------
 src/testing/testing_api_cmd_purse_delete.c | 12 ++++++++----
 3 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 9460fdbd..32617ba0 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -6081,7 +6081,8 @@ struct TALER_EXCHANGE_PurseDeleteHandle;
  * Asks the exchange to delete a purse. Will only succeed if
  * the purse was not yet merged and did not yet time out.
  *
- * @param exchange the exchange to interact with
+ * @param ctx CURL context
+ * @param url exchange base URL
  * @param purse_priv private key of the purse
  * @param cb function to call with the exchange's result
  * @param cb_cls closure for @a cb
@@ -6089,7 +6090,8 @@ struct TALER_EXCHANGE_PurseDeleteHandle;
  */
 struct TALER_EXCHANGE_PurseDeleteHandle *
 TALER_EXCHANGE_purse_delete (
-  struct TALER_EXCHANGE_Handle *exchange,
+  struct GNUNET_CURL_Context *ctx,
+  const char *url,
   const struct TALER_PurseContractPrivateKeyP *purse_priv,
   TALER_EXCHANGE_PurseDeleteCallback cb,
   void *cb_cls);
diff --git a/src/lib/exchange_api_purse_delete.c 
b/src/lib/exchange_api_purse_delete.c
index 62483810..6f8ecc38 100644
--- a/src/lib/exchange_api_purse_delete.c
+++ b/src/lib/exchange_api_purse_delete.c
@@ -40,11 +40,6 @@
 struct TALER_EXCHANGE_PurseDeleteHandle
 {
 
-  /**
-   * The connection to exchange this request handle will use
-   */
-  struct TALER_EXCHANGE_Handle *exchange;
-
   /**
    * The url for this request.
    */
@@ -148,26 +143,23 @@ handle_purse_delete_finished (void *cls,
 
 struct TALER_EXCHANGE_PurseDeleteHandle *
 TALER_EXCHANGE_purse_delete (
-  struct TALER_EXCHANGE_Handle *exchange,
+  struct GNUNET_CURL_Context *ctx,
+  const char *url,
   const struct TALER_PurseContractPrivateKeyP *purse_priv,
   TALER_EXCHANGE_PurseDeleteCallback cb,
   void *cb_cls)
 {
   struct TALER_EXCHANGE_PurseDeleteHandle *pdh;
-  struct GNUNET_CURL_Context *ctx;
   CURL *eh;
   struct TALER_PurseContractPublicKeyP purse_pub;
   struct TALER_PurseContractSignatureP purse_sig;
   char arg_str[sizeof (purse_pub) * 2 + 32];
 
   pdh = GNUNET_new (struct TALER_EXCHANGE_PurseDeleteHandle);
-  pdh->exchange = exchange;
   pdh->cb = cb;
   pdh->cb_cls = cb_cls;
   GNUNET_CRYPTO_eddsa_key_get_public (&purse_priv->eddsa_priv,
                                       &purse_pub.eddsa_pub);
-  GNUNET_assert (GNUNET_YES ==
-                 TEAH_handle_is_ready (exchange));
   {
     char pub_str[sizeof (purse_pub) * 2];
     char *end;
@@ -179,11 +171,12 @@ TALER_EXCHANGE_purse_delete (
     *end = '\0';
     GNUNET_snprintf (arg_str,
                      sizeof (arg_str),
-                     "/purses/%s",
+                     "purses/%s",
                      pub_str);
   }
-  pdh->url = TEAH_path_to_url (exchange,
-                               arg_str);
+  pdh->url = TALER_url_join (url,
+                             arg_str,
+                             NULL);
   if (NULL == pdh->url)
   {
     GNUNET_break (0);
@@ -223,7 +216,6 @@ TALER_EXCHANGE_purse_delete (
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "URL for purse delete: `%s'\n",
               pdh->url);
-  ctx = TEAH_handle_to_context (exchange);
   pdh->job = GNUNET_CURL_job_add2 (ctx,
                                    eh,
                                    pdh->xhdr,
diff --git a/src/testing/testing_api_cmd_purse_delete.c 
b/src/testing/testing_api_cmd_purse_delete.c
index 758524ae..f6b7d573 100644
--- a/src/testing/testing_api_cmd_purse_delete.c
+++ b/src/testing/testing_api_cmd_purse_delete.c
@@ -97,12 +97,15 @@ purse_delete_run (void *cls,
   struct PurseDeleteState *pds = cls;
   const struct TALER_PurseContractPrivateKeyP *purse_priv;
   const struct TALER_TESTING_Command *ref;
-  struct TALER_EXCHANGE_Handle *exchange
-    = TALER_TESTING_get_exchange (is);
+  const char *exchange_url;
 
   (void) cmd;
-  if (NULL == exchange)
+  exchange_url = TALER_TESTING_get_exchange_url (is);
+  if (NULL == exchange_url)
+  {
+    GNUNET_break (0);
     return;
+  }
   ref = TALER_TESTING_interpreter_lookup_command (is,
                                                   pds->purse_cmd);
   if (NULL == ref)
@@ -121,7 +124,8 @@ purse_delete_run (void *cls,
   }
   pds->is = is;
   pds->pdh = TALER_EXCHANGE_purse_delete (
-    exchange,
+    TALER_TESTING_interpreter_get_context (is),
+    exchange_url,
     purse_priv,
     &purse_delete_cb,
     pds);

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