gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 01/02: import GANA for error codes


From: gnunet
Subject: [taler-anastasis] 01/02: import GANA for error codes
Date: Sun, 07 Feb 2021 15:01:09 +0100

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

grothoff pushed a commit to branch master
in repository anastasis.

commit 2e67500a07560b977b4680a697eac98ec340ba81
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 7 15:00:53 2021 +0100

    import GANA for error codes
---
 .gitmodules                                    |   3 +
 bootstrap                                      |   3 +
 contrib/Makefile.am                            |   4 +-
 contrib/gana                                   |   1 +
 contrib/gana-update.sh                         |  11 +
 contrib/gana.sh                                |  12 +
 src/backend/anastasis-httpd.c                  |   3 +-
 src/backend/anastasis-httpd.h                  |   2 +-
 src/backend/anastasis-httpd_truth.c            |  39 +--
 src/backend/anastasis_authorization_plugin.c   |   5 +-
 src/cli/anastasis-cli-redux.c                  |   6 +-
 src/include/Makefile.am                        |   2 +-
 src/include/anastasis.h                        |   4 +-
 src/include/anastasis_authorization_lib.h      |   3 +-
 src/include/anastasis_authorization_plugin.h   |   4 -
 src/include/anastasis_crypto_lib.h             |   2 -
 src/include/anastasis_database_lib.h           |   1 -
 src/include/anastasis_database_plugin.h        |   5 +-
 src/include/anastasis_error_codes.h            |  74 -----
 src/include/anastasis_json.h                   |   4 +-
 src/include/anastasis_redux.h                  |   8 +-
 src/include/anastasis_service.h                |   8 +-
 src/include/anastasis_util_lib.h               |   4 +
 src/lib/anastasis_backup.c                     |   5 +-
 src/reducer/anastasis_api_backup_redux.c       |  82 +++--
 src/reducer/anastasis_api_recovery_redux.c     |  22 +-
 src/reducer/anastasis_api_redux.c              |  30 +-
 src/restclient/anastasis_api_challenge_run.c   |   6 -
 src/restclient/anastasis_api_config.c          |   7 +-
 src/restclient/anastasis_api_curl_defaults.c   |   3 +-
 src/restclient/anastasis_api_curl_defaults.h   |   5 +-
 src/restclient/anastasis_api_keyshare_lookup.c |   6 -
 src/restclient/anastasis_api_policy_lookup.c   |   7 +-
 src/restclient/anastasis_api_policy_store.c    |  28 +-
 src/restclient/anastasis_api_truth_store.c     |   6 -
 src/stasis/anastasis-dbinit.c                  |   3 -
 src/stasis/anastasis_db_plugin.c               |   1 -
 src/stasis/plugin_anastasis_postgres.c         | 396 ++++++++++---------------
 src/stasis/test_anastasis_db.c                 |  10 +-
 src/testing/.gitignore                         |   2 +
 src/testing/Makefile.am                        |  33 +--
 src/testing/test_anastasis.c                   |  33 +--
 src/testing/test_anastasis_api.c               | 227 ++++++--------
 src/testing/testing_api_cmd_policy_store.c     |  14 -
 src/testing/testing_api_cmd_truth_store.c      |   2 +-
 src/testing/testing_api_helpers.c              |   1 -
 src/testing/testing_cmd_policy_create.c        |  54 +---
 src/testing/testing_cmd_truth_upload.c         |   2 +-
 src/util/Makefile.am                           |   4 +-
 49 files changed, 440 insertions(+), 757 deletions(-)

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..16d1fe5
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "contrib/gana"]
+       path = contrib/gana
+       url = git://git.gnunet.org/gana
diff --git a/bootstrap b/bootstrap
index 65d653e..92369ef 100755
--- a/bootstrap
+++ b/bootstrap
@@ -8,6 +8,9 @@ fi
 echo "$0: Updating submodules"
 echo | git submodule update --init
 
+./contrib/gana.sh
+
+
 # This is more portable than `which' but comes with
 # the caveat of not(?) properly working on busybox's ash:
 existence()
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 279726b..cac4125 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -7,7 +7,9 @@ pkgdatadir= $(prefix)/share/anastasis/
 
 EXTRA_DIST = \
   $(pkgdata_DATA) \
-  pogen.sh
+  pogen.sh \
+  gana.sh \
+  gana-update.sh
 
 pkgdata_DATA = \
   redux.ch.json \
diff --git a/contrib/gana b/contrib/gana
new file mode 160000
index 0000000..df16026
--- /dev/null
+++ b/contrib/gana
@@ -0,0 +1 @@
+Subproject commit df1602616af682c4960d08784b7acba5896dcc81
diff --git a/contrib/gana-update.sh b/contrib/gana-update.sh
new file mode 100755
index 0000000..94b2719
--- /dev/null
+++ b/contrib/gana-update.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Helper script to recompute error codes based on submodule
+# Run from exchange/ main directory.
+set -eu
+
+# Generate taler-error-codes.h in gana and copy it to
+# src/include/taler_error_codes.h
+cd contrib/gana/gnu-taler-error-codes
+make
+cd ../../..
+cat contrib/gana/gnu-taler-error-codes/taler_error_codes.h | sed -e 
"s/GNU_TALER_ERROR_CODES_H/GNU_ANASTASIS_ERROR_CODES_H/" -e 
"s/taler_error_codes.h/anastasis_error_codes.h/" > 
src/include/anastasis_error_codes.h
diff --git a/contrib/gana.sh b/contrib/gana.sh
new file mode 100755
index 0000000..1055d77
--- /dev/null
+++ b/contrib/gana.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Helper script to update to latest GANA
+# Run from exchange/ main directory.
+set -eu
+
+git submodule update --init
+
+cd contrib/gana
+git pull origin master
+cd ../..
+
+./contrib/gana-update.sh
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 155ed16..a426894 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -22,8 +22,6 @@
  */
 #include "platform.h"
 #include <microhttpd.h>
-#include <gnunet/gnunet_util_lib.h>
-#include <taler/taler_mhd_lib.h>
 #include "anastasis-httpd.h"
 #include "anastasis_util_lib.h"
 #include "anastasis-httpd_mhd.h"
@@ -33,6 +31,7 @@
 #include "anastasis-httpd_salt.h"
 #include "anastasis-httpd_terms.h"
 #include "anastasis-httpd_config.h"
+#include <taler/taler_mhd_lib.h>
 
 
 /**
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index a8f2655..317a9f3 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -22,9 +22,9 @@
 #define ANASTASIS_HTTPD_H
 
 #include "platform.h"
+#include "anastasis_database_lib.h"
 #include <microhttpd.h>
 #include <taler/taler_mhd_lib.h>
-#include "anastasis_database_lib.h"
 #include <gnunet/gnunet_mhd_compat.h>
 
 
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 6169ab9..362835d 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2019 GNUnet e.V.
+  Copyright (C) 2019, 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
@@ -655,7 +655,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
       gc->resp = NULL;
       return ret;
     }
-    if (gc->as != NULL)
+    if (NULL != gc->as)
     {
       enum ANASTASIS_AUTHORIZATION_Result ret;
 
@@ -790,12 +790,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
     {
       return MHD_HTTP_NOT_FOUND;
     }
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Encrypted truth from db: %s\n",
-                TALER_b2s (encrypted_truth, encrypted_truth_size));
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Encrypted truth size from db: %lu\n",
-                encrypted_truth_size);
   }
   {
     // decrypt encrypted_truth
@@ -840,14 +834,7 @@ AH_handler_truth_get (struct MHD_Connection *connection,
 
     if (gc->payment_identifier_provided)
     {
-      // check if payment identifier is valid (existing and paid)
-      bool paid;
-
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "At %s:%d Payment-Identifier from header is: %s\n",
-                  __FILE__,
-                  __LINE__,
-                  TALER_B2S (&gc->payment_identifier));
+      bool paid = false;
 
       qs = db->check_challenge_payment (db->cls,
                                         &gc->payment_identifier,
@@ -858,15 +845,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
 
       if ((qs >= 0) && (! paid))
       {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "At %s:%d paid is: '%d'\n",
-                    __FILE__,
-                    __LINE__,
-                    paid);
-        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                    "At %s:%d Payment is required, starting payment 
process.\n",
-                    __FILE__,
-                    __LINE__);
         return begin_payment (gc,
                               GNUNET_YES);
       }
@@ -874,7 +852,6 @@ AH_handler_truth_get (struct MHD_Connection *connection,
 
     if (! gc->payment_identifier_provided)
     {
-      // generate new payment identifier
       GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                                   &gc->payment_identifier,
                                   sizeof (struct ANASTASIS_PaymentSecretP));
@@ -886,7 +863,11 @@ AH_handler_truth_get (struct MHD_Connection *connection,
   {
     // FIXME: queue PROPER reply...
     GNUNET_free (decrypted_truth);
-    return MHD_NO;
+    return TALER_MHD_reply_with_error (connection,
+                                       MHD_HTTP_FORBIDDEN,
+                                       // FIXME: find error code
+                                       TALER_EC_SYNC_BAD_IF_MATCH,
+                                       NULL);
   }
   GNUNET_CRYPTO_hash_from_string (challenge_response_s,
                                   &challenge_response);
@@ -898,10 +879,10 @@ AH_handler_truth_get (struct MHD_Connection *connection,
     {
       GNUNET_break (0);
       return TALER_MHD_reply_with_error (connection,
-                                         MHD_HTTP_BAD_REQUEST,
+                                         MHD_HTTP_FORBIDDEN,
                                          // FIXME: find error code
                                          TALER_EC_SYNC_BAD_IF_MATCH,
-                                         "Authentication failed"); // FIXME: 
How much should we tell?
+                                         challenge_response_s);
     }
     else
     {
diff --git a/src/backend/anastasis_authorization_plugin.c 
b/src/backend/anastasis_authorization_plugin.c
index 63ca51f..447365f 100644
--- a/src/backend/anastasis_authorization_plugin.c
+++ b/src/backend/anastasis_authorization_plugin.c
@@ -20,8 +20,6 @@
  * @author Dominik Meister
  */
 #include "platform.h"
-#include <taler/taler_util.h>
-#include <gnunet/gnunet_util_lib.h>
 #include "anastasis_authorization_plugin.h"
 #include <ltdl.h>
 
@@ -93,6 +91,7 @@ ANASTASIS_authorization_plugin_load (
   return authorization;
 }
 
+
 /**
  * Shutdown the plugin.
  *
@@ -130,6 +129,7 @@ ANASTASIS_authorization_plugin_shutdown (void)
   }
 }
 
+
 /**
  * Libtool search path before we started.
  */
@@ -191,4 +191,5 @@ plugin_fini ()
   lt_dlexit ();
 }
 
+
 /* end of anastasis_authorization_plugin.c */
diff --git a/src/cli/anastasis-cli-redux.c b/src/cli/anastasis-cli-redux.c
index d7689c6..1a8533b 100644
--- a/src/cli/anastasis-cli-redux.c
+++ b/src/cli/anastasis-cli-redux.c
@@ -131,13 +131,13 @@ persist_new_state (json_t *state,
  */
 static void
 action_cb (void *cls,
-           enum ANASTASIS_ErrorCode error_code,
+           enum TALER_ErrorCode error_code,
            json_t *result_state)
 {
   if (NULL != result_state)
     persist_new_state (result_state,
                        output_filename);
-  if (ANASTASIS_EC_NONE != error_code)
+  if (TALER_EC_NONE != error_code)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Redux failed with error %d: %s\n",
@@ -145,7 +145,7 @@ action_cb (void *cls,
                 TALER_JSON_get_error_hint (result_state));
   }
   GNUNET_SCHEDULER_shutdown ();
-  global_ret = (ANASTASIS_EC_NONE != error_code) ? 1 : 0;
+  global_ret = (TALER_EC_NONE != error_code) ? 1 : 0;
 }
 
 
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index d48c611..ac201f6 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -13,5 +13,5 @@ anastasisinclude_HEADERS = \
   anastasis_crypto_lib.h \
   anastasis_redux.h \
   anastasis_authorization_plugin.h \
