gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: get code for most new endpoints


From: gnunet
Subject: [taler-exchange] branch master updated: get code for most new endpoints to build (but DB not done)
Date: Sun, 29 Nov 2020 14:32:41 +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 3240844e get code for most new endpoints to build (but DB not done)
3240844e is described below

commit 3240844e48dc62b80c6167558677bcd7b83dd3c0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Nov 29 14:32:39 2020 +0100

    get code for most new endpoints to build (but DB not done)
---
 contrib/gana                                       |  2 +-
 src/exchange/Makefile.am                           | 14 +++-
 src/exchange/taler-exchange-httpd.c                | 14 ++++
 src/exchange/taler-exchange-httpd.h                |  5 ++
 src/exchange/taler-exchange-httpd_auditors.c       | 67 +++++++++++---------
 .../taler-exchange-httpd_management_auditors.c     | 24 +++----
 ...exchange-httpd_management_auditors_AP_disable.c | 20 +++---
 ...nge-httpd_management_denominations_HDP_revoke.c |  4 +-
 .../taler-exchange-httpd_management_post_keys.c    | 67 ++++++++++----------
 ...r-exchange-httpd_management_signkey_EP_revoke.c |  6 +-
 .../taler-exchange-httpd_management_wire.c         | 59 +++++++----------
 .../taler-exchange-httpd_management_wire_disable.c | 67 ++++++++------------
 .../taler-exchange-httpd_management_wire_fees.c    | 74 +++++++++++-----------
 src/exchangedb/exchange-0002.sql                   |  2 +
 src/include/taler_exchangedb_plugin.h              | 10 +--
 15 files changed, 228 insertions(+), 207 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 8341d17c..3501eb7b 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 8341d17cd88b1e88943f192a47fbc61ce925816c
+Subproject commit 3501eb7b857d573258c1ab1c42d7e827c36cec9d
diff --git a/src/exchange/Makefile.am b/src/exchange/Makefile.am
index 17960404..a2a9840f 100644
--- a/src/exchange/Makefile.am
+++ b/src/exchange/Makefile.am
@@ -78,14 +78,22 @@ taler_exchange_transfer_LDADD = \
 
 taler_exchange_httpd_SOURCES = \
   taler-exchange-httpd.c taler-exchange-httpd.h \
+  taler-exchange-httpd_auditors.c \
   taler-exchange-httpd_db.c taler-exchange-httpd_db.h \
   taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
   taler-exchange-httpd_deposits_get.c taler-exchange-httpd_deposits_get.h \
   taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
   taler-exchange-httpd_link.c taler-exchange-httpd_link.h \
+  taler-exchange-httpd_management_auditors.c \
+  taler-exchange-httpd_management_auditors_AP_disable.c \
+  taler-exchange-httpd_management_denominations_HDP_revoke.c \
+  taler-exchange-httpd_management_signkey_EP_revoke.c \
+  taler-exchange-httpd_management_wire.c \
+  taler-exchange-httpd_management_wire_disable.c \
+  taler-exchange-httpd_management_wire_fees.c \
+  taler-exchange-httpd_melt.c taler-exchange-httpd_melt.h \
   taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
   taler-exchange-httpd_recoup.c taler-exchange-httpd_recoup.h \
-  taler-exchange-httpd_melt.c taler-exchange-httpd_melt.h \
   taler-exchange-httpd_refreshes_reveal.c 
taler-exchange-httpd_refreshes_reveal.h \
   taler-exchange-httpd_refund.c taler-exchange-httpd_refund.h \
   taler-exchange-httpd_reserves_get.c taler-exchange-httpd_reserves_get.h \
@@ -94,6 +102,10 @@ taler_exchange_httpd_SOURCES = \
   taler-exchange-httpd_transfers_get.c taler-exchange-httpd_transfers_get.h \
   taler-exchange-httpd_wire.c taler-exchange-httpd_wire.h \
   taler-exchange-httpd_withdraw.c taler-exchange-httpd_withdraw.h
+
+#  taler-exchange-httpd_management_post_keys.c
+
+
 taler_exchange_httpd_LDADD = \
   $(LIBGCRYPT_LIBS) \
   $(top_builddir)/src/bank-lib/libtalerbank.la \
diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index 1faea14f..6dc68984 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -112,6 +112,11 @@ struct TALER_MasterPublicKeyP TEH_master_public_key;
  */
 struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
 
+/**
+ * Our currency.
+ */
+char *TEH_currency;
+
 /**
  * Default timeout in seconds for HTTP requests.
  */
@@ -814,6 +819,15 @@ exchange_serve_process_config (void)
                                "REVOCATION_DIR");
     return GNUNET_SYSERR;
   }