-       anastasis_authorization_lib.h \
+  anastasis_authorization_lib.h \
   anastasis.h
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 0d83f24..dee8296 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -24,9 +24,9 @@
 #define ANASTASIS_H
 
 #include <gnunet/platform.h>
+#include "anastasis_service.h"
 #include <taler/taler_json_lib.h>
 #include <gnunet/gnunet_util_lib.h>
-#include "anastasis_service.h"
 #include <stdbool.h>
 
 
@@ -465,7 +465,7 @@ struct ANASTASIS_Truth;
  */
 typedef void
 (*ANASTASIS_TruthCallback)(void *cls,
-                           enum ANASTASIS_ErrorCode ec,
+                           enum TALER_ErrorCode ec,
                            struct ANASTASIS_Truth *t,
                            const struct ANASTASIS_UploadDetails *ud);
 
diff --git a/src/include/anastasis_authorization_lib.h 
b/src/include/anastasis_authorization_lib.h
index 6314fa9..efb6b92 100644
--- a/src/include/anastasis_authorization_lib.h
+++ b/src/include/anastasis_authorization_lib.h
@@ -1,6 +1,6 @@
 /*
   This file is part of Anastasis
-  Copyright (C) 2019 Taler Systems SA
+  Copyright (C) 2019, 2021 Taler Systems SA
 
   Anastasis is free software; you can redistribute it and/or modify it under 
the
   terms of the GNU Lesser General Public License as published by the Free 
Software
@@ -23,7 +23,6 @@
 #ifndef ANASTASIS_AUTHORIZATION_LIB_H
 #define ANASTASIS_AUTHORIZATION_LIB_H
 
-#include <taler/taler_util.h>
 #include "anastasis_authorization_plugin.h"
 
 /**
diff --git a/src/include/anastasis_authorization_plugin.h 
b/src/include/anastasis_authorization_plugin.h
index cd21171..c0dffbd 100644
--- a/src/include/anastasis_authorization_plugin.h
+++ b/src/include/anastasis_authorization_plugin.h
@@ -21,11 +21,7 @@
 #ifndef ANASTASIS_AUTHORIZATION_PLUGIN_H
 #define ANASTASIS_AUTHORIZATION_PLUGIN_H
 
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <anastasis_error_codes.h>
 #include "anastasis_service.h"
-#include <jansson.h>
 #include <taler/taler_util.h>
 
 
diff --git a/src/include/anastasis_crypto_lib.h 
b/src/include/anastasis_crypto_lib.h
index f338f88..bad543d 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -20,8 +20,6 @@
  * @author Dominik Meister
  * @author Dennis Neufeld
  */
-
-
 #include <jansson.h>
 #include <gnunet/gnunet_crypto_lib.h>
 
diff --git a/src/include/anastasis_database_lib.h 
b/src/include/anastasis_database_lib.h
index cff4635..f7bfc8d 100644
--- a/src/include/anastasis_database_lib.h
+++ b/src/include/anastasis_database_lib.h
@@ -23,7 +23,6 @@
 #ifndef ANASTASIS_DB_LIB_H
 #define ANASTASIS_DB_LIB_H
 
-#include <taler/taler_util.h>
 #include "anastasis_database_plugin.h"
 
 /**
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index cb4ec1c..0ff68f3 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -21,11 +21,8 @@
 #ifndef ANASTASIS_DATABASE_PLUGIN_H
 #define ANASTASIS_DATABASE_PLUGIN_H
 
-#include <gnunet/gnunet_util_lib.h>
-#include <anastasis_error_codes.h>
 #include "anastasis_service.h"
-#include <jansson.h>
-#include <taler/taler_util.h>
+
 
 /**
  * @brief Specification for a /truth operation.
diff --git a/src/include/anastasis_error_codes.h 
b/src/include/anastasis_error_codes.h
deleted file mode 100644
index a6e051e..0000000
--- a/src/include/anastasis_error_codes.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2019 GNUnet e.V.
-
-   GNUnet 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 of the License,
-   or (at your option) any later version.
-
-   GNUnet 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file anastasis_error_codes.h
- * @brief error codes returned by GNU Taler
- * @author Christian Grothoff
- * @author Dominik Meister
- * @author Dennis Neufeld
- *
- * This file should define constants for error codes returned
- * in Anastasis APIs.  We use codes above 6000 to avoid any
- * confusing with HTTP status codes.  All constants have the
- * shared prefix "ANASTASIS_EC_" to indicate that they are error
- * codes.
- */
-#ifndef ANASTASIS_ERROR_CODES_H
-#define ANASTASIS_ERROR_CODES_H
-
-
-/**
- * Enumeration with all possible Anastasis error codes.
-*/
-enum ANASTASIS_ErrorCode
-{
-  /**
-   * Special code to indicate no error (or no "code" present).
-   */
-  ANASTASIS_EC_NONE = 6000,
-
-  /**
-   * Special code to indicate that a non-integer error code was
-   * returned in the JSON response.
-   */
-  ANASTASIS_EC_INVALID = 6001,
-
-  /**
-   * Special code to indicate that a parameter in the request was malformed.
-   */
-  ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED = 6002,
-
-  /**
-   * The specified User was unknown
-   */
-  ANASTASIS_EC_DB_STATUS_UNKNOWN_USER = 6100,
-
-  /**
-  * The Users Payment had not sufficient posts left
-  */
-  ANASTASIS_EC_DB_STATUS_NOT_SUFFICIENT_POSTS = 6201,
-
-  /**
-  * The Payment from the User has expired.
-  */
-  ANASTASIS_EC_DB_STATUS_PAYMENT_EXPIRED = 6202,
-};
-
-#endif
diff --git a/src/include/anastasis_json.h b/src/include/anastasis_json.h
index 1f0c62a..9e8d924 100644
--- a/src/include/anastasis_json.h
+++ b/src/include/anastasis_json.h
@@ -334,7 +334,7 @@ typedef void
 (*ANASTASIS_BackupApplyActionCallback)(
   void *cls,
   const struct ANASTASIS_BackupState *new_bs,
-  enum ANASTASIS_ErrorCode error);
+  enum TALER_ErrorCode error);
 
 
 /**
@@ -349,7 +349,7 @@ typedef void
 (*ANASTASIS_RecoveryApplyActionCallback)(
   void *cls,
   const struct ANASTASIS_RecoveryState *new_rs,
-  enum ANASTASIS_ErrorCode error);
+  enum TALER_ErrorCode error);
 
 
 /**
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index c7129b8..c43cb84 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -24,13 +24,11 @@
 #define ANASTASIS_REDUX_H
 
 #include <jansson.h>
-#include <gnunet/gnunet_util_lib.h>
-#include <taler/taler_mhd_lib.h>
-#include "anastasis_error_codes.h"
-#include "anastasis_service.h"
 #include "anastasis.h"
+#include <taler/taler_mhd_lib.h>
 #include <regex.h>
 
+
 #define ANASTASIS_GENERIC_STATES(REDUX_STATE) \
   REDUX_STATE (ERROR) \
   REDUX_STATE (CONTINENT_SELECTING)   \
@@ -188,7 +186,7 @@ ANASTASIS_recovery_start (const struct 
GNUNET_CONFIGURATION_Handle *cfg);
 typedef void
 (*ANASTASIS_ActionCallback)(
   void *cls,
-  enum ANASTASIS_ErrorCode error,
+  enum TALER_ErrorCode error,
   json_t *new_state);
 
 
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 0406b4f..929196d 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -23,12 +23,10 @@
 #ifndef ANASTASIS_SERVICE_H
 #define ANASTASIS_SERVICE_H
 
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <taler/taler_util.h>
 #include "anastasis_crypto_lib.h"
+#include "anastasis_util_lib.h"
+#include <gnunet/gnunet_curl_lib.h>
 #include <jansson.h>
-#include "anastasis_error_codes.h"
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
@@ -567,7 +565,7 @@ struct ANASTASIS_TruthStoreOperation;
  */
 typedef void
 (*ANASTASIS_TruthStoreCallback) (void *cls,
-                                 enum ANASTASIS_ErrorCode ec,
+                                 enum TALER_ErrorCode ec,
                                  unsigned int http_status,
                                  const struct ANASTASIS_UploadDetails *up);
 
diff --git a/src/include/anastasis_util_lib.h b/src/include/anastasis_util_lib.h
index 7e9062c..35ad8e3 100644
--- a/src/include/anastasis_util_lib.h
+++ b/src/include/anastasis_util_lib.h
@@ -23,7 +23,11 @@
 #ifndef ANASTASIS_UTIL_LIB_H
 #define ANASTASIS_UTIL_LIB_H
 
+#include <anastasis_error_codes.h>
+#define GNU_TALER_ERROR_CODES_H 1
 #include <gnunet/gnunet_util_lib.h>
+#include <taler/taler_util.h>
+
 
 /**
  * Return default project data used by Anastasis.
diff --git a/src/lib/anastasis_backup.c b/src/lib/anastasis_backup.c
index aa58bf2..726ce8f 100644
--- a/src/lib/anastasis_backup.c
+++ b/src/lib/anastasis_backup.c
@@ -19,9 +19,8 @@
  * @author Dominik Meister
  * @author Dennis Neufeld
  */
+#include "platform.h"
 #include "anastasis.h"
-#include <taler/taler_json_lib.h>
-#include <gnunet/gnunet_util_lib.h>
 #include <taler/taler_merchant_service.h>
 #include <zlib.h>
 
@@ -117,7 +116,7 @@ struct ANASTASIS_TruthUpload
  */
 static void
 truth_store_callback (void *cls,
-                      enum ANASTASIS_ErrorCode ec,
+                      enum TALER_ErrorCode ec,
                       unsigned int http_status,
                       const struct ANASTASIS_UploadDetails *ud)
 {
diff --git a/src/reducer/anastasis_api_backup_redux.c 
b/src/reducer/anastasis_api_backup_redux.c
index 7cdf202..a67c8f2 100644
--- a/src/reducer/anastasis_api_backup_redux.c
+++ b/src/reducer/anastasis_api_backup_redux.c
@@ -21,14 +21,10 @@
  * @author Dennis Neufeld
  */
 
-#include <platform.h>
-#include <jansson.h>
-#include <taler/taler_json_lib.h>
-#include <taler/taler_util.h>
-#include <taler/taler_merchant_service.h>
+#include "platform.h"
 #include "anastasis_redux.h"
-#include "anastasis_error_codes.h"
 #include "anastasis_api_redux.h"
+#include <taler/taler_merchant_service.h>
 
 
 #define GENERATE_STRING(STRING) #STRING,
@@ -394,11 +390,11 @@ add_authentication (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Authentication method required!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -410,11 +406,11 @@ add_authentication (json_t *state,
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
                                (json_int_t)
-                               ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED,
+                               TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                "hint",
                                "Authentication method not supported!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -424,11 +420,11 @@ add_authentication (json_t *state,
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
                                (json_int_t)
-                               ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED,
+                               TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                "hint",
                                "Authentication data missing!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -442,7 +438,7 @@ add_authentication (json_t *state,
                                        "authentication_methods",
                                        auth_method_arr));
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -733,7 +729,7 @@ done_authentication (json_t *state,
              ANASTASIS_backup_state_to_string (
                ANASTASIS_BACKUP_STATE_POLICIES_REVIEWING));
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -762,11 +758,11 @@ del_authentication (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Arguments missing!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -781,17 +777,17 @@ del_authentication (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Operation failed");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
 
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -820,11 +816,11 @@ add_policy (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Arguments missing!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -849,11 +845,11 @@ add_policy (json_t *state,
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
                                (json_int_t)
-                               ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED,
+                               TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                "hint",
                                "Policy is malformed!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -927,7 +923,7 @@ add_policy (json_t *state,
                          policy);
 
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -956,11 +952,11 @@ del_policy (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Arguments missing!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -976,16 +972,16 @@ del_policy (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Operation failed");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -1170,7 +1166,7 @@ done_policy_review (json_t *state,
                                   "truths",
                                   initialize_truths (state)));
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -1473,7 +1469,7 @@ secret_share_payment_cb (void *cls,
   if (check_uploads (rec_doc_uploads, false))
   {
     sss->cb (sss->cb_cls,
-             ANASTASIS_EC_NONE,
+             TALER_EC_NONE,
              sss->state);
     sss->cb = NULL;
   }
@@ -1530,7 +1526,7 @@ secret_share_result_cb (void *cls,
                    ANASTASIS_backup_state_to_string (
                      ANASTASIS_BACKUP_STATE_BACKUP_FINISHED));
         sss->cb (sss->cb_cls,
-                 ANASTASIS_EC_NONE,
+                 TALER_EC_NONE,
                  sss->state);
         sss->cb = NULL;
         return;
@@ -1538,7 +1534,7 @@ secret_share_result_cb (void *cls,
       if (check_uploads (rec_doc_uploads, false))
       {
         sss->cb (sss->cb_cls,
-                 ANASTASIS_EC_NONE,
+                 TALER_EC_NONE,
                  sss->state);
         return;
       }
@@ -1550,7 +1546,7 @@ secret_share_result_cb (void *cls,
                                "hint",
                                "Unexpected response code!");
     sss->cb (sss->cb_cls,
-             ANASTASIS_EC_INVALID,  // FIXME: ERROR CODE
+             TALER_EC_INVALID,  // FIXME: ERROR CODE
              error);
     sss->cb = NULL;
     return;
@@ -1685,7 +1681,7 @@ upload_rec_documents (json_t *state,
  */
 static void
 truth_upload_cb (void *cls,
-                 enum ANASTASIS_ErrorCode ec,
+                 enum TALER_ErrorCode ec,
                  struct ANASTASIS_Truth *t,
                  const struct ANASTASIS_UploadDetails *ud)
 {
@@ -1724,7 +1720,7 @@ truth_upload_cb (void *cls,
                ANASTASIS_backup_state_to_string (
                  ANASTASIS_BACKUP_STATE_POLICIES_PAYING));
     tus->cb (tus->cb_cls,
-             ANASTASIS_EC_NONE,
+             TALER_EC_NONE,
              tus->state);
     tus->cb = NULL;
     return;
@@ -1982,11 +1978,11 @@ enter_secret (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Arguments missing!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     json_decref (error);
     return NULL;
@@ -1999,11 +1995,11 @@ enter_secret (json_t *state,
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
                                (json_int_t)
-                               ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED,
+                               TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                "hint",
                                "Secret is malformed!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     json_decref (error);
     return NULL;
@@ -2118,7 +2114,7 @@ back_finished (json_t *state,
                ANASTASIS_BACKUP_STATE_SECRET_EDITING));
 
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -2221,7 +2217,7 @@ ANASTASIS_backup_action_ (struct GNUNET_CURL_Context *ctx,
   {
     GNUNET_break (0);
     cb (cb_cls,
-        ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+        TALER_EC_INVALID, // FIXME: Define correct error code
         NULL);
     return NULL;
   }
@@ -2229,7 +2225,7 @@ ANASTASIS_backup_action_ (struct GNUNET_CURL_Context *ctx,
   if (ANASTASIS_BACKUP_STATE_ERROR == bs)
   {
     cb (cb_cls,
-        ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+        TALER_EC_INVALID, // FIXME: Define correct error code
         NULL);
     return NULL;
   }
diff --git a/src/reducer/anastasis_api_recovery_redux.c 
b/src/reducer/anastasis_api_recovery_redux.c
index 2f3dee2..729e3b9 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -188,7 +188,7 @@ challenge_payment_cb (void *cls,
                 __LINE__);
     ANASTASIS_redux_fail (cs->cb,
                           cs->cb_cls,
-                          ANASTASIS_EC_INVALID, // FIXME: Error code
+                          TALER_EC_INVALID, // FIXME: Error code
                           "Unexpected response code!");
     return;
   }
@@ -203,7 +203,7 @@ challenge_payment_cb (void *cls,
                 taler_pay_url);
     ANASTASIS_redux_fail (cs->cb,
                           cs->cb_cls,
-                          ANASTASIS_EC_INVALID, // FIXME: Error code
+                          TALER_EC_INVALID, // FIXME: Error code
                           "Invalid pay uri!");
     return;
   }
@@ -216,7 +216,7 @@ challenge_payment_cb (void *cls,
                 taler_pay_url);
     ANASTASIS_redux_fail (cs->cb,
                           cs->cb_cls,
-                          ANASTASIS_EC_INVALID, // FIXME: Error code
+                          TALER_EC_INVALID, // FIXME: Error code
                           "Invalid pay uri!");
 
     /* NOTE: The above is a simplifying assumption for the
@@ -256,7 +256,7 @@ challenge_payment_cb (void *cls,
                                        json_string (cs->payment_order_id)));
 
   cs->cb (cs->cb_cls,
-          ANASTASIS_EC_NONE,
+          TALER_EC_NONE,
           cs->state);
   cs->cb = NULL;
 }
@@ -277,7 +277,7 @@ challenge_start_cb (void *cls,
   {
     ANASTASIS_redux_fail (cs->cb,
                           cs->cb_cls,
-                          ANASTASIS_EC_INVALID, // FIXME: Error code
+                          TALER_EC_INVALID, // FIXME: Error code
                           "Unexpected response code!");
 
     return;
@@ -310,7 +310,7 @@ challenge_start_cb (void *cls,
                                           challenge));
 #endif
   cs->cb (cs->cb_cls,
-          ANASTASIS_EC_NONE,
+          TALER_EC_NONE,
           cs->state);
   cs->cb = NULL;
 }
@@ -456,7 +456,7 @@ pay_challenge (json_t *state,
   }
 
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -604,7 +604,7 @@ solve_challenge (json_t *state,
                                         cs);
 #endif
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -619,7 +619,7 @@ back_challenge_solving (json_t *state,
 {
   // FIXME: implement
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -692,7 +692,7 @@ ANASTASIS_recovery_action_ (struct GNUNET_CURL_Context *ctx,
   {
     GNUNET_break (0);
     cb (cb_cls,
-        ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+        TALER_EC_INVALID, // FIXME: Define correct error code
         NULL);
     return NULL;
   }
@@ -700,7 +700,7 @@ ANASTASIS_recovery_action_ (struct GNUNET_CURL_Context *ctx,
   if (ANASTASIS_RECOVERY_STATE_ERROR == rs)
   {
     cb (cb_cls,
-        ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+        TALER_EC_INVALID, // FIXME: Define correct error code
         NULL);
     return NULL;
   }
diff --git a/src/reducer/anastasis_api_redux.c 
b/src/reducer/anastasis_api_redux.c
index 41f43d2..6c9547b 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -355,7 +355,7 @@ conclude_select_country (struct SelectCountryHandle *sch)
                          sch->state);
   }
   sch->cb (NULL,
-           ANASTASIS_EC_NONE,
+           TALER_EC_NONE,
            sch->state);
 }
 
@@ -594,11 +594,11 @@ select_continent (json_t *state,
   {
     json_t *error = json_pack ("{s:I, s:s}",
                                "code",
-                               (json_int_t) ANASTASIS_EC_INVALID,
+                               (json_int_t) TALER_EC_INVALID,
                                "hint",
                                "Arguments missing!");
     cb (cb_cls,
-        ANASTASIS_EC_INVALID,
+        TALER_EC_INVALID,
         error);
     return NULL;
   }
@@ -645,7 +645,7 @@ select_continent (json_t *state,
                                       countries));
 
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -838,7 +838,7 @@ unselect_country (json_t *state,
                      ANASTASIS_generic_state_to_string (
                        ANASTASIS_GENERIC_STATE_COUNTRY_SELECTING))));
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -874,7 +874,7 @@ unselect_continent (json_t *state,
                      ANASTASIS_generic_state_to_string (
                        ANASTASIS_GENERIC_STATE_CONTINENT_SELECTING))));
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -997,7 +997,7 @@ policy_lookup_cb (void *cls,
                                 "recovery_information",
                                 recovery_information));
     rss->cb (NULL,
-             ANASTASIS_EC_NONE,
+             TALER_EC_NONE,
              rss->state);
     // rss->cb = NULL;
   }
@@ -1116,10 +1116,10 @@ enter_user_attributes (json_t *state,
         "code",
         (json_int_t)
         // FIXME: create EC for 'regex failed'
-        ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED,
+        TALER_EC_GENERIC_PARAMETER_MALFORMED,
         "hint", regexp);
       cb (cb_cls,
-          ANASTASIS_EC_INVALID,
+          TALER_EC_INVALID,
           error);
       json_decref (attributes);
       json_decref (error);
@@ -1137,10 +1137,10 @@ enter_user_attributes (json_t *state,
         "code",
         (json_int_t)
         // FIXME: create EC for 'regex failed'
-        ANASTASIS_EC_GENERIC_PARAMETER_MALFORMED,
+        TALER_EC_GENERIC_PARAMETER_MALFORMED,
         "hint", reglog);
       cb (cb_cls,
-          ANASTASIS_EC_INVALID,
+          TALER_EC_INVALID,
           error);
       json_decref (attributes);
       json_decref (error);
@@ -1165,7 +1165,7 @@ enter_user_attributes (json_t *state,
                            "authentication_providers",
                            auth_providers);
     cb (cb_cls,
-        ANASTASIS_EC_NONE,
+        TALER_EC_NONE,
         state);
     json_decref (attributes);
     return NULL;
@@ -1248,7 +1248,7 @@ enter_user_attributes (json_t *state,
         {
           GNUNET_break (0);
           cb (cb_cls,
-              ANASTASIS_EC_NONE,
+              TALER_EC_NONE,
               state);
           return NULL;
         }
@@ -1316,7 +1316,7 @@ ANASTASIS_back_generic_decrement_ (json_t *state,
                        ANASTASIS_generic_state_to_string (state_index))));
   }
   cb (cb_cls,
-      ANASTASIS_EC_NONE,
+      TALER_EC_NONE,
       state);
   return NULL;
 }
@@ -1398,7 +1398,7 @@ ANASTASIS_redux_action (const json_t *state,
     {
       GNUNET_break (0);
       cb (cb_cls,
-          ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+          TALER_EC_INVALID, // FIXME: Define correct error code
           NULL);
       return NULL;
     }
diff --git a/src/restclient/anastasis_api_challenge_run.c 
b/src/restclient/anastasis_api_challenge_run.c
index f918404..0682bb9 100644
--- a/src/restclient/anastasis_api_challenge_run.c
+++ b/src/restclient/anastasis_api_challenge_run.c
@@ -24,12 +24,6 @@
 #include <curl/curl.h>
 #include <jansson.h>
 #include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <taler/taler_json_lib.h>
-#include <taler/taler_curl_lib.h>
-#include <taler/taler_util.h>
-#include <taler/taler_signatures.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
 
diff --git a/src/restclient/anastasis_api_config.c 
b/src/restclient/anastasis_api_config.c
index 5c66868..2319b4a 100644
--- a/src/restclient/anastasis_api_config.c
+++ b/src/restclient/anastasis_api_config.c
@@ -22,14 +22,11 @@
  */
 #include "platform.h"
 #include <curl/curl.h>
-#include <jansson.h>
 #include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <gnunet/gnunet_json_lib.h>
-#include <taler/taler_json_lib.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
+#include <gnunet/gnunet_json_lib.h>
+#include <taler/taler_json_lib.h>
 
 
 struct ANASTASIS_ConfigOperation
diff --git a/src/restclient/anastasis_api_curl_defaults.c 
b/src/restclient/anastasis_api_curl_defaults.c
index ce5224f..27b965f 100644
--- a/src/restclient/anastasis_api_curl_defaults.c
+++ b/src/restclient/anastasis_api_curl_defaults.c
@@ -19,10 +19,9 @@
  * @brief curl easy handle defaults
  * @author Florian Dold
  */
-
+#include "platform.h"
 #include "anastasis_api_curl_defaults.h"
 
-
 CURL *
 ANASTASIS_curl_easy_get_ (const char *url)
 {
diff --git a/src/restclient/anastasis_api_curl_defaults.h 
b/src/restclient/anastasis_api_curl_defaults.h
index 275886d..62e0081 100644
--- a/src/restclient/anastasis_api_curl_defaults.h
+++ b/src/restclient/anastasis_api_curl_defaults.h
@@ -20,10 +20,9 @@
  * @author Florian Dold
  */
 
-#ifndef _ANASTASIS_CURL_DEFAULTS_H
-#define _ANASTASIS_CURL_DEFAULTS_H
+#ifndef _ANASTASIS_API_CURL_DEFAULTS_H
+#define _ANASTASIS_API_CURL_DEFAULTS_H
 
-#include "platform.h"
 #include <gnunet/gnunet_curl_lib.h>
 
 
diff --git a/src/restclient/anastasis_api_keyshare_lookup.c 
b/src/restclient/anastasis_api_keyshare_lookup.c
index baac040..4fa52be 100644
--- a/src/restclient/anastasis_api_keyshare_lookup.c
+++ b/src/restclient/anastasis_api_keyshare_lookup.c
@@ -24,12 +24,6 @@
 #include <curl/curl.h>
 #include <jansson.h>
 #include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <taler/taler_json_lib.h>
-#include <taler/taler_curl_lib.h>
-#include <taler/taler_util.h>
-#include <taler/taler_signatures.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
 
diff --git a/src/restclient/anastasis_api_policy_lookup.c 
b/src/restclient/anastasis_api_policy_lookup.c
index 4b9eb11..041ca86 100644
--- a/src/restclient/anastasis_api_policy_lookup.c
+++ b/src/restclient/anastasis_api_policy_lookup.c
@@ -28,14 +28,9 @@
 #include <curl/curl.h>
 #include <jansson.h>
 #include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <taler/taler_json_lib.h>
-#include <taler/taler_curl_lib.h>
-#include <taler/taler_util.h>
-#include <taler/taler_signatures.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
+#include <taler/taler_signatures.h>
 
 
 /**
diff --git a/src/restclient/anastasis_api_policy_store.c 
b/src/restclient/anastasis_api_policy_store.c
index c9cf8a2..92dc61e 100644
--- a/src/restclient/anastasis_api_policy_store.c
+++ b/src/restclient/anastasis_api_policy_store.c
@@ -26,16 +26,10 @@
  */
 #include "platform.h"
 #include <curl/curl.h>
-#include <jansson.h>
 #include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <taler/taler_signatures.h>
-#include <taler/taler_json_lib.h>
-#include <taler/taler_curl_lib.h>
-#include <taler/taler_util.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
+#include <taler/taler_signatures.h>
 
 
 struct ANASTASIS_PolicyStoreOperation
@@ -97,8 +91,8 @@ ANASTASIS_policy_store_cancel (
  *
  * @param cls the `struct ANASTASIS_PolicyStoreOperation`
  * @param response_code HTTP response code, 0 on error
- * @param data
- * @param data_size
+ * @param data response body
+ * @param data_size number of bytes in @a data
  */
 static void
 handle_policy_store_finished (void *cls,
@@ -150,18 +144,10 @@ handle_policy_store_finished (void *cls,
     ud.us = ANASTASIS_US_SERVER_ERROR;
     break;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d Response code is: %i\n",
-              __FILE__,
-              __LINE__,
-              (int) response_code);
-  if (NULL != pso->cb)
-  {
-    pso->cb (pso->cb_cls,
-             response_code,
-             udp);
-    pso->cb = NULL;
-  }
+  pso->cb (pso->cb_cls,
+           response_code,
+           udp);
+  pso->cb = NULL;
   ANASTASIS_policy_store_cancel (pso);
 }
 
diff --git a/src/restclient/anastasis_api_truth_store.c 
b/src/restclient/anastasis_api_truth_store.c
index f69c583..9a44967 100644
--- a/src/restclient/anastasis_api_truth_store.c
+++ b/src/restclient/anastasis_api_truth_store.c
@@ -24,12 +24,6 @@
 #include <curl/curl.h>
 #include <jansson.h>
 #include <microhttpd.h> /* just for HTTP status codes */
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_curl_lib.h>
-#include <taler/taler_signatures.h>
-#include <taler/taler_json_lib.h>
-#include <taler/taler_curl_lib.h>
-#include <taler/taler_util.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
 
diff --git a/src/stasis/anastasis-dbinit.c b/src/stasis/anastasis-dbinit.c
index 265874e..5c0a174 100644
--- a/src/stasis/anastasis-dbinit.c
+++ b/src/stasis/anastasis-dbinit.c
@@ -20,10 +20,7 @@
  * @author Dominik Meister
  */
 #include "platform.h"
-#include <taler/taler_util.h>
-#include <gnunet/gnunet_util_lib.h>
 #include "anastasis_database_lib.h"
-#include "anastasis_util_lib.h"
 
 
 /**
diff --git a/src/stasis/anastasis_db_plugin.c b/src/stasis/anastasis_db_plugin.c
index e45d3c1..6b5332c 100644
--- a/src/stasis/anastasis_db_plugin.c
+++ b/src/stasis/anastasis_db_plugin.c
@@ -20,7 +20,6 @@
  * @author Sree Harsha Totakura <sreeharsha@totakura.in>
  */
 #include "platform.h"
-#include <taler/taler_util.h>
 #include "anastasis_database_plugin.h"
 #include <ltdl.h>
 
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index 61d5e78..e1f1928 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -21,12 +21,9 @@
  * @author Marcello Stanisci
  */
 #include "platform.h"
-#include <gnunet/gnunet_util_lib.h>
-#include <gnunet/gnunet_pq_lib.h>
-#include <taler/taler_pq_lib.h>
 #include "anastasis_database_plugin.h"
 #include "anastasis_database_lib.h"
-#include "anastasis_error_codes.h"
+#include <taler/taler_pq_lib.h>
 
 /**
  * How often do we re-try if we run into a DB serialization error?
@@ -97,6 +94,7 @@ static void
 check_connection (void *cls)
 {
   struct PostgresClosure *pg = cls;
+
   GNUNET_PQ_reconnect_if_down (pg->conn);
 }
 
@@ -278,7 +276,6 @@ check_valid_code (
   const struct GNUNET_HashCode *hashed_code,
   struct GNUNET_TIME_Absolute creation_date)
 {
-  enum ANASTASIS_DB_QueryStatus qs;
   uint64_t server_code;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (truth_public_key),
@@ -290,6 +287,8 @@ check_valid_code (
                                   &server_code),
     GNUNET_PQ_result_spec_end
   };
+  enum ANASTASIS_DB_QueryStatus qs;
+
   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
                                                  "challengecode_select",
                                                  params,
@@ -309,8 +308,9 @@ check_valid_code (
 
       ANASTASIS_hash_answer (server_code,
                              &shashed_code);
-      if (0 == GNUNET_memcmp (&shashed_code,
-                              hashed_code))
+      if (0 ==
+          GNUNET_memcmp (&shashed_code,
+                         hashed_code))
       {
         return ANASTASIS_DB_STATUS_VALID_CODE_STORED;
       }
@@ -414,14 +414,11 @@ payment_by_account_cb (void *cls,
  * @param it_cls closure for @a it
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_lookup_pending_payments_by_account (void *cls,
-                                             const struct
-                                             ANASTASIS_CRYPTO_AccountPublicKeyP
-                                             *
-                                             anastasis_pub,
-                                             
ANASTASIS_DB_PaymentPendingIterator
-                                             it,
-                                             void *it_cls)
+postgres_lookup_pending_payments_by_account (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  ANASTASIS_DB_PaymentPendingIterator it,
+  void *it_cls)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
@@ -464,22 +461,18 @@ postgres_lookup_pending_payments_by_account (void *cls,
   *         did not have enough upload left; HARD error if @a payment_secret 
is unknown, ...
   */
 static enum ANASTASIS_DB_QueryStatus
-postgres_store_recovery_document (void *cls,
-                                  const struct
-                                  ANASTASIS_CRYPTO_AccountPublicKeyP *
-                                  anastasis_pub,
-                                  const struct
-                                  ANASTASIS_AccountSignatureP *account_sig,
-                                  const struct
-                                  GNUNET_HashCode *recovery_data_hash,
-                                  const void *recovery_data,
-                                  size_t recovery_data_size,
-                                  const struct
-                                  ANASTASIS_PaymentSecretP *payment_secret,
-                                  uint32_t *version)
+postgres_store_recovery_document (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  const struct ANASTASIS_AccountSignatureP *account_sig,
+  const struct GNUNET_HashCode *recovery_data_hash,
+  const void *recovery_data,
+  size_t recovery_data_size,
+  const struct ANASTASIS_PaymentSecretP *payment_secret,
+  uint32_t *version)
 {
   struct PostgresClosure *pg = cls;
-  enum ANASTASIS_DB_QueryStatus qs;
+  enum GNUNET_DB_QueryStatus qs;
   uint32_t postcounter;
   struct GNUNET_HashCode dh;
 
@@ -487,12 +480,6 @@ postgres_store_recovery_document (void *cls,
   postgres_preflight (pg);
   /* get the version for the recoverydocument */
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "At %s:%d Public key used to query db is: %s\n",
-                __FILE__,
-                __LINE__,
-                TALER_B2S (anastasis_pub));
-
     struct GNUNET_PQ_QueryParam params[] = {
       GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
       GNUNET_PQ_query_param_end
@@ -559,11 +546,6 @@ postgres_store_recovery_document (void *cls,
   }
 
   // lookup if the user has enough uploads left and decrement
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d Payment-Identifier used to query db is: %s\n",
-              __FILE__,
-              __LINE__,
-              TALER_B2S (payment_secret));
   {
     struct GNUNET_PQ_QueryParam params[] = {
       GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
@@ -594,23 +576,18 @@ postgres_store_recovery_document (void *cls,
     rollback (pg);
     return ANASTASIS_DB_STATUS_HARD_ERROR;
   case ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "At %s:%d Post counter from db is: %u\n",
-                __FILE__,
-                __LINE__,
-                postcounter);
     break;
   default:
     rollback (pg);
     return qs;
   }
 
-  if (postcounter == 0)
+  if (0 == postcounter)
   {
     rollback (pg);
-    return ANASTASIS_EC_DB_STATUS_NOT_SUFFICIENT_POSTS;
+    return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; // FIXME: WAS: 
TALER_EC_DB_STATUS_NOT_SUFFICIENT_POSTS;
   }
-  /*Decrement the postcounter by one*/
+  /* Decrement the postcounter by one */
   postcounter--;
 
   /* Update the postcounter in the Database */
@@ -738,12 +715,11 @@ postgres_store_recovery_document (void *cls,
  * @return transaction status
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_increment_lifetime (void *cls,
-                             const struct
-                             ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
-                             const struct
-                             ANASTASIS_PaymentSecretP *payment_identifier,
-                             struct GNUNET_TIME_Relative lifetime)
+postgres_increment_lifetime (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  const struct ANASTASIS_PaymentSecretP *payment_identifier,
+  struct GNUNET_TIME_Relative lifetime)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_TIME_Absolute expiration;
@@ -778,12 +754,6 @@ postgres_increment_lifetime (void *cls,
   }
 
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "At %s:%d Public key used to query db is: %s\n",
-                __FILE__,
-                __LINE__,
-                TALER_B2S (anastasis_pub));
-
     struct GNUNET_PQ_QueryParam params[] = {
       GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
       GNUNET_PQ_query_param_end
@@ -900,21 +870,13 @@ postgres_increment_lifetime (void *cls,
  * @return transaction status
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_record_recdoc_payment (void *cls,
-                                const struct
-                                ANASTASIS_CRYPTO_AccountPublicKeyP *
-                                anastasis_pub,
-                                uint32_t post_counter,
-                                const struct
-                                ANASTASIS_PaymentSecretP *payment_secret,
-                                const struct TALER_Amount *amount)
+postgres_record_recdoc_payment (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  uint32_t post_counter,
+  const struct ANASTASIS_PaymentSecretP *payment_secret,
+  const struct TALER_Amount *amount)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d Post counter to save is: %u\n",
-              __FILE__,
-              __LINE__,
-              post_counter);
-
   struct PostgresClosure *pg = cls;
   enum ANASTASIS_DB_QueryStatus qs;
   struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
@@ -934,12 +896,6 @@ postgres_record_recdoc_payment (void *cls,
   // because of constraint at user_id, first we have to verify
   // if user exists, otherwise we have to create one
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "At %s:%d Public key used to query user db is: %s\n",
-                __FILE__,
-                __LINE__,
-                TALER_B2S (anastasis_pub));
-
     struct GNUNET_PQ_QueryParam params[] = {
       GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
       GNUNET_PQ_query_param_end
@@ -966,12 +922,6 @@ postgres_record_recdoc_payment (void *cls,
   case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
     {
       // create new user
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "At %s:%d Public key to be saved to user db is: %s\n",
-                  __FILE__,
-                  __LINE__,
-                  TALER_B2S (anastasis_pub));
-
       struct GNUNET_PQ_QueryParam params[] = {
         GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
         GNUNET_PQ_query_param_absolute_time (&now),
@@ -1042,24 +992,17 @@ postgres_record_recdoc_payment (void *cls,
  * @return transaction status
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_record_challenge_payment (void *cls,
-                                   const struct
-                                   ANASTASIS_CRYPTO_TruthPublicKeyP *
-                                   truth_public_key,
-                                   const struct
-                                   ANASTASIS_PaymentSecretP *payment_secret,
-                                   const struct TALER_Amount *amount)
+postgres_record_challenge_payment (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
+  const struct ANASTASIS_PaymentSecretP *payment_secret,
+  const struct TALER_Amount *amount)
 {
   struct PostgresClosure *pg = cls;
   enum ANASTASIS_DB_QueryStatus qs;
   struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
   check_connection (pg);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d Truth Public key used to query db is: %s\n",
-              __FILE__,
-              __LINE__,
-              TALER_B2S (truth_public_key));
 /*
   {
     // because of constraint at truth_id, first we have to verify
@@ -1087,18 +1030,19 @@ postgres_record_challenge_payment (void *cls,
     GNUNET_break (0);
     return ANASTASIS_DB_STATUS_HARD_ERROR;
   }
+  {
+    struct GNUNET_PQ_QueryParam params[] = {
+      GNUNET_PQ_query_param_auto_from_type (truth_public_key),
+      TALER_PQ_query_param_amount (amount),
+      GNUNET_PQ_query_param_auto_from_type (payment_secret),
+      GNUNET_PQ_query_param_absolute_time (&now),
+      GNUNET_PQ_query_param_end
+    };
 
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (truth_public_key),
-    TALER_PQ_query_param_amount (amount),
-    GNUNET_PQ_query_param_auto_from_type (payment_secret),
-    GNUNET_PQ_query_param_absolute_time (&now),
-    GNUNET_PQ_query_param_end
-  };
-
-  qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                           "challenge_payment_insert",
-                                           params);
+    qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+                                             "challenge_payment_insert",
+                                             params);
+  }
   switch (qs)
   {
   case GNUNET_DB_STATUS_SOFT_ERROR:
@@ -1138,14 +1082,12 @@ postgres_record_challenge_payment (void *cls,
  * @return transaction status
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_check_challenge_payment (void *cls,
-                                  const struct
-                                  ANASTASIS_PaymentSecretP *payment_secret,
-                                  bool *paid)
+postgres_check_challenge_payment (
+  void *cls,
+  const struct ANASTASIS_PaymentSecretP *payment_secret,
+  bool *paid)
 {
   struct PostgresClosure *pg = cls;
-  enum ANASTASIS_DB_QueryStatus qs;
-
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (payment_secret),
     GNUNET_PQ_query_param_end
@@ -1155,6 +1097,7 @@ postgres_check_challenge_payment (void *cls,
                                           paid),
     GNUNET_PQ_result_spec_end
   };
+  enum ANASTASIS_DB_QueryStatus qs;
 
   check_connection (pg);
   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
@@ -1192,11 +1135,11 @@ postgres_check_challenge_payment (void *cls,
  * @return transaction status
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_check_payment_identifier (void *cls,
-                                   const struct
-                                   ANASTASIS_PaymentSecretP *payment_secret,
-                                   bool *paid,
-                                   bool *valid_counter)
+postgres_check_payment_identifier (
+  void *cls,
+  const struct ANASTASIS_PaymentSecretP *payment_secret,
+  bool *paid,
+  bool *valid_counter)
 {
   struct PostgresClosure *pg = cls;
   enum ANASTASIS_DB_QueryStatus qs;
@@ -1247,17 +1190,15 @@ postgres_check_payment_identifier (void *cls,
  * @return transaction status
  */
 static enum ANASTASIS_DB_QueryStatus
-postgres_store_truth (void *cls,
-                      const struct
-                      ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
-                      const struct
-                      ANASTASIS_CRYPTO_EncryptedKeyShareP *key_share_data,
-                      const char *mime_type,
-                      const void *encrypted_truth,
-                      size_t encrypted_truth_size,
-                      const char *method,
-                      struct
-                      GNUNET_TIME_Relative truth_expiration)
+postgres_store_truth (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
+  const struct ANASTASIS_CRYPTO_EncryptedKeyShareP *key_share_data,
+  const char *mime_type,
+  const void *encrypted_truth,
+  size_t encrypted_truth_size,
+  const char *method,
+  struct GNUNET_TIME_Relative truth_expiration)
 {
   struct PostgresClosure *pg = cls;
   enum ANASTASIS_DB_QueryStatus qs;
@@ -1336,14 +1277,13 @@ postgres_store_truth (void *cls,
  * @return transaction status
  */
 enum ANASTASIS_DB_QueryStatus
-postgres_get_escrow_challenge (void *cls,
-                               const struct
-                               ANASTASIS_CRYPTO_TruthPublicKeyP *
-                               truth_public_key,
-                               void **truth,
-                               size_t *truth_size,
-                               char **truth_mime,
-                               char **method)
+postgres_get_escrow_challenge (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
+  void **truth,
+  size_t *truth_size,
+  char **truth_mime,
+  char **method)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
@@ -1370,20 +1310,19 @@ postgres_get_escrow_challenge (void *cls,
 
 
 /**
-* @param cls closure
-* @param truth_public_key the identifier for the Truth
-* @param key_share contains the encrypted Keyshare
-* @param key_share_size size of the Keyshare
-* @return transaction status
-*/
+ * @param cls closure
+ * @param truth_public_key the identifier for the Truth
+ * @param key_share contains the encrypted Keyshare
+ * @param key_share_size size of the Keyshare
+ * @return transaction status
+ */
 enum ANASTASIS_DB_QueryStatus
-postgres_get_key_share (void *cls,
-                        const struct
-                        ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
-                        void **key_share,
-                        size_t *key_share_size)
+postgres_get_key_share (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
+  void **key_share,
+  size_t *key_share_size)
 {
-  enum ANASTASIS_DB_QueryStatus qs;
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (truth_public_key),
@@ -1395,6 +1334,7 @@ postgres_get_key_share (void *cls,
                                          key_share_size),
     GNUNET_PQ_result_spec_end
   };
+  enum ANASTASIS_DB_QueryStatus qs;
 
   check_connection (pg);
   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
@@ -1420,29 +1360,23 @@ postgres_get_key_share (void *cls,
 
 
 /**
-* @param cls closure
-* @param anastasis_pub account identifier
-* @param recovery_data_hash[OUT] set to hash of @a recovery document
-* @return transaction status
+ * @param cls closure
+ * @param anastasis_pub account identifier
+ * @param recovery_data_hash[OUT] set to hash of @a recovery document
+ * @return transaction status
 */
 enum ANASTASIS_DB_QueryStatus
-postgres_lookup_account (void *cls,
-                         const struct
-                         ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
-                         struct GNUNET_HashCode *recovery_data_hash)
+postgres_lookup_account (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  struct GNUNET_HashCode *recovery_data_hash)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d Public key used to query db is: %s\n",
-              __FILE__,
-              __LINE__,
-              TALER_B2S (anastasis_pub));
-
   struct PostgresClosure *pg = cls;
-  enum ANASTASIS_DB_QueryStatus qs;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
     GNUNET_PQ_query_param_end
   };
+  enum ANASTASIS_DB_QueryStatus qs;
 
   check_connection (pg);
   postgres_preflight (pg);
@@ -1518,17 +1452,14 @@ postgres_lookup_account (void *cls,
  * @return transaction status
  */
 enum ANASTASIS_DB_QueryStatus
-postgres_get_latest_recovery_document (void *cls,
-                                       const struct
-                                       ANASTASIS_CRYPTO_AccountPublicKeyP *
-                                       anastasis_pub,
-                                       struct
-                                       ANASTASIS_AccountSignatureP 
*account_sig,
-                                       struct
-                                       GNUNET_HashCode *recovery_data_hash,
-                                       size_t *data_size,
-                                       void **data,
-                                       uint32_t *version)
+postgres_get_latest_recovery_document (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  struct ANASTASIS_AccountSignatureP *account_sig,
+  struct GNUNET_HashCode *recovery_data_hash,
+  size_t *data_size,
+  void **data,
+  uint32_t *version)
 {
   struct PostgresClosure *pg = cls;
   enum ANASTASIS_DB_QueryStatus qs;
@@ -1579,28 +1510,23 @@ postgres_get_latest_recovery_document (void *cls,
  * @param cls closure
  * @param anastasis_pub public key of the user's account
  * @param version the version number of the policy the user requests
- * @param account_sig[OUT] signature
- * @param recovery_data_hash[OUT] hash of the current recovery data
- * @param data_size[OUT] size of data blob
- * @param data[OUT] blob which contains the recovery document
+ * @param[out] account_sig signature
+ * @param[out] recovery_data_hash hash of the current recovery data
+ * @param[out] data_size size of data blob
+ * @param[out] data blob which contains the recovery document
  * @return transaction status
  */
 enum ANASTASIS_DB_QueryStatus
-postgres_get_recovery_document (void *cls,
-                                const struct
-                                ANASTASIS_CRYPTO_AccountPublicKeyP *
-                                anastasis_pub,
-                                uint32_t version,
-                                struct
-                                ANASTASIS_AccountSignatureP *account_sig,
-                                struct
-                                GNUNET_HashCode *recovery_data_hash,
-                                size_t *data_size,
-                                void **data)
-
+postgres_get_recovery_document (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+  uint32_t version,
+  struct ANASTASIS_AccountSignatureP *account_sig,
+  struct GNUNET_HashCode *recovery_data_hash,
+  size_t *data_size,
+  void **data)
 {
   struct PostgresClosure *pg = cls;
-  enum ANASTASIS_DB_QueryStatus qs;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (anastasis_pub),
     GNUNET_PQ_query_param_uint32 (&version),
@@ -1616,6 +1542,7 @@ postgres_get_recovery_document (void *cls,
                                          data_size),
     GNUNET_PQ_result_spec_end
   };
+  enum ANASTASIS_DB_QueryStatus qs;
 
   check_connection (pg);
   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
@@ -1657,6 +1584,10 @@ postgres_verify_challenge_code (
   const struct GNUNET_HashCode *hashed_code)
 {
   struct PostgresClosure *pg = cls;
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_auto_from_type (truth_pub),
+    GNUNET_PQ_query_param_end
+  };
   enum ANASTASIS_DB_QueryStatus qs;
   struct GNUNET_TIME_Absolute time_now = GNUNET_TIME_absolute_get ();
 
@@ -1669,49 +1600,25 @@ postgres_verify_challenge_code (
                          time_now);
   if (qs != ANASTASIS_DB_STATUS_CHALLENGE_CODE_MISSMATCH)
     return qs;
-
-  if (GNUNET_OK !=
-      begin_transaction (pg,
-                         "update_challenge_retry"))
-  {
-    GNUNET_break (0);
-    return ANASTASIS_DB_STATUS_HARD_ERROR;
-  }
-
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (truth_pub),
-    GNUNET_PQ_query_param_end
-  };
-
   qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
                                            "challengecode_update_retry",
                                            params);
   switch (qs)
   {
   case GNUNET_DB_STATUS_HARD_ERROR:
-    rollback (pg);
     return ANASTASIS_DB_STATUS_HARD_ERROR;
   case GNUNET_DB_STATUS_SOFT_ERROR:
-    rollback (pg);
     GNUNET_break (0);
     return ANASTASIS_DB_STATUS_SOFT_ERROR;
   case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
-    rollback (pg);
     /*Should never happen */
     return ANASTASIS_DB_STATUS_NO_RESULTS;
   case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
-    break;
+    return ANASTASIS_DB_STATUS_CHALLENGE_CODE_MISSMATCH;
   default:
     GNUNET_break (0);
     return ANASTASIS_DB_STATUS_HARD_ERROR;
   }
-
-  qs = commit_transaction (pg);
-  if (qs < 0)
-  {
-    return ANASTASIS_DB_STATUS_HARD_ERROR;
-  }
-  return ANASTASIS_DB_STATUS_CHALLENGE_CODE_MISSMATCH;
 }
 
 
@@ -1724,24 +1631,20 @@ postgres_verify_challenge_code (
  * @return transaction status
  */
 enum ANASTASIS_DB_QueryStatus
-postgres_lookup_challenge_payment (void *cls,
-                                   const struct
-                                   ANASTASIS_CRYPTO_TruthPublicKeyP
-                                   *truth_public_key,
-                                   ANASTASIS_DB_PaymentPendingIterator it,
-                                   void *it_cls)
+postgres_lookup_challenge_payment (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
+  ANASTASIS_DB_PaymentPendingIterator it,
+  void *it_cls)
 {
   struct PostgresClosure *pg = cls;
-  enum ANASTASIS_DB_QueryStatus qs;
   struct ANASTASIS_PaymentSecretP payment_identifier;
   struct GNUNET_TIME_Absolute timestamp;
   struct TALER_Amount amount;
-
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_auto_from_type (truth_public_key),
     GNUNET_PQ_query_param_end
   };
-
   struct GNUNET_PQ_ResultSpec rs[] = {
     GNUNET_PQ_result_spec_absolute_time ("creation_date",
                                          &timestamp),
@@ -1752,6 +1655,7 @@ postgres_lookup_challenge_payment (void *cls,
                                  &amount),
     GNUNET_PQ_result_spec_end
   };
+  enum ANASTASIS_DB_QueryStatus qs;
 
   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
                                                  
"challenge_pending_payment_select",
@@ -1772,14 +1676,18 @@ postgres_lookup_challenge_payment (void *cls,
     return ANASTASIS_DB_STATUS_HARD_ERROR;
   }
 
-  char *order_id;
-  order_id = GNUNET_STRINGS_data_to_string_alloc (&payment_identifier,
-                                                  sizeof (struct
-                                                          
ANASTASIS_PaymentSecretP));
-  it (it_cls,
-      timestamp,
-      order_id,
-      &amount);
+  {
+    char *order_id;
+
+    order_id = GNUNET_STRINGS_data_to_string_alloc (
+      &payment_identifier,
+      sizeof (struct ANASTASIS_PaymentSecretP));
+    it (it_cls,
+        timestamp,
+        order_id, // FIXME: pass payment secretP, not ASCII version here!
+        &amount);
+    GNUNET_free (order_id);
+  }
   return ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT;
 }
 
@@ -1854,13 +1762,12 @@ postgres_update_challenge_payment (void *cls,
  * @return transaction status
  */
 enum ANASTASIS_DB_QueryStatus
-postgres_store_challenge_code (void *cls,
-                               const struct
-                               ANASTASIS_CRYPTO_TruthPublicKeyP *
-                               truth_public_key,
-                               uint64_t code,
-                               struct GNUNET_TIME_Relative expiration_time,
-                               unsigned int retry_counter)
+postgres_store_challenge_code (
+  void *cls,
+  const struct ANASTASIS_CRYPTO_TruthPublicKeyP *truth_public_key,
+  uint64_t code,
+  struct GNUNET_TIME_Relative expiration_time,
+  unsigned int retry_counter)
 {
   struct PostgresClosure *pg = cls;
   enum ANASTASIS_DB_QueryStatus qs;
@@ -1933,6 +1840,7 @@ postgres_store_challenge_code (void *cls,
 /**
  * FIXME maybe implemented in the postgres_gc but want it separate first
  * Function called to remove all expired codes in the database
+ *
  * @return transaction status
  */
 enum ANASTASIS_DB_QueryStatus
@@ -1944,7 +1852,7 @@ postgres_challenge_gc (void *cls)
     GNUNET_PQ_query_param_absolute_time (&time_now),
     GNUNET_PQ_query_param_end
   };
-  /*FIXME error handling */
+
   check_connection (pg);
   postgres_preflight (pg);
   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index b0c3a33..8fe663d 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -109,6 +109,7 @@ run (void *cls)
   unsigned char aes_gcm_tag[16];
   const char *recovery_data = "RECOVERY_DATA";
   uint64_t challenge_code = 1234;
+  struct GNUNET_HashCode c_hash;
 
   struct ANASTASIS_UploadSignaturePS usp = {
     .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST),
@@ -264,16 +265,19 @@ run (void *cls)
                                         challenge_code,
                                         challenge_expiration,
                                         3));
-
+  ANASTASIS_hash_answer (123,
+                         &c_hash);
   FAILIF (ANASTASIS_DB_STATUS_CHALLENGE_CODE_MISSMATCH !=
           plugin->verify_challenge_code (plugin->cls,
                                          &truth_public_key,
-                                         123));
+                                         &c_hash));
 
+  ANASTASIS_hash_answer (challenge_code,
+                         &c_hash);
   FAILIF (ANASTASIS_DB_STATUS_VALID_CODE_STORED !=
           plugin->verify_challenge_code (plugin->cls,
                                          &truth_public_key,
-                                         challenge_code));
+                                         &c_hash));
 
   if (-1 == result)
     result = 0;
diff --git a/src/testing/.gitignore b/src/testing/.gitignore
new file mode 100644
index 0000000..6827c6c
--- /dev/null
+++ b/src/testing/.gitignore
@@ -0,0 +1,2 @@
+test_anastasis
+test_anastasisrest_api
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 5ef710a..973c63a 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -65,44 +65,25 @@ TESTS = \
 test_anastasisrest_api_SOURCES = \
   test_anastasis_api.c
 test_anastasisrest_api_LDADD = \
-  $(top_builddir)/src/stasis/libanastasisdb.la \
-  $(LIBGCRYPT_LIBS) \
-  -ltalertesting \
   libanastasistesting.la \
   -ltalermerchanttesting \
-  -ltalerfakebank \
-  -ltalerbank \
-  -ltalerexchange \
-  -ltalermerchant \
-  -ltalerjson \
-  -ltalerutil \
-  -lgnunetjson \
-  -lgnunetcurl \
-  -lgnunetutil \
-  -ljansson
+  -ltalertesting \
+  -lgnunetutil
 
 test_anastasis_SOURCES = \
   test_anastasis.c
 test_anastasis_LDADD = \
-  $(top_builddir)/src/stasis/libanastasisdb.la \
-  libanastasis.la \
-  $(LIBGCRYPT_LIBS) \
-  -ltalertesting \
   libanastasistesting.la \
   -ltalermerchanttesting \
-  -ltalerfakebank \
-  -ltalerbank \
+  -ltalertesting \
   -ltalerexchange \
-  -ltalermerchant \
-  -ltalerjson \
-  -ltalerutil \
-  -lgnunetjson \
-  -lgnunetcurl \
-  -lgnunetutil \
-  -ljansson
+  -lgnunetutil
 
 EXTRA_DIST = \
   test_anastasis_api.conf \
   test_anastasis_api_home/.config/taler/exchange/account-2.json \
   test_anastasis_api_home/.local/share/taler/exchange/offline-keys/master.priv 
\
   sms_authentication.sh
+
+MOSTLYCLEANFILES = \
+  
test_anastasis_api_home/.local/share/taler/exchange/offline-keys/secm_tofus.pub
diff --git a/src/testing/test_anastasis.c b/src/testing/test_anastasis.c
index 843847e..f9d2205 100644
--- a/src/testing/test_anastasis.c
+++ b/src/testing/test_anastasis.c
@@ -184,28 +184,25 @@ run (void *cls,
   };
 
   struct TALER_TESTING_Command anastasis[] = {
-    // FIXME: testing logic here
     ANASTASIS_TESTING_cmd_salt ("salt-request-1",
                                 anastasis_url,
                                 MHD_HTTP_OK),
-
     ANASTASIS_TESTING_cmd_truth_upload ("truth-create-1",
                                         anastasis_url,
                                         ANASTASIS_TESTING_make_id_data_example 
(
                                           "MaxMuster123456789"),
                                         "question",
                                         "You have to answer the secure 
question.",
-                                        "string",
-                                        "HashOfSomeTruth1",
-                                        strlen ("HashOfSomeTruth1"),
+                                        "text/plain",
+                                        "SomeTruth1",
+                                        strlen ("SomeTruth1"),
+                                        NULL,
                                         MHD_HTTP_NO_CONTENT,
                                         ANASTASIS_TESTING_TSO_NONE,
                                         "salt-request-1"),
-
     ANASTASIS_TESTING_cmd_salt ("salt-request-2",
                                 anastasis_url,
                                 MHD_HTTP_OK),
-
     ANASTASIS_TESTING_cmd_truth_upload ("truth-create-2",
                                         anastasis_url,
                                         ANASTASIS_TESTING_make_id_data_example 
(
@@ -213,16 +210,15 @@ run (void *cls,
                                         "question",
                                         "You have to answer the secure 
question.",
                                         "string",
-                                        "HashOfSomeTruth2",
-                                        strlen ("HashOfSomeTruth2"),
+                                        "SomeTruth2",
+                                        strlen ("SomeTruth2"),
+                                        NULL,
                                         MHD_HTTP_NO_CONTENT,
                                         ANASTASIS_TESTING_TSO_NONE,
                                         "salt-request-2"),
-
     ANASTASIS_TESTING_cmd_salt ("salt-request-3",
                                 anastasis_url,
                                 MHD_HTTP_OK),
-
     ANASTASIS_TESTING_cmd_truth_upload ("truth-create-3",
                                         anastasis_url,
                                         ANASTASIS_TESTING_make_id_data_example 
(
@@ -230,18 +226,17 @@ run (void *cls,
                                         "file",
                                         "TESTING FILE PLUGIN INTEGRATION",
                                         "string",
-                                        "HashOfSomeTruth3",
-                                        strlen ("HashOfSomeTruth3"),
+                                        "SomeTruth3",
+                                        strlen ("SomeTruth3"),
+                                        NULL,
                                         MHD_HTTP_NO_CONTENT,
                                         ANASTASIS_TESTING_TSO_NONE,
                                         "salt-request-3"),
-
     ANASTASIS_TESTING_cmd_policy_create ("policy-create-1",
                                          "truth-create-1",
                                          "truth-create-2",
                                          "truth-create-3",
                                          NULL),
-
     ANASTASIS_TESTING_cmd_secret_share ("secret-share-1",
                                         anastasis_url,
                                         NULL,
@@ -269,7 +264,6 @@ run (void *cls,
                                           "EUR:5",
                                           "EUR:4.99", /* must match ANNUAL_FEE 
in config! */
                                           NULL),
-
     ANASTASIS_TESTING_cmd_secret_share ("secret-share-2",
                                         anastasis_url,
                                         "secret-share-1",
@@ -281,7 +275,6 @@ run (void *cls,
                                         ANASTASIS_TESTING_SSO_NONE,
                                         "policy-create-1",
                                         NULL),
-
     ANASTASIS_TESTING_cmd_recover_secret ("recover-secret-1",
                                           anastasis_url,
                                           
ANASTASIS_TESTING_make_id_data_example (
@@ -296,13 +289,13 @@ run (void *cls,
                                             MHD_HTTP_OK,
                                             "recover-secret-1",
                                             0,
-                                            "HashOfSomeTruth1",
+                                            "SomeTruth1",
                                             0),
     ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-2",
                                             MHD_HTTP_OK,
                                             "recover-secret-1",
                                             1,
-                                            "HashOfSomeTruth2",
+                                            "SomeTruth2",
                                             0),
 
     ANASTASIS_TESTING_cmd_challenge_start ("challenge-start-1",
@@ -324,12 +317,10 @@ run (void *cls,
                                           "EUR:1.01",
                                           "EUR:1", /* must match ANNUAL_FEE in 
config! */
                                           NULL),
-
     ANASTASIS_TESTING_cmd_challenge_start ("challenge-start-2",
                                            MHD_HTTP_OK,
                                            "recover-secret-1",
                                            2),
-
     ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-3",
                                             MHD_HTTP_OK,
                                             "recover-secret-1",
diff --git a/src/testing/test_anastasis_api.c b/src/testing/test_anastasis_api.c
index ab80b83..89bbd2f 100644
--- a/src/testing/test_anastasis_api.c
+++ b/src/testing/test_anastasis_api.c
@@ -1,6 +1,6 @@
 /*
   This file is part of Anastasis
-  Copyright (C) 2020 Taler Systems SA
+  Copyright (C) 2020, 2021 Taler Systems SA
 
   Anastasis is free software; you can redistribute it and/or modify it under 
the
   terms of the GNU Lesser General Public License as published by the Free 
Software
@@ -114,8 +114,8 @@ static char *answer_str;
 
 
 /**
- * Execute the taler-exchange-wirewatch command with
- * our configuration file.
+ * Execute the taler-exchange-wirewatch command with our configuration
+ * file.
  *
  * @param label label to use for the command.
  */
@@ -147,8 +147,7 @@ cmd_transfer_to_exchange (const char *label,
 
 
 /**
- * Main function that will tell the interpreter what commands to
- * run.
+ * Main function that will tell the interpreter what commands to run.
  *
  * @param cls closure
  */
@@ -156,60 +155,39 @@ static void
 run (void *cls,
      struct TALER_TESTING_Interpreter *is)
 {
-  struct TALER_TESTING_Command pay[] = {
-    /**
-     * Move money to the exchange's bank account.
-     */
+  struct TALER_TESTING_Command withdraw[] = {
     cmd_transfer_to_exchange ("create-reserve-1",
                               "EUR:10.02"),
-    /**
-     * Make a reserve exist, according to the previous
-     * transfer.
-     */
     cmd_exec_wirewatch ("wirewatch-1"),
-    TALER_TESTING_cmd_withdraw_amount
-      ("withdraw-coin-1",
-      "create-reserve-1",
-      "EUR:5",
-      MHD_HTTP_OK),
-    TALER_TESTING_cmd_withdraw_amount
-      ("withdraw-coin-2",
-      "create-reserve-1",
-      "EUR:5",
-      MHD_HTTP_OK),
-
-    /**
-     * Check the reserve is depleted.
-     */
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
+                                       "create-reserve-1",
+                                       "EUR:5",
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2",
+                                       "create-reserve-1",
+                                       "EUR:5",
+                                       MHD_HTTP_OK),
     TALER_TESTING_cmd_status ("withdraw-status-1",
                               "create-reserve-1",
                               "EUR:0",
                               MHD_HTTP_OK),
-
     TALER_TESTING_cmd_end ()
   };
 
   struct TALER_TESTING_Command policy[] = {
-
-    // FIXME: Code for policy handling
-
     ANASTASIS_TESTING_cmd_policy_store ("policy-store-1",
                                         anastasis_url,
                                         NULL /* prev upload */,
-                                        NULL /* last upload */,
                                         MHD_HTTP_PAYMENT_REQUIRED,
                                         ANASTASIS_TESTING_PSO_NONE,
                                         "Test-1",
                                         strlen ("Test-1")),
-
     /* what would we have to pay? */
-
     TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal",
                                             merchant_url,
                                             MHD_HTTP_OK,
                                             "policy-store-1",
                                             NULL),
-
     /* make the payment */
     TALER_TESTING_cmd_merchant_pay_order ("pay-account",
                                           merchant_url,
@@ -219,72 +197,61 @@ run (void *cls,
                                           "EUR:5",
                                           "EUR:4.99", /* must match ANNUAL_FEE 
in config! */
                                           NULL),
-
     ANASTASIS_TESTING_cmd_policy_store ("policy-store-2",
                                         anastasis_url,
                                         "policy-store-1",
-                                        NULL /* last upload */,
                                         MHD_HTTP_NO_CONTENT,
                                         ANASTASIS_TESTING_PSO_NONE,
                                         "Test-1",
                                         strlen ("Test-1")),
-
     ANASTASIS_TESTING_cmd_policy_lookup ("policy-lookup-1",
                                          anastasis_url,
                                          MHD_HTTP_OK,
                                          "policy-store-2"),
-
-
     TALER_TESTING_cmd_end ()
   };
 
   struct TALER_TESTING_Command truth[] = {
-    ANASTASIS_TESTING_cmd_truth_store ("truth-store-1",
-                                       anastasis_url,
-                                       NULL,
-                                       MHD_HTTP_NO_CONTENT,
-                                       ANASTASIS_TESTING_TSO_NONE,
-                                       ANASTASIS_TESTING_make_truth_example (
-                                         "question",
-                                         "Truth mime",
-                                         ANASTASIS_TESTING_make_hashed_answer (
-                                           "Hashed-Answer",
-                                           strlen ("Hashed-Answer")),
-                                         ANASTASIS_TESTING_make_truthkey (
-                                           "Truth-Key"))),
-
-    ANASTASIS_TESTING_cmd_keyshare_lookup ("keyshare-lookup-1",
-                                           anastasis_url,
-                                           MHD_HTTP_OK,
-                                           answer_str,
-                                           ANASTASIS_TESTING_make_truthkey (
-                                             "Truth-Key"),
-                                           NULL,
-                                           0,
-                                           "truth-store-1",
-                                           0),
-
-    ANASTASIS_TESTING_cmd_truth_store ("truth-store-2",
-                                       anastasis_url,
-                                       NULL,
-                                       MHD_HTTP_NO_CONTENT,
-                                       ANASTASIS_TESTING_TSO_NONE,
-                                       ANASTASIS_TESTING_make_truth_example (
-                                         "file",
-                                         "Truth mime",
-                                         ANASTASIS_TESTING_make_hashed_answer (
-                                           "Hashed-Answer-2",
-                                           strlen ("Hashed-Answer-2")),
-                                         ANASTASIS_TESTING_make_truthkey (
-                                           "Truth-Key-2"))),
-
-    ANASTASIS_TESTING_cmd_challenge_run ("challenge-run-1",
-                                         anastasis_url,
-                                         MHD_HTTP_PAYMENT_REQUIRED,
-                                         ANASTASIS_TESTING_make_truthkey (
-                                           "Truth-Key-2"),
-                                         "truth-store-2",
-                                         NULL),
+    ANASTASIS_TESTING_cmd_truth_store (
+      "truth-store-1",
+      anastasis_url,
+      NULL,
+      MHD_HTTP_NO_CONTENT,
+      ANASTASIS_TESTING_TSO_NONE,
+      ANASTASIS_TESTING_make_truth_example (
+        "question",
+        "Truth mime",
+        ANASTASIS_TESTING_make_hashed_answer ("Hashed-Answer",
+                                              strlen ("Hashed-Answer")),
+        ANASTASIS_TESTING_make_truthkey ("Truth-Key"))),
+    ANASTASIS_TESTING_cmd_keyshare_lookup (
+      "keyshare-lookup-1",
+      anastasis_url,
+      MHD_HTTP_OK,
+      answer_str,
+      ANASTASIS_TESTING_make_truthkey ("Truth-Key"),
+      NULL,
+      "truth-store-1",
+      0),
+    ANASTASIS_TESTING_cmd_truth_store (
+      "truth-store-2",
+      anastasis_url,
+      NULL,
+      MHD_HTTP_NO_CONTENT,
+      ANASTASIS_TESTING_TSO_NONE,
+      ANASTASIS_TESTING_make_truth_example (
+        "file",
+        "Truth mime",
+        ANASTASIS_TESTING_make_hashed_answer ("Hashed-Answer-2",
+                                              strlen ("Hashed-Answer-2")),
+        ANASTASIS_TESTING_make_truthkey ("Truth-Key-2"))),
+    ANASTASIS_TESTING_cmd_challenge_run (
+      "challenge-run-1",
+      anastasis_url,
+      MHD_HTTP_PAYMENT_REQUIRED,
+      ANASTASIS_TESTING_make_truthkey ("Truth-Key-2"),
+      "truth-store-2",
+      NULL),
     /* what would we have to pay? */
     TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal-2",
                                             merchant_url,
@@ -300,32 +267,22 @@ run (void *cls,
                                           "EUR:1.01",
                                           "EUR:1",
                                           NULL),
-
-    ANASTASIS_TESTING_cmd_challenge_run ("challenge-run-2",
-                                         anastasis_url,
-                                         MHD_HTTP_OK,
-                                         ANASTASIS_TESTING_make_truthkey (
-                                           "Truth-Key-2"),
-                                         "truth-store-2",
-                                         "challenge-run-1"),
-
-    ANASTASIS_TESTING_cmd_keyshare_lookup ("keyshare-lookup-2",
-                                           anastasis_url,
-                                           MHD_HTTP_OK,
-                                           "challenge-run-2",
-                                           ANASTASIS_TESTING_make_truthkey (
-                                             "Truth-Key-2"),
-                                           "challenge-run-1",
-                                           1,
-                                           "truth-store-2",
-                                           1),
-    TALER_TESTING_cmd_end ()
-  };
-
-  struct TALER_TESTING_Command salt[] = {
-    ANASTASIS_TESTING_cmd_salt ("salt-request-1",
-                                anastasis_url,
-                                MHD_HTTP_OK),
+    ANASTASIS_TESTING_cmd_challenge_run (
+      "challenge-run-2",
+      anastasis_url,
+      MHD_HTTP_OK,
+      ANASTASIS_TESTING_make_truthkey ("Truth-Key-2"),
+      "truth-store-2",
+      "challenge-run-1"),
+    ANASTASIS_TESTING_cmd_keyshare_lookup (
+      "keyshare-lookup-2",
+      anastasis_url,
+      MHD_HTTP_OK,
+      "challenge-run-2",
+      ANASTASIS_TESTING_make_truthkey ("Truth-Key-2"),
+      "challenge-run-1",
+      "truth-store-2",
+      1),
     TALER_TESTING_cmd_end ()
   };
 
@@ -352,23 +309,15 @@ run (void *cls,
                                                merchant_payto,
                                                "EUR",
                                                MHD_HTTP_NO_CONTENT),
-    TALER_TESTING_cmd_batch ("pay",
-                             pay),
-
+    ANASTASIS_TESTING_cmd_salt ("salt-request-1",
+                                anastasis_url,
+                                MHD_HTTP_OK),
+    TALER_TESTING_cmd_batch ("withdraw",
+                             withdraw),
     TALER_TESTING_cmd_batch ("policy",
                              policy),
-
     TALER_TESTING_cmd_batch ("truth",
                              truth),
-
-    TALER_TESTING_cmd_batch ("salt",
-                             salt),
-
-
-    /**
-     * End the suite.  Fixme: better to have a label for this
-     * too, as it shows a "(null)" token on logs.
-     */
     TALER_TESTING_cmd_end ()
   };
 
@@ -383,17 +332,11 @@ main (int argc,
       char *const *argv)
 {
   struct GNUNET_HashCode hash;
-  hash = ANASTASIS_TESTING_make_hashed_answer (
-    "Hashed-Answer",
-    strlen ("Hashed-Answer"));
-  answer_str = GNUNET_STRINGS_data_to_string_alloc (&hash,
-                                                    sizeof(struct
-                                                           GNUNET_HashCode));
-  unsigned int ret;
+  int ret;
+
   /* These environment variables get in the way... */
   unsetenv ("XDG_DATA_HOME");
   unsetenv ("XDG_CONFIG_HOME");
-
   GNUNET_log_setup ("test-anastasis-api",
                     "DEBUG",
                     NULL);
@@ -429,17 +372,27 @@ main (int argc,
     if (NULL == (merchantd =
                    TALER_TESTING_run_merchant (CONFIG_FILE,
                                                merchant_url)))
+    {
+      GNUNET_break (0);
       return 1;
-
+    }
     if (NULL == (anastasisd =
                    ANASTASIS_TESTING_run_anastasis (CONFIG_FILE,
                                                     anastasis_url)))
+    {
+      GNUNET_break (0);
       return 1;
+    }
+    hash = ANASTASIS_TESTING_make_hashed_answer ("Hashed-Answer",
+                                                 strlen ("Hashed-Answer"));
+    answer_str = GNUNET_STRINGS_data_to_string_alloc (
+      &hash,
+      sizeof(struct GNUNET_HashCode));
 
     ret = TALER_TESTING_setup_with_exchange (&run,
                                              NULL,
                                              CONFIG_FILE);
-
+    GNUNET_free (answer_str);
     GNUNET_OS_process_kill (merchantd,
                             SIGTERM);
     GNUNET_OS_process_kill (anastasisd,
@@ -452,7 +405,11 @@ main (int argc,
     GNUNET_free (anastasis_url);
 
     if (GNUNET_OK != ret)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Test failed in interpreter\n");
       return 1;
+    }
     break;
   default:
     GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_policy_store.c 
b/src/testing/testing_api_cmd_policy_store.c
index e805d5c..aaa0fd8 100644
--- a/src/testing/testing_api_cmd_policy_store.c
+++ b/src/testing/testing_api_cmd_policy_store.c
@@ -410,20 +410,6 @@ policy_store_traits (void *cls,
 }
 
 
-/**
- * Make the "policy store" command.
- *
- * @param label command label
- * @param anastasis_url base URL of the anastasis serving
- *        the policy store request.
- * @param prev_upload reference to a previous upload we are
- *        supposed to update, NULL for none
- * @param http_status expected HTTP status.
- * @param pso policy store options
- * @param recovery_data recovery data to post
- * @param recovery_data_size size of recovery/policy data
- * @return the command
- */
 struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_policy_store (
   const char *label,
diff --git a/src/testing/testing_api_cmd_truth_store.c 
b/src/testing/testing_api_cmd_truth_store.c
index fb860dc..64318a1 100644
--- a/src/testing/testing_api_cmd_truth_store.c
+++ b/src/testing/testing_api_cmd_truth_store.c
@@ -108,7 +108,7 @@ struct TruthStoreState
  */
 static void
 truth_store_cb (void *cls,
-                enum ANASTASIS_ErrorCode ec,
+                enum TALER_ErrorCode ec,
                 unsigned int http_status,
                 const struct ANASTASIS_UploadDetails *ud)
 {
diff --git a/src/testing/testing_api_helpers.c 
b/src/testing/testing_api_helpers.c
index 94aeec2..66e7032 100644
--- a/src/testing/testing_api_helpers.c
+++ b/src/testing/testing_api_helpers.c
@@ -25,7 +25,6 @@
  */
 
 #include "platform.h"
-#include <taler/taler_testing_lib.h>
 #include "anastasis_testing_lib.h"
 #include <gnunet/gnunet_curl_lib.h>
 
diff --git a/src/testing/testing_cmd_policy_create.c 
b/src/testing/testing_cmd_policy_create.c
index b9edc37..fc9ed44 100644
--- a/src/testing/testing_cmd_policy_create.c
+++ b/src/testing/testing_cmd_policy_create.c
@@ -76,11 +76,6 @@ policy_create_run (void *cls,
 
   GNUNET_assert (pcs->cmd_label_array_length > 0);
   GNUNET_assert (NULL != pcs->cmd_label_array);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d cmd label array length is %i\n", __FILE__, __LINE__,
-              pcs->cmd_label_array_length);
-
   pcs->is = is;
   if (NULL != pcs->cmd_label_array)
   {
@@ -89,13 +84,8 @@ policy_create_run (void *cls,
       const struct TALER_TESTING_Command *ref;
       const struct ANASTASIS_Truth *truth;
 
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "At %s:%d truth upload cmd is %s\n", __FILE__, __LINE__,
-                  pcs->cmd_label_array[i]);
-
-      ref = TALER_TESTING_interpreter_lookup_command
-              (is,
-              pcs->cmd_label_array[i]);
+      ref = TALER_TESTING_interpreter_lookup_command (is,
+                                                      pcs->cmd_label_array[i]);
       if (NULL == ref)
       {
         GNUNET_break (0);
@@ -181,49 +171,37 @@ policy_create_traits (void *cls,
 }
 
 
-/**
- * Make the "policy create" command.
- *
- * @param label command label
- * @param ... NULL-terminated list of truth upload commands
- * @return the command
- */
 struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_policy_create (const char *label,
                                      ...)
 {
   struct PolicyCreateState *pcs;
   va_list ap;
+  const char *truth_upload_cmd;
 
   pcs = GNUNET_new (struct PolicyCreateState);
   pcs->label = label;
 
-  va_start (ap, label);
-  const char *truth_upload_cmd;
+  va_start (ap,
+            label);
   while (NULL != (truth_upload_cmd = va_arg (ap, const char *)))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "At %s:%d truth upload cmd is %s\n", __FILE__, __LINE__,
-                truth_upload_cmd);
     GNUNET_array_append (pcs->cmd_label_array,
                          pcs->cmd_label_array_length,
                          truth_upload_cmd);
   }
   va_end (ap);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "At %s:%d cmd label array length is %i\n", __FILE__, __LINE__,
-              pcs->cmd_label_array_length);
-
-  struct TALER_TESTING_Command cmd = {
-    .cls = pcs,
-    .label = label,
-    .run = &policy_create_run,
-    .cleanup = &policy_create_cleanup,
-    .traits = &policy_create_traits
-  };
-
-  return cmd;
+  {
+    struct TALER_TESTING_Command cmd = {
+      .cls = pcs,
+      .label = label,
+      .run = &policy_create_run,
+      .cleanup = &policy_create_cleanup,
+      .traits = &policy_create_traits
+    };
+
+    return cmd;
+  }
 }
 
 
diff --git a/src/testing/testing_cmd_truth_upload.c 
b/src/testing/testing_cmd_truth_upload.c
index 49912c9..1d858af 100644
--- a/src/testing/testing_cmd_truth_upload.c
+++ b/src/testing/testing_cmd_truth_upload.c
@@ -125,7 +125,7 @@ struct TruthUploadState
  */
 static void
 truth_upload_cb (void *cls,
-                 enum ANASTASIS_ErrorCode ec,
+                 enum TALER_ErrorCode ec,
                  struct ANASTASIS_Truth *t,
                  const struct ANASTASIS_UploadDetails *ud)
 {
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index fc48e55..84a2f36 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -31,8 +31,8 @@ lib_LTLIBRARIES = \
 
 libanastasisutil_la_SOURCES = \
   anastasis_crypto.c \
-       child_management.c \
-       os_installation.c
+  child_management.c \
+  os_installation.c
 libanastasisutil_la_LIBADD = \
   -lgnunetutil \
   $(LIBGCRYPT_LIBS) \

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