+  if (GNUNET_OK !=
+      TALER_config_get_currency (TEH_cfg,
+                                 &TEH_currency))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "taler",
+                               "CURRENCY");
+    return GNUNET_SYSERR;
+  }
   {
     char *master_public_key_str;
 
diff --git a/src/exchange/taler-exchange-httpd.h 
b/src/exchange/taler-exchange-httpd.h
index b1e8079f..ad46788c 100644
--- a/src/exchange/taler-exchange-httpd.h
+++ b/src/exchange/taler-exchange-httpd.h
@@ -68,6 +68,11 @@ extern struct TALER_MasterPublicKeyP TEH_master_public_key;
  */
 extern struct TALER_EXCHANGEDB_Plugin *TEH_plugin;
 
+/**
+ * Our currency.
+ */
+extern char *TEH_currency;
+
 
 /**
  * @brief Struct describing an URL and the handler for it.
diff --git a/src/exchange/taler-exchange-httpd_auditors.c 
b/src/exchange/taler-exchange-httpd_auditors.c
index 954cb998..0aa10812 100644
--- a/src/exchange/taler-exchange-httpd_auditors.c
+++ b/src/exchange/taler-exchange-httpd_auditors.c
@@ -26,9 +26,9 @@
 #include <pthread.h>
 #include "taler_json_lib.h"
 #include "taler_mhd_lib.h"
-#include "taler-exchange-httpd_refund.h"
+#include "taler_signatures.h"
 #include "taler-exchange-httpd_responses.h"
-#include "taler-exchange-httpd_keystate.h"
+
 
 /**
  * Closure for the #add_auditor_denom_sig transaction.
@@ -78,12 +78,13 @@ add_auditor_denom_sig (void *cls,
   struct AddAuditorDenomContext *awc = cls;
   struct TALER_EXCHANGEDB_DenominationKeyMetaData meta;
   enum GNUNET_DB_QueryStatus qs;
+  char *auditor_url;
   bool enabled;
 
-  qs = TEH_plugin->lookup_deomination_key (
+  qs = TEH_plugin->lookup_denomination_key (
     TEH_plugin->cls,
     session,
-    aws->h_denom_pub,
+    awc->h_denom_pub,
     &meta);
   if (qs < 0)
   {
@@ -92,23 +93,25 @@ add_auditor_denom_sig (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup denomination key");
     return qs;
   }
   if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
   {
-    *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_NOT_FOUND,
-                                           TALER_EC_XXX,
-                                           "denomination unkown");
+    *mhd_ret = TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_NOT_FOUND,
+      TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
+      GNUNET_h2s (awc->h_denom_pub));
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
 
   qs = TEH_plugin->lookup_auditor_status (
     TEH_plugin->cls,
     session,
-    aws->auditor_pub,
+    awc->auditor_pub,
+    &auditor_url,
     &enabled);
   if (qs < 0)
   {
@@ -117,36 +120,39 @@ add_auditor_denom_sig (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup auditor");
     return qs;
   }
   if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
   {
-    *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_PRECONDITION_FAILED,
-                                           TALER_EC_EXCHANGE_XXX,
-                                           "auditor unkown");
+    *mhd_ret = TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_PRECONDITION_FAILED,
+      TALER_EC_EXCHANGE_AUDITORS_AUDITOR_UNKNOWN,
+      TALER_B2S (awc->auditor_pub));
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
   if (! enabled)
   {
-    *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_GONE,
-                                           TALER_EC_EXCHANGE_XXX,
-                                           "auditor no longer in use");
+    GNUNET_free (auditor_url);
+    *mhd_ret = TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_GONE,
+      TALER_EC_EXCHANGE_AUDITORS_AUDITOR_INACTIVE,
+      TALER_B2S (awc->auditor_pub));
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
   {
     struct TALER_ExchangeKeyValidityPS kv = {
       .purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS),
-      .purpose.size = htonl (kv),
-      .master = TEH_master_public_key.eddsa_pub,
-      .start = meta->start,
+      .purpose.size = htonl (sizeof (kv)),
+      .master = TEH_master_public_key,
+      .start = GNUNET_TIME_absolute_hton (meta.start),
       .expire_withdraw = GNUNET_TIME_absolute_hton (meta.expire_withdraw),
       .expire_deposit = GNUNET_TIME_absolute_hton (meta.expire_deposit),
       .expire_legal = GNUNET_TIME_absolute_hton (meta.expire_legal),
-      .denom_hash = meta->denom_hash
+      .denom_hash = *awc->h_denom_pub
     };
 
     TALER_amount_hton (&kv.value,
@@ -162,19 +168,21 @@ add_auditor_denom_sig (void *cls,
     GNUNET_CRYPTO_hash (auditor_url,
                         strlen (auditor_url) + 1,
                         &kv.auditor_url_hash);
+    GNUNET_free (auditor_url);
     if (GNUNET_OK !=
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
           &kv,
-          &master_sig.eddsa_sig,
+          &awc->auditor_sig.eddsa_sig,
           &TEH_master_public_key.eddsa_pub))
     {
       /* signature invalid */
       GNUNET_break_op (0);
-      *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                             MHD_HTTP_FORBIDDEN,
-                                             TALER_EC_EXCHANGE_XXX,
-                                             NULL);
+      *mhd_ret = TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_FORBIDDEN,
+        TALER_EC_EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID,
+        NULL);
       return GNUNET_DB_STATUS_HARD_ERROR;
     }
   }
@@ -183,7 +191,7 @@ add_auditor_denom_sig (void *cls,
                                              session,
                                              awc->h_denom_pub,
                                              awc->auditor_pub,
-                                             &aws->auditor_sig);
+                                             &awc->auditor_sig);
   if (qs < 0)
   {
     GNUNET_break (0);
@@ -223,6 +231,7 @@ TEH_handler_management_denominations_auditors (
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_DB_QueryStatus qs;
+  MHD_RESULT res;
 
   {
     enum GNUNET_GenericReturnValue res;
diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c 
b/src/exchange/taler-exchange-httpd_management_auditors.c
index 4d4d411e..adfe94d9 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors.c
@@ -81,6 +81,7 @@ add_auditor (void *cls,
 {
   struct AddAuditorContext *aac = cls;
   struct GNUNET_TIME_Absolute last_date;
+  enum GNUNET_DB_QueryStatus qs;
 
   qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
                                              session,
@@ -93,16 +94,16 @@ add_auditor (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup auditor");
     return qs;
   }
-  if (last_date.abs_value_us > aac->start_date.abs_value_us)
+  if (last_date.abs_value_us > aac->validity_start.abs_value_us)
   {
     *mhd_ret = TALER_MHD_reply_with_error (
       connection,
       MHD_HTTP_CONFLICT,
-      TALER_EC_EXCHANGE_AUDITOR_MORE_RECENT_PRESENT,
+      TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT,
       NULL);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
@@ -111,14 +112,14 @@ add_auditor (void *cls,
                                      session,
                                      &aac->auditor_pub,
                                      aac->auditor_url,
-                                     aac->start_date,
+                                     aac->validity_start,
                                      &aac->master_sig);
   else
     qs = TEH_plugin->update_auditor (TEH_plugin->cls,
                                      session,
                                      &aac->auditor_pub,
                                      aac->auditor_url,
-                                     aac->start_date,
+                                     aac->validity_start,
                                      &aac->master_sig,
                                      true);
   if (qs < 0)
@@ -163,6 +164,7 @@ TEH_handler_management_auditors (
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_DB_QueryStatus qs;
+  MHD_RESULT res;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -180,25 +182,25 @@ TEH_handler_management_auditors (
       .purpose.purpose = htonl (
         TALER_SIGNATURE_MASTER_ADD_AUDITOR),
       .purpose.size = htonl (sizeof (aa)),
-      .start_date = GNUNET_TIME_absolute_hton (validity_start),
-      .auditor_pub = *auditor_pub
+      .start_date = GNUNET_TIME_absolute_hton (aac.validity_start),
+      .auditor_pub = aac.auditor_pub
     };
 
-    GNUNET_CRYPTO_hash (auditor_url,
-                        strlen (auditor_url) + 1,
+    GNUNET_CRYPTO_hash (aac.auditor_url,
+                        strlen (aac.auditor_url) + 1,
                         &aa.h_auditor_url);
     if (GNUNET_OK !=
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_ADD_AUDITOR,
           &aa,
-          &master_sig.eddsa_sig,
+          &aac.master_sig.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_AUDITOR_ADD_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID,
         NULL);
     }
   }
diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c 
b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
index 043482be..60f0f539 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
@@ -81,6 +81,7 @@ del_auditor (void *cls,
 {
   struct DelAuditorContext *dac = cls;
   struct GNUNET_TIME_Absolute last_date;
+  enum GNUNET_DB_QueryStatus qs;
 
   qs = TEH_plugin->lookup_auditor_timestamp (TEH_plugin->cls,
                                              session,
@@ -93,16 +94,16 @@ del_auditor (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup auditor");
     return qs;
   }
-  if (last_date.abs_value_us > dac->end_date.abs_value_us)
+  if (last_date.abs_value_us > dac->validity_end.abs_value_us)
   {
     *mhd_ret = TALER_MHD_reply_with_error (
       connection,
       MHD_HTTP_CONFLICT,
-      TALER_EC_EXCHANGE_AUDITOR_MORE_RECENT_PRESENT,
+      TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT,
       NULL);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
@@ -111,7 +112,7 @@ del_auditor (void *cls,
     *mhd_ret = TALER_MHD_reply_with_error (
       connection,
       MHD_HTTP_NOT_FOUND,
-      TALER_EC_EXCHANGE_AUDITOR_NOT_FOUND,
+      TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND,
       NULL);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
@@ -119,7 +120,7 @@ del_auditor (void *cls,
                                    session,
                                    &dac->auditor_pub,
                                    "",
-                                   dac->end_date,
+                                   dac->validity_end,
                                    &dac->master_sig,
                                    false);
   if (qs < 0)
@@ -162,6 +163,7 @@ TEH_handler_management_auditors_AP_disable (
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_DB_QueryStatus qs;
+  MHD_RESULT res;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -179,22 +181,22 @@ TEH_handler_management_auditors_AP_disable (
       .purpose.purpose = htonl (
         TALER_SIGNATURE_MASTER_DEL_AUDITOR),
       .purpose.size = htonl (sizeof (da)),
-      .end_date = GNUNET_TIME_absolute_hton (validity_end),
-      .auditor_pub = *auditor_pub
+      .end_date = GNUNET_TIME_absolute_hton (dac.validity_end),
+      .auditor_pub = dac.auditor_pub
     };
 
     if (GNUNET_OK !=
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_DEL_AUDITOR,
           &da,
-          &master_sig.eddsa_sig,
+          &dac.master_sig.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_AUDITOR_DEL_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID,
         NULL);
     }
   }
diff --git 
a/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c 
b/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c
index 990dd2e3..bd4b5f34 100644
--- a/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c
+++ b/src/exchange/taler-exchange-httpd_management_denominations_HDP_revoke.c
@@ -76,14 +76,14 @@ TEH_handler_management_denominations_HDP_revoke (
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED,
           &rm,
-          &master_sig.eddsa_sig,
+          &master_sig.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_DENOMINATION_REVOKE_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID,
         NULL);
     }
   }
diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c 
b/src/exchange/taler-exchange-httpd_management_post_keys.c
index ab7afd34..4d5a65af 100644
--- a/src/exchange/taler-exchange-httpd_management_post_keys.c
+++ b/src/exchange/taler-exchange-httpd_management_post_keys.c
@@ -26,9 +26,8 @@
 #include <pthread.h>
 #include "taler_json_lib.h"
 #include "taler_mhd_lib.h"
-#include "taler-exchange-httpd_refund.h"
+#include "taler_signatures.h"
 #include "taler-exchange-httpd_responses.h"
-#include "taler-exchange-httpd_keystate.h"
 
 
 /**
@@ -126,7 +125,7 @@ add_keys (void *cls,
     bool is_active = false;
     struct TALER_EXCHANGEDB_DenominationKeyMetaData meta;
 
-    qs = TEH_plugin->lookup_future_deomination_key (
+    qs = TEH_plugin->lookup_future_denomination_key (
       TEH_plugin->cls,
       session,
       &akc->d_sigs[i].h_denom_pub,
@@ -134,7 +133,7 @@ add_keys (void *cls,
     if (0 == qs)
     {
       /* For idempotency, check if the key is already active */
-      qs = TEH_plugin->lookup_deomination_key (
+      qs = TEH_plugin->lookup_denomination_key (
         TEH_plugin->cls,
         session,
         &akc->d_sigs[i].h_denom_pub,
@@ -148,17 +147,17 @@ add_keys (void *cls,
       GNUNET_break (0);
       *mhd_ret = TALER_MHD_reply_with_error (connection,
                                              MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                             TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                             TALER_EC_GENERIC_DB_FETCH_FAILED,
                                              "lookup denomination key");
       return qs;
     }
     if (0 == qs)
     {
-      *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                             MHD_HTTP_NOT_FOUND,
-                                             TALER_EC_GENERIC_DENOM_UNKNOWN,
-                                             GNUNET_h2s (
-                                               &aks->d_sigs[i].h_denom_pub));
+      *mhd_ret = TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_NOT_FOUND,
+        TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
+        GNUNET_h2s (&akc->d_sigs[i].h_denom_pub));
       return qs;
     }
 
@@ -190,20 +189,20 @@ add_keys (void *cls,
           GNUNET_CRYPTO_eddsa_verify (
             TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
             &dkv,
-            &akc->d_sigs[i].master_sig.eddsa_sig,
+            &akc->d_sigs[i].master_sig.eddsa_signature,
             &TEH_master_public_key.eddsa_pub))
       {
         GNUNET_break_op (0);
         return TALER_MHD_reply_with_error (
           connection,
           MHD_HTTP_FORBIDDEN,
-          TALER_EC_EXCHANGE_KEYS_ADD_SIGNATURE_INVALID,
-          GNUNET_h2s (&aks->d_sigs[i].h_denom_pub));
+          TALER_EC_EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID,
+          GNUNET_h2s (&akc->d_sigs[i].h_denom_pub));
       }
     }
     if (is_active)
       continue; /* skip, already known */
-    qs = TEH_plugin->activate_deomination_key (
+    qs = TEH_plugin->activate_denomination_key (
       TEH_plugin->cls,
       session,
       &akc->d_sigs[i].h_denom_pub,
@@ -252,17 +251,17 @@ add_keys (void *cls,
       GNUNET_break (0);
       *mhd_ret = TALER_MHD_reply_with_error (connection,
                                              MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                             TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                             TALER_EC_GENERIC_DB_FETCH_FAILED,
                                              "lookup signing key");
       return qs;
     }
     if (0 == qs)
     {
-      *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                             MHD_HTTP_NOT_FOUND,
-                                             TALER_EC_GENERIC_SIGNKEY_UNKNOWN,
-                                             TALER_B2S (
-                                               &aks->s_sigs[i].exchange_pub));
+      *mhd_ret = TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_NOT_FOUND,
+        TALER_EC_EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN,
+        TALER_B2S (&akc->s_sigs[i].exchange_pub));
       return qs;
     }
 
@@ -271,27 +270,27 @@ add_keys (void *cls,
       struct TALER_ExchangeSigningKeyValidityPS skv = {
         .purpose.purpose = htonl (
           TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY),
-        .purpose.size = htonl (sizeof (dkv)),
+        .purpose.size = htonl (sizeof (skv)),
         .master_public_key = TEH_master_public_key,
         .start = x,
         .expire = y,
         .end = z,
-        .signkey_pub = akc->d_sigs[i].exchange_pub
+        .signkey_pub = akc->s_sigs[i].exchange_pub
       };
 
       if (GNUNET_OK !=
           GNUNET_CRYPTO_eddsa_verify (
             TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
             &skv,
-            &akc->s_sigs[i].master_sig.eddsa_sig,
+            &akc->s_sigs[i].master_sig.eddsa_signature,
             &TEH_master_public_key.eddsa_pub))
       {
         GNUNET_break_op (0);
         return TALER_MHD_reply_with_error (
           connection,
           MHD_HTTP_FORBIDDEN,
-          TALER_EC_EXCHANGE_KEYS_ADD_SIGNATURE_INVALID,
-          GNUNET_h2s (&aks->d_sigs[i].h_denom_pub));
+          TALER_EC_EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID,
+          GNUNET_h2s (&akc->d_sigs[i].h_denom_pub));
       }
     }
     if (is_active)
@@ -365,7 +364,7 @@ TEH_handler_management_post_keys (
     return TALER_MHD_reply_with_error (
       connection,
       MHD_HTTP_BAD_REQUEST,
-      TALER_EC_XXX,
+      TALER_EC_GENERIC_PARAMETER_MALFORMED,
       "array expected for denom_sigs and signkey_sigs");
   }
   akc.nd_sigs = json_array_size (denom_sigs);
@@ -375,7 +374,7 @@ TEH_handler_management_post_keys (
   for (unsigned int i = 0; i<akc.nd_sigs; i++)
   {
     struct DenomSig *d = &akc.d_sigs[i];
-    struct GNUNET_JSON_Specification spec[] = {
+    struct GNUNET_JSON_Specification ispec[] = {
       GNUNET_JSON_spec_fixed_auto ("master_sig",
                                    &d->master_sig),
       GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
@@ -385,9 +384,9 @@ TEH_handler_management_post_keys (
     enum GNUNET_GenericReturnValue res;
 
     res = TALER_MHD_parse_json_data (connection,
-                                     root,
                                      json_array_get (denom_sigs,
-                                                     i));
+                                                     i),
+                                     ispec);
     if (GNUNET_SYSERR == res)
     {
       ret = MHD_NO; /* hard failure */
@@ -412,7 +411,7 @@ TEH_handler_management_post_keys (
   for (unsigned int i = 0; i<akc.nd_sigs; i++)
   {
     struct SigningSig *s = &akc.s_sigs[i];
-    struct GNUNET_JSON_Specification spec[] = {
+    struct GNUNET_JSON_Specification ispec[] = {
       GNUNET_JSON_spec_fixed_auto ("master_sig",
                                    &s->master_sig),
       GNUNET_JSON_spec_fixed_auto ("exchange_pub",
@@ -422,9 +421,9 @@ TEH_handler_management_post_keys (
     enum GNUNET_GenericReturnValue res;
 
     res = TALER_MHD_parse_json_data (connection,
-                                     root,
                                      json_array_get (signkey_sigs,
-                                                     i));
+                                                     i),
+                                     ispec);
     if (GNUNET_SYSERR == res)
     {
       ret = MHD_NO; /* hard failure */
@@ -446,11 +445,11 @@ TEH_handler_management_post_keys (
   }
   qs = TEH_DB_run_transaction (connection,
                                "add keys",
-                               &res,
+                               &ret,
                                &add_keys,
                                &akc);
   if (qs < 0)
-    return res;
+    return ret;
   return TALER_MHD_reply_static (
     connection,
     MHD_HTTP_NO_CONTENT,
diff --git a/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c 
b/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c
index 4fc190b3..bbe3ae10 100644
--- a/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c
+++ b/src/exchange/taler-exchange-httpd_management_signkey_EP_revoke.c
@@ -64,7 +64,7 @@ TEH_handler_management_signkeys_EP_revoke (
       return MHD_YES; /* failure */
   }
   {
-    struct TALER_MasterDenominationKeyRevocationPS rm = {
+    struct TALER_MasterSigningKeyRevocationPS rm = {
       .purpose.purpose = htonl (
         TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED),
       .purpose.size = htonl (sizeof (rm)),
@@ -75,14 +75,14 @@ TEH_handler_management_signkeys_EP_revoke (
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED,
           &rm,
-          &master_sig.eddsa_sig,
+          &master_sig.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_SIGNKEY_REVOKE_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID,
         NULL);
     }
   }
diff --git a/src/exchange/taler-exchange-httpd_management_wire.c 
b/src/exchange/taler-exchange-httpd_management_wire.c
index a841a1e6..812570fc 100644
--- a/src/exchange/taler-exchange-httpd_management_wire.c
+++ b/src/exchange/taler-exchange-httpd_management_wire.c
@@ -26,9 +26,9 @@
 #include <pthread.h>
 #include "taler_json_lib.h"
 #include "taler_mhd_lib.h"
-#include "taler-exchange-httpd_refund.h"
+#include "taler_signatures.h"
 #include "taler-exchange-httpd_responses.h"
-#include "taler-exchange-httpd_keystate.h"
+
 
 /**
  * Closure for the #add_wire transaction.
@@ -50,7 +50,7 @@ struct AddWireContext
   /**
    * Payto:// URI this is about.
    */
-  const char *payto_url;
+  const char *payto_uri;
 
   /**
    * Timestamp for checking against replay attacks.
@@ -83,6 +83,7 @@ add_wire (void *cls,
 {
   struct AddWireContext *awc = cls;
   struct GNUNET_TIME_Absolute last_date;
+  enum GNUNET_DB_QueryStatus qs;
 
   qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
                                           session,
@@ -95,31 +96,30 @@ add_wire (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup wire");
     return qs;
   }
-  if (last_date.abs_value_us > awc->start_date.abs_value_us)
+  if (last_date.abs_value_us > awc->validity_start.abs_value_us)
   {
     *mhd_ret = TALER_MHD_reply_with_error (
       connection,
       MHD_HTTP_CONFLICT,
-      TALER_EC_EXCHANGE_WIRE_MORE_RECENT_PRESENT,
+      TALER_EC_EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT,
       NULL);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
   if (0 == qs)
     qs = TEH_plugin->insert_wire (TEH_plugin->cls,
                                   session,
-                                  &awc->payto_uri,
-                                  awc->start_date,
-                                  &awc->master_sig_add);
+                                  awc->payto_uri,
+                                  awc->validity_start,
+                                  &awc->master_sig_wire);
   else
     qs = TEH_plugin->update_wire (TEH_plugin->cls,
                                   session,
-                                  &awc->payto_uri,
-                                  awc->start_date,
-                                  &awc->master_sig_add,
+                                  awc->payto_uri,
+                                  awc->validity_start,
                                   true);
   if (qs < 0)
   {
@@ -132,21 +132,6 @@ add_wire (void *cls,
                                            "add wire");
     return qs;
   }
-  qs = TEH_plugin->insert_wire_details (TEH_plugin->cls,
-                                        session,
-                                        &awc->payto_uri,
-                                        &awc->master_sig_wire);
-  if (qs < 0)
-  {
-    GNUNET_break (0);
-    if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-      return qs;
-    *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_STORE_FAILED,
-                                           "add wire details");
-    return qs;
-  }
   return qs;
 }
 
@@ -176,6 +161,7 @@ TEH_handler_management_denominations_wire (
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_DB_QueryStatus qs;
+  MHD_RESULT ret;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -190,10 +176,9 @@ TEH_handler_management_denominations_wire (
   }
   {
     struct TALER_MasterAddWirePS aw = {
-      .purpose.purpose = htonl (
-        TALER_SIGNATURE_MASTER_ADD_WIRE),
+      .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE),
       .purpose.size = htonl (sizeof (aw)),
-      .start_date = GNUNET_TIME_absolute_hton (validity_start),
+      .start_date = GNUNET_TIME_absolute_hton (awc.validity_start),
     };
 
     GNUNET_CRYPTO_hash (awc.payto_uri,
@@ -203,14 +188,14 @@ TEH_handler_management_denominations_wire (
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_ADD_WIRE,
           &aw,
-          &master_sig.eddsa_sig,
+          &awc.master_sig_add.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_WIRE_ADD_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID,
         NULL);
     }
   }
@@ -223,30 +208,30 @@ TEH_handler_management_denominations_wire (
 
     GNUNET_CRYPTO_hash (awc.payto_uri,
                         strlen (awc.payto_uri) + 1,
-                        &wd.h_wire);
+                        &wd.h_wire_details);
     if (GNUNET_OK !=
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_WIRE_DETAILS,
           &wd,
-          &master_sig.eddsa_sig,
+          &awc.master_sig_wire.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_WIRE_DETALS_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID,
         NULL);
     }
   }
 
   qs = TEH_DB_run_transaction (connection,
                                "add wire",
-                               &res,
+                               &ret,
                                &add_wire,
                                &awc);
   if (qs < 0)
-    return res;
+    return ret;
   return TALER_MHD_reply_static (
     connection,
     MHD_HTTP_NO_CONTENT,
diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c 
b/src/exchange/taler-exchange-httpd_management_wire_disable.c
index af6b2e56..19a30fc2 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c
@@ -44,12 +44,12 @@ struct DelWireContext
   /**
    * Payto:// URI this is about.
    */
-  const char *payto_url;
+  const char *payto_uri;
 
   /**
    * Timestamp for checking against replay attacks.
    */
-  struct GNUNET_TIME_Absolute validity_start;
+  struct GNUNET_TIME_Absolute validity_end;
 
 };
 
@@ -77,11 +77,12 @@ del_wire (void *cls,
 {
   struct DelWireContext *awc = cls;
   struct GNUNET_TIME_Absolute last_date;
+  enum GNUNET_DB_QueryStatus qs;
 
-  qs = TEH_plugin->lookup_wire (TEH_plugin->cls,
-                                session,
-                                awc->payto_uri,
-                                &last_date);
+  qs = TEH_plugin->lookup_wire_timestamp (TEH_plugin->cls,
+                                          session,
+                                          awc->payto_uri,
+                                          &last_date);
   if (qs < 0)
   {
     if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -89,46 +90,33 @@ del_wire (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup wire");
     return qs;
   }
-  if (last_date.abs_value_us > awc->start_date.abs_value_us)
+  if (last_date.abs_value_us > awc->validity_end.abs_value_us)
   {
     *mhd_ret = TALER_MHD_reply_with_error (
       connection,
       MHD_HTTP_CONFLICT,
-      TALER_EC_EXCHANGE_WIRE_MORE_RECENT_PRESENT,
+      TALER_EC_EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT,
       NULL);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
   if (0 == qs)
-    qs = TEH_plugin->insert_wire (TEH_plugin->cls,
-                                  session,
-                                  &awc->payto_uri,
-                                  awc->end_date,
-                                  &awc->master_sig_del);
-  else
-    qs = TEH_plugin->update_wire (TEH_plugin->cls,
-                                  session,
-                                  &awc->payto_uri,
-                                  awc->end_date,
-                                  &awc->master_sig_del,
-                                  false);
-  if (qs < 0)
   {
-    GNUNET_break (0);
-    if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-      return qs;
-    *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                           MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_STORE_FAILED,
-                                           "del wire");
-    return qs;
+    *mhd_ret = TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_NOT_FOUND,
+      TALER_EC_EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND,
+      NULL);
+    return GNUNET_DB_STATUS_HARD_ERROR;
   }
-  qs = TEH_plugin->delete_wire_details (TEH_plugin->cls,
-                                        session,
-                                        &awc->payto_uri);
+  qs = TEH_plugin->update_wire (TEH_plugin->cls,
+                                session,
+                                awc->payto_uri,
+                                awc->validity_end,
+                                false);
   if (qs < 0)
   {
     GNUNET_break (0);
@@ -137,7 +125,7 @@ del_wire (void *cls,
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
                                            TALER_EC_GENERIC_DB_STORE_FAILED,
-                                           "del wire details");
+                                           "del wire");
     return qs;
   }
   return qs;
@@ -167,6 +155,7 @@ TEH_handler_management_denominations_wire_disable (
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_DB_QueryStatus qs;
+  MHD_RESULT ret;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -184,7 +173,7 @@ TEH_handler_management_denominations_wire_disable (
       .purpose.purpose = htonl (
         TALER_SIGNATURE_MASTER_DEL_WIRE),
       .purpose.size = htonl (sizeof (aw)),
-      .end_date = GNUNET_TIME_absolute_hton (validity_end),
+      .end_date = GNUNET_TIME_absolute_hton (awc.validity_end),
     };
 
     GNUNET_CRYPTO_hash (awc.payto_uri,
@@ -194,24 +183,24 @@ TEH_handler_management_denominations_wire_disable (
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_DEL_WIRE,
           &aw,
-          &master_sig.eddsa_sig,
+          &awc.master_sig.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (
         connection,
         MHD_HTTP_FORBIDDEN,
-        TALER_EC_EXCHANGE_WIRE_DEL_SIGNATURE_INVALID,
+        TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID,
         NULL);
     }
   }
   qs = TEH_DB_run_transaction (connection,
                                "del wire",
-                               &res,
+                               &ret,
                                &del_wire,
                                &awc);
   if (qs < 0)
-    return res;
+    return ret;
   return TALER_MHD_reply_static (
     connection,
     MHD_HTTP_NO_CONTENT,
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c 
b/src/exchange/taler-exchange-httpd_management_wire_fees.c
index dca489c6..c126f056 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_fees.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c
@@ -26,9 +26,9 @@
 #include <pthread.h>
 #include "taler_json_lib.h"
 #include "taler_mhd_lib.h"
-#include "taler-exchange-httpd_refund.h"
+#include "taler_signatures.h"
 #include "taler-exchange-httpd_responses.h"
-#include "taler-exchange-httpd_keystate.h"
+
 
 /**
  * Closure for the #add_fee transaction.
@@ -94,12 +94,12 @@ add_fee (void *cls,
   struct TALER_Amount wire_fee;
   struct TALER_Amount closing_fee;
 
-  qs = TEH_plugin->lookup_wire_fee (
+  qs = TEH_plugin->lookup_wire_fee_by_time (
     TEH_plugin->cls,
     session,
-    aws->wire_method,
-    aws->start_time,
-    aws->end_time,
+    afc->wire_method,
+    afc->start_time,
+    afc->end_time,
     &wire_fee,
     &closing_fee);
   if (qs < 0)
@@ -109,7 +109,7 @@ add_fee (void *cls,
     GNUNET_break (0);
     *mhd_ret = TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                           TALER_EC_GENERIC_DB_LOOKUP_FAILED,
+                                           TALER_EC_GENERIC_DB_FETCH_FAILED,
                                            "lookup wire fee");
     return qs;
   }
@@ -129,10 +129,11 @@ add_fee (void *cls,
     }
     else
     {
-      *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                             MHD_HTTP_CONFLICT,
-                                             TALER_EC_XXX,
-                                             NULL);
+      *mhd_ret = TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_CONFLICT,
+        TALER_EC_EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH,
+        NULL);
     }
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
@@ -140,12 +141,12 @@ add_fee (void *cls,
   qs = TEH_plugin->insert_wire_fee (
     TEH_plugin->cls,
     session,
-    aws->wire_method,
-    aws->start_time,
-    aws->end_time,
-    &aws->wire_fee,
-    &aws->closing_fee,
-    &aws->master_sig);
+    afc->wire_method,
+    afc->start_time,
+    afc->end_time,
+    &afc->wire_fee,
+    &afc->closing_fee,
+    &afc->master_sig);
   if (qs < 0)
   {
     if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
@@ -179,10 +180,10 @@ TEH_handler_management_post_wire_fees (
                                  &afc.master_sig),
     GNUNET_JSON_spec_string ("wire_method",
                              &afc.wire_method),
-    TALER_JSON_spec_time_abs ("fee_start",
-                              &afc.start_time),
-    TALER_JSON_spec_time_abs ("fee_end",
-                              &afc.end_time),
+    TALER_JSON_spec_absolute_time ("fee_start",
+                                   &afc.start_time),
+    TALER_JSON_spec_absolute_time ("fee_end",
+                                   &afc.end_time),
     TALER_JSON_spec_amount ("closing_fee",
                             &afc.closing_fee),
     TALER_JSON_spec_amount ("wire_fee",
@@ -190,6 +191,7 @@ TEH_handler_management_post_wire_fees (
     GNUNET_JSON_spec_end ()
   };
   enum GNUNET_DB_QueryStatus qs;
+  MHD_RESULT ret;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -211,7 +213,7 @@ TEH_handler_management_post_wire_fees (
     GNUNET_break_op (0);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
-                                       TALER_EC_GENERIC_BAD_CURRENCY,
+                                       TALER_EC_GENERIC_CURRENCY_MISMATCH,
                                        NULL);
   }
   if (0 !=
@@ -221,21 +223,21 @@ TEH_handler_management_post_wire_fees (
     /* currency does not match exchange's currency */
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_PRECONDITION_FAILED,
-                                       TALER_EC_GENERIC_BAD_CURRENCY,
+                                       TALER_EC_GENERIC_CURRENCY_MISMATCH,
                                        TEH_currency);
   }
 
   {
     struct TALER_MasterWireFeePS wf = {
       .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES),
-      .purpose.size = htonl (wf),
-      .start_date = GNUNET_TIME_absolute_hton (afc.start_date),
-      .end_date = GNUNET_TIME_absolute_hton (afc.end_date),
+      .purpose.size = htonl (sizeof (wf)),
+      .start_date = GNUNET_TIME_absolute_hton (afc.start_time),
+      .end_date = GNUNET_TIME_absolute_hton (afc.end_time),
     };
 
-    TALER_amount_hton (&kv.wire_fee,
+    TALER_amount_hton (&wf.wire_fee,
                        &afc.wire_fee);
-    TALER_amount_hton (&kv.closing_fee,
+    TALER_amount_hton (&wf.closing_fee,
                        &afc.closing_fee);
     GNUNET_CRYPTO_hash (afc.wire_method,
                         strlen (afc.wire_method) + 1,
@@ -244,26 +246,26 @@ TEH_handler_management_post_wire_fees (
         GNUNET_CRYPTO_eddsa_verify (
           TALER_SIGNATURE_MASTER_WIRE_FEES,
           &wf,
-          &afc.master_sig.eddsa_sig,
+          &afc.master_sig.eddsa_signature,
           &TEH_master_public_key.eddsa_pub))
     {
       /* signature invalid */
       GNUNET_break_op (0);
-      *mhd_ret = TALER_MHD_reply_with_error (connection,
-                                             MHD_HTTP_FORBIDDEN,
-                                             TALER_EC_EXCHANGE_XXX,
-                                             NULL);
-      return GNUNET_DB_STATUS_HARD_ERROR;
+      return TALER_MHD_reply_with_error (
+        connection,
+        MHD_HTTP_FORBIDDEN,
+        TALER_EC_EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID,
+        NULL);
     }
   }
 
   qs = TEH_DB_run_transaction (connection,
                                "add wire fee",
-                               &res,
+                               &ret,
                                &add_fee,
                                &afc);
   if (qs < 0)
-    return res;
+    return ret;
   return TALER_MHD_reply_static (
     connection,
     MHD_HTTP_NO_CONTENT,
diff --git a/src/exchangedb/exchange-0002.sql b/src/exchangedb/exchange-0002.sql
index 04f1a362..21b8adc7 100644
--- a/src/exchangedb/exchange-0002.sql
+++ b/src/exchangedb/exchange-0002.sql
@@ -141,6 +141,8 @@ COMMENT ON TABLE wire_accounts
   IS 'Table with current and historic bank accounts of the exchange. Entries 
never expire as we need to remember the last_change column indefinitely.';
 COMMENT ON COLUMN wire_accounts.payto_uri
   IS 'payto URI (RFC 8905) with the bank account of the exchange.';
+COMMENT ON COLUMN wire_accounts.master_sig
+  IS 'Signature of purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS';
 COMMENT ON COLUMN wire_accounts.is_active
   IS 'true if we are currently supporting the use of this account.';
 COMMENT ON COLUMN wire_accounts.last_change
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 60ad0e65..400d6a72 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -2977,7 +2977,8 @@ struct TALER_EXCHANGEDB_Plugin
    * @param cls closure
    * @param session a session
    * @param auditor_pub key to look up information for
-   * @param[out] set to the base URL of the auditor's REST API
+   * @param[out] set to the base URL of the auditor's REST API; memory to be
+   *            released by the caller!
    * @param[out] enabled set if the auditor is currently in use
    * @return transaction status code
    */
@@ -2985,7 +2986,7 @@ struct TALER_EXCHANGEDB_Plugin
   (*lookup_auditor_status)(void *cls,
                            struct TALER_EXCHANGEDB_Session *session,
                            const struct TALER_AuditorPublicKeyP *auditor_pub,
-                           char *auditor_url,
+                           char **auditor_url,
                            bool *enabled);
 
 
@@ -3057,7 +3058,8 @@ struct TALER_EXCHANGEDB_Plugin
    * @param payto_uri wire account of the exchange
    * @param start_date date when the account was added by the offline system
    *                      (only to be used for replay detection)
-   * @param master_sig signature affirming the addition of the account
+   * @param master_sig public signature affirming the existence of the account,
+   *         must be of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS
    * @return transaction status code
    */
   enum GNUNET_DB_QueryStatus
@@ -3076,7 +3078,6 @@ struct TALER_EXCHANGEDB_Plugin
    * @param payto_uri account the update is about
    * @param change_date date when the account status was last changed
    *                      (only to be used for replay detection)
-   * @param master_sig signature affirming the change in status (enable or 
disable)
    * @param enabled true to enable, false to disable (the actual change)
    * @return transaction status code
    */
@@ -3085,7 +3086,6 @@ struct TALER_EXCHANGEDB_Plugin
                  struct TALER_EXCHANGEDB_Session *session,
                  const char *payto_uri,
                  struct GNUNET_TIME_Absolute change_date,
-                 const struct TALER_MasterSignatureP *master_sig,
                  bool enabled);
 
 

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