gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated (90cf924 -> 34a76cc)


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated (90cf924 -> 34a76cc)
Date: Tue, 27 Jun 2017 16:59:29 +0200

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

grothoff pushed a change to branch master
in repository merchant.

    from 90cf924  convert merchant postgres plugin (in large parts) to latest 
PQ API as part of #5010-fix
     new 7cbda83  remove dead macros
     new 9c9e6db  get rid of select *, remove fixme that is no longer needed
     new d1544d0  fix logical order of functions
     new 75187c5  more #5010-related work on backenddb
     new 34a76cc  more #5010-related work on backenddb testcase

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backenddb/plugin_merchantdb_postgres.c | 308 +++++++++++------------------
 src/backenddb/test_merchantdb.c            |  68 ++++---
 src/include/taler_merchantdb_plugin.h      |  24 +--
 3 files changed, 166 insertions(+), 234 deletions(-)

diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 827891c..5dc0901 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -43,66 +43,6 @@ struct PostgresClosure
 
 };
 
-/**
- * Error code returned by Postgres for deadlock.
- * FIXME: no threads, really needed?
- */
-#define PQ_DIAG_SQLSTATE_DEADLOCK "40P01"
-
-/**
- * Error code returned by Postgres on serialization failure.
- */
-#define PQ_DIAG_SQLSTATE_SERIALIZATION_FAILURE "40001"
-
-/**
- * Extract error code.
- *
- * @param res postgres result object with error details
- */
-#define EXTRACT_DB_ERROR(res)                                         \
-  PQresultErrorField(res, PG_DIAG_SQLSTATE)
-
-/**
- * Log a query error.
- *
- * @param result PQ result object of the query that failed
- * @param conn SQL connection that was used
- */
-#define QUERY_ERR(result,conn)                         \
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,             \
-              "Query failed at %s:%u: %s/%s/%s/%s/%s\n", \
-              __FILE__, __LINE__, \
-              PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY), \
-              PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL), \
-              PQresultErrorMessage (result), \
-              PQresStatus (PQresultStatus (result)), \
-              PQerrorMessage (conn));
-
-/**
- * Log error from PostGres.
- *
- * @param kind log level to use
- * @param cmd command that failed
- * @param res postgres result object with error details
- */
-#define PQSQL_strerror(kind, cmd, res)                                \
-  GNUNET_log_from (kind, "merchantdb-postgres",                       \
-                   "SQL %s failed at %s:%u with error: %s",           \
-                   cmd, __FILE__, __LINE__, PQresultErrorMessage (res));
-
-
-/**
- * Log a really unexpected PQ error.
- *
- * @param result PQ result object of the PQ operation that failed
- */
-#define BREAK_DB_ERR(result) do {               \
-    GNUNET_break (0);                           \
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,        \
-                "Database failure: %s\n",       \
-                PQresultErrorMessage (result)); \
-  } while (0)
-
 
 /**
  * Drop merchant tables
@@ -401,7 +341,17 @@ postgres_initialize (void *cls)
                             " LIMIT $3",
                             3),
     GNUNET_PQ_make_prepare ("find_refunds_from_contract_terms_hash",
-                            "SELECT * FROM merchant_refunds"
+                            "SELECT"
+                           "coin_pub"
+                           ",rtransaction_id"
+                           ",refund_amount_val"
+                           ",refund_amount_frac"
+                           ",refund_amount_curr"
+                           ",refund_fee_val"
+                           ",refund_fee_frac"
+                           ",refund_fee_curr"
+                           ",reason"
+                           " FROM merchant_refunds"
                             " WHERE merchant_pub=$1"
                             " AND h_contract_terms=$2",
                             2),
@@ -959,22 +909,20 @@ find_contracts_cb (void *cls,
  */
 static enum GNUNET_DB_QueryStatus
 postgres_find_contract_terms_by_date_and_range (void *cls,
-                                               struct GNUNET_TIME_Absolute 
date,
-                                               const struct 
TALER_MerchantPublicKeyP *merchant_pub,
-                                               unsigned int start,
-                                               unsigned int nrows,
-                                               unsigned int future,
-                                               
TALER_MERCHANTDB_ProposalDataCallback cb,
-                                               void *cb_cls)
+                                               struct GNUNET_TIME_Absolute 
date,
+                                               const struct 
TALER_MerchantPublicKeyP *merchant_pub,
+                                               uint64_t start,
+                                               uint64_t nrows,
+                                               int future,
+                                               
TALER_MERCHANTDB_ProposalDataCallback cb,
+                                               void *cb_cls)
 {
-  uint64_t s64 = start;
-  uint64_t r64 = nrows;
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_absolute_time (&date),
     GNUNET_PQ_query_param_auto_from_type (merchant_pub),
-    GNUNET_PQ_query_param_uint64 (&s64),
-    GNUNET_PQ_query_param_uint64 (&r64),
+    GNUNET_PQ_query_param_uint64 (&start),
+    GNUNET_PQ_query_param_uint64 (&nrows),
     GNUNET_PQ_query_param_end
   };
   const char *stmt;
@@ -1016,16 +964,15 @@ static enum GNUNET_DB_QueryStatus
 postgres_find_contract_terms_by_date (void *cls,
                                      struct GNUNET_TIME_Absolute date,
                                      const struct TALER_MerchantPublicKeyP 
*merchant_pub,
-                                     unsigned int nrows,
+                                     uint64_t nrows,
                                      TALER_MERCHANTDB_ProposalDataCallback cb,
                                      void *cb_cls)
 {
   struct PostgresClosure *pg = cls;
-  uint64_t r64 = nrows;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_absolute_time (&date),
     GNUNET_PQ_query_param_auto_from_type (merchant_pub),
-    GNUNET_PQ_query_param_uint64 (&r64),
+    GNUNET_PQ_query_param_uint64 (&nrows),
     GNUNET_PQ_query_param_end
   };
   enum GNUNET_DB_QueryStatus qs;
@@ -1671,9 +1618,6 @@ get_refunds_cb (void *cls,
                                     &rtransaction_id),
       TALER_PQ_result_spec_amount ("refund_amount",
                                    &refund_amount),
-      /**
-       * BUGGY: this column is not in that table.
-       */
       TALER_PQ_result_spec_amount ("refund_fee",
                                    &refund_fee),
       GNUNET_PQ_result_spec_string ("reason",
@@ -1742,17 +1686,55 @@ postgres_get_refunds_from_contract_terms_hash (void 
*cls,
 
 
 /**
+ * Insert a refund row into merchant_refunds.  Not meant to be exported
+ * in the db API.
+ *
+ * @param cls closure, tipically a connection to the db
+ * @param merchant_pub merchant instance public key
+ * @param h_contract_terms hashcode of the contract related to this refund
+ * @param coin_pub public key of the coin giving the (part of) refund
+ * @param reason human readable explaination behind the refund
+ * @param refund how much this coin is refunding
+ * @param refund_fee refund fee for this coin
+ */
+enum GNUNET_DB_QueryStatus
+insert_refund (void *cls,
+               const struct TALER_MerchantPublicKeyP *merchant_pub,
+               const struct GNUNET_HashCode *h_contract_terms,
+               const struct TALER_CoinSpendPublicKeyP *coin_pub,
+               const char *reason,
+               const struct TALER_Amount *refund,
+               const struct TALER_Amount *refund_fee)
+{
+  struct PostgresClosure *pg = cls;
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_auto_from_type (merchant_pub),
+    GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
+    GNUNET_PQ_query_param_auto_from_type (coin_pub),
+    GNUNET_PQ_query_param_string (reason),
+    TALER_PQ_query_param_amount (refund),
+    TALER_PQ_query_param_amount (refund_fee),
+    GNUNET_PQ_query_param_end
+  };
+  
+  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+                                             "insert_refund",
+                                             params);
+}
+
+
+/**
  * Closure for #process_refund_cb.
  */
 struct FindRefundContext
 {
   /**
-   *
+   * Updated to reflect total amount refunded so far.
    */
   struct TALER_Amount refunded_amount;
 
   /**
-   *
+   * Set to #GNUNET_SYSERR on hard errors.
    */
   int err;
 };
@@ -1816,11 +1798,6 @@ struct InsertRefundContext
   struct PostgresClosure *pg;
 
   /**
-   * Return code for the caller: GNUNET_NO, GNUNET_OK, GNUNET_SYSERR
-   */
-  int err;
-
-  /**
    * Amount to which increase the refund for this contract
    */
   struct TALER_Amount *refund;
@@ -1839,47 +1816,15 @@ struct InsertRefundContext
    * Human-readable reason behind this refund
    */
   const char *reason;
+
+  /**
+   * Transaction status code.
+   */
+  enum GNUNET_DB_QueryStatus qs;
 };
 
 
 /**
- * Insert a refund row into merchant_refunds.  Not meant to be exported
- * in the db API.
- *
- * @param cls closure, tipically a connection to the db
- * @param merchant_pub merchant instance public key
- * @param h_contract_terms hashcode of the contract related to this refund
- * @param coin_pub public key of the coin giving the (part of) refund
- * @param reason human readable explaination behind the refund
- * @param refund how much this coin is refunding
- * @param refund_fee refund fee for this coin
- */
-enum GNUNET_DB_QueryStatus
-insert_refund (void *cls,
-               const struct TALER_MerchantPublicKeyP *merchant_pub,
-               const struct GNUNET_HashCode *h_contract_terms,
-               const struct TALER_CoinSpendPublicKeyP *coin_pub,
-               const char *reason,
-               const struct TALER_Amount *refund,
-               const struct TALER_Amount *refund_fee)
-{
-  struct PostgresClosure *pg = cls;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (merchant_pub),
-    GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
-    GNUNET_PQ_query_param_auto_from_type (coin_pub),
-    GNUNET_PQ_query_param_string (reason),
-    TALER_PQ_query_param_amount (refund),
-    TALER_PQ_query_param_amount (refund_fee),
-    GNUNET_PQ_query_param_end
-  };
-  
-  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             "insert_refund",
-                                             params);
-}
-
-/**
  * Function to be called with the results of a SELECT statement
  * that has returned @a num_results results.
  *
@@ -1929,7 +1874,7 @@ process_deposits_cb (void *cls,
                                   i))
     {
       GNUNET_break (0);
-      ctx->err = GNUNET_SYSERR;
+      ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
       return;
     }
 
@@ -1947,29 +1892,27 @@ process_deposits_cb (void *cls,
                                                  &ictx);
     if ( (GNUNET_OK != ictx.err) ||
          (GNUNET_DB_STATUS_HARD_ERROR == ires) )
-    {
-      ctx->err = GNUNET_SYSERR;
-      goto rollback;
+    { 
+      GNUNET_break (0);
+      ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
+      return;
     }
     if (GNUNET_DB_STATUS_SOFT_ERROR == ires)
-    { ctx->err = GNUNET_SYSERR;
-      goto rollback; // FIXME: #5010: actually rollback + retry!
+    {
+      ctx->qs = GNUNET_DB_STATUS_SOFT_ERROR;
+      return;
     }
 
-    /*How much coin i will give for refund: needed by merchant_refunds table*/
+    /* How much coin i will give for refund: needed by
+       merchant_refunds table*/
     if (GNUNET_SYSERR ==
-       TALER_amount_subtract (&diff, // to commit as refund
+       TALER_amount_subtract (&diff, 
                               &amount_with_fee,
                               &ictx.refunded_amount))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not compute refundable amount out of coin (%s),"
-                  " attempted subtraction: %s - %s\n",
-                  TALER_B2S (&coin_pub),
-                  TALER_amount_to_string (&amount_with_fee),
-                  TALER_amount_to_string (&ictx.refunded_amount));
-      ctx->err = GNUNET_SYSERR;
-      goto rollback;
+      GNUNET_break (0);
+      ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
+      return;
     }
 
     /**
@@ -1977,41 +1920,31 @@ process_deposits_cb (void *cls,
      * refund.  If this value will exceed the current awarded refund, we'll 
return
      * GNUNET_NO
      */
-    if (GNUNET_SYSERR == TALER_amount_add (&previous_refund,
-                                           &previous_refund,
-                                           &ictx.refunded_amount))
+    if (GNUNET_SYSERR ==
+       TALER_amount_add (&previous_refund,
+                         &previous_refund,
+                         &ictx.refunded_amount))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not compute sum of previous refunds for coin (%s),"
-                  " attempted sum: %s - %s\n",
-                  TALER_B2S (&coin_pub),
-                  TALER_amount_to_string (&previous_refund),
-                  TALER_amount_to_string (&ictx.refunded_amount));
-      ctx->err = GNUNET_SYSERR;
-      goto rollback;
+      GNUNET_break (0);
+      ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
+      return;
     }
 
-
     big = ctx->refund;
     small = &ictx.refunded_amount;
-
     if (-1 == TALER_amount_cmp (big, small))
     {
       big = &ictx.refunded_amount;
       small = ctx->refund;
     }
 
-    /*Subtract from refund what has already been awarded*/
+    /* Subtract from refund what has already been awarded */
     if (GNUNET_SYSERR ==
        TALER_amount_subtract (big,
                               big,
                               small))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not subtract previous refund amount, attempted 
operation was:"
-                  " %s - %s\n",
-                  TALER_amount_to_string (big),
-                  TALER_amount_to_string (small));
+      GNUNET_break (0);
     }
 
     /**
@@ -2024,7 +1957,8 @@ process_deposits_cb (void *cls,
     big = ctx->refund;
     small = &diff;
 
-    if (-1 == TALER_amount_cmp (big, small))
+    if (-1 == TALER_amount_cmp (big,
+                               small))
     {
       big = &diff;
       small = ctx->refund;
@@ -2046,23 +1980,19 @@ process_deposits_cb (void *cls,
     if ( (0 != small->value) ||
         (0 != small->fraction) )
     {
+      enum GNUNET_DB_QueryStatus qs;
+      
       if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
-            insert_refund (ctx->pg,
-                           ctx->merchant_pub,
-                           ctx->h_contract_terms,
-                           &coin_pub,
-                           ctx->reason,
-                           small,
-                           &refund_fee))
+         (qs = insert_refund (ctx->pg,
+                              ctx->merchant_pub,
+                              ctx->h_contract_terms,
+                              &coin_pub,
+                              ctx->reason,
+                              small,
+                              &refund_fee)))
       {
-       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                   "Could not commit refund worth %s for coin '%s'"
-                   ", as of contract/reason: %s/%s\n",
-                   TALER_amount_to_string (small),
-                   TALER_B2S (&coin_pub),
-                   GNUNET_h2s (ctx->h_contract_terms),
-                   ctx->reason); 
-       ctx->err = GNUNET_SYSERR;
+       GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+       ctx->qs = qs;
        return;    
       }
     }
@@ -2094,7 +2024,7 @@ process_deposits_cb (void *cls,
                 "awarded one. %s vs %s\n",
                 TALER_amount_to_string (&attempted_refund),
                 TALER_amount_to_string (&previous_refund));
-    ctx->err = GNUNET_NO;
+    ctx->qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
     return;  
   }
 
@@ -2106,24 +2036,16 @@ process_deposits_cb (void *cls,
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "This refund is bigger than the coins capacity\n");
-    ctx->err = GNUNET_NO;
+    ctx->qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
     return;
   }
 
   /**
-   * NOTE: we don't check if all the refund has been covered.
-   * Although this should be checked, it's safe to assume yes,
-   * as the business will never issue a refund bigger than the
-   * contract's actual price.
+   * FIXME: We should check if all the refund has been covered.
+   * Although this should be checked as the business should never
+   * issue a refund bigger than the contract's actual price, we cannot
+   * rely upon the frontend being correct.
    */
-  ctx->err = GNUNET_OK;
-  return;
-
- rollback:
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-             "Failed transaction, doing rollback\n");
-  PQclear (result);
-  postgres_rollback (ctx->pg);
 }
 
 
@@ -2167,7 +2089,7 @@ postgres_increase_refund_for_contract (void *cls,
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
   ctx.pg = pg;
-  ctx.err = GNUNET_OK;
+  ctx.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
   ctx.refund = &_refund;
   ctx.reason = reason;
   ctx.h_contract_terms = h_contract_terms;
@@ -2184,13 +2106,19 @@ postgres_increase_refund_for_contract (void *cls,
                 "Unknown contract: %s (merchant_pub: %s), no refund 
possible\n",
                 GNUNET_h2s (h_contract_terms),
                 TALER_B2S (merchant_pub));
+    postgres_rollback (cls);
     return qs;
   case GNUNET_DB_STATUS_SOFT_ERROR:
-    return qs;
   case GNUNET_DB_STATUS_HARD_ERROR:
+    postgres_rollback (cls);
     return qs;
   default:
     /* Got one or more deposits */
+    if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != ctx.qs)
+    {
+      postgres_rollback (cls);
+      return qs;
+    }
     qs = postgres_commit (cls);
     if (0 > qs)
     {
@@ -2199,7 +2127,7 @@ postgres_increase_refund_for_contract (void *cls,
       return qs;
     }
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-               "Committed db transaction\n");
+               "Committed refund transaction\n");
     return qs;
   }
 }
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 13d7862..03a0e07 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  (C) 2014, 2015, 2016 INRIA
+  (C) 2014-2017 INRIA
 
   TALER 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
@@ -188,7 +188,6 @@ static json_t *contract_terms;
 static json_t *contract_terms_future;
 
 
-
 /**
  * Function called with information about a transaction.
  *
@@ -229,6 +228,7 @@ transaction_cb (void *cls,
                                 &amount_with_fee));
 }
 
+
 /**
  * Function called with information about a refund.
  *
@@ -239,18 +239,20 @@ transaction_cb (void *cls,
  * @param refund_amount refund amount which is being taken from coin_pub
  * @param refund_fee cost of this refund operation
  */
-void
-refund_cb(void *cls,
-          const struct TALER_CoinSpendPublicKeyP *coin_pub,
-          uint64_t rtransaction_id,
-          const char *reason,
-          const struct TALER_Amount *refund_amount,
-          const struct TALER_Amount *refund_fee)
+static void
+refund_cb (void *cls,
+          const struct TALER_CoinSpendPublicKeyP *coin_pub,
+          uint64_t rtransaction_id,
+          const char *reason,
+          const struct TALER_Amount *refund_amount,
+          const struct TALER_Amount *refund_fee)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "refund_cb\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "refund_cb\n");
   /* FIXME, more logic here? */
 }
 
+
 /**
  * Callback for `find_contract_terms_by_date`.
  *
@@ -268,6 +270,7 @@ pd_cb (void *cls,
   return;
 }
 
+
 /**
  * Function called with information about a coin that was deposited.
  *
@@ -452,7 +455,7 @@ run (void *cls)
   TALER_JSON_hash (contract_terms,
                    &h_contract_terms);
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->insert_contract_terms (plugin->cls,
                                         order_id,
                                         &merchant_pub,
@@ -461,20 +464,20 @@ run (void *cls)
 
   json_t *out;
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_contract_terms (plugin->cls,
                                       &out,
                                       order_id,
                                       &merchant_pub));
 
-  FAILIF (GNUNET_OK !=
-          plugin->find_contract_terms_history (plugin->cls,
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+         plugin->find_contract_terms_history (plugin->cls,
                                               order_id,
                                               &merchant_pub,
                                               &pd_cb,
                                               NULL));
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_contract_terms_from_hash (plugin->cls,
                                                 &out,
                                                 &h_contract_terms,
@@ -491,7 +494,7 @@ run (void *cls)
   timestamp = GNUNET_TIME_absolute_get ();
   GNUNET_TIME_round_abs (&timestamp);
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->insert_contract_terms (plugin->cls,
                                         order_id_future,
                                         &merchant_pub,
@@ -518,7 +521,7 @@ run (void *cls)
                                               &pd_cb,
                                               NULL));
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_transaction (plugin->cls,
                                      &h_contract_terms,
                                     &merchant_pub,
@@ -527,7 +530,7 @@ run (void *cls)
                                      timestamp,
                                      refund_deadline,
                                      &amount_with_fee));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_deposit (plugin->cls,
                                  &h_contract_terms,
                                 &merchant_pub,
@@ -537,61 +540,61 @@ run (void *cls)
                                  &refund_fee,
                                  &signkey_pub,
                                  deposit_proof));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_coin_to_transfer (plugin->cls,
                                           &h_contract_terms,
                                           &coin_pub,
                                           &wtid));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_transfer_to_proof (plugin->cls,
                                            EXCHANGE_URI,
                                            &wtid,
                                            GNUNET_TIME_UNIT_ZERO_ABS,
                                            &signkey_pub,
                                            transfer_proof));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_transaction (plugin->cls,
                                     &h_contract_terms,
                                    &merchant_pub,
                                     &transaction_cb,
                                     NULL));
 
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_payments (plugin->cls,
                                  &h_contract_terms,
                                  &merchant_pub,
                                  &deposit_cb,
                                  NULL));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_transfers_by_hash (plugin->cls,
                                           &h_contract_terms,
                                           &transfer_cb,
                                           NULL));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_deposits_by_wtid (plugin->cls,
                                          &wtid,
                                          &deposit_cb,
                                          NULL));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->find_proof_by_wtid (plugin->cls,
                                       EXCHANGE_URI,
                                       &wtid,
                                       &proof_cb,
                                       NULL));
-  FAILIF (GNUNET_NO !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
           plugin->get_refunds_from_contract_terms_hash (plugin->cls,
                                                         &merchant_pub,
                                                         &h_contract_terms,
                                                         &refund_cb,
                                                         NULL));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->increase_refund_for_contract (plugin->cls,
                                                 &h_contract_terms,
                                                 &merchant_pub,
                                                 &refund_amount,
                                                 "refund testing"));
 
-  FAILIF (GNUNET_NO !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
           plugin->increase_refund_for_contract (plugin->cls,
                                                 &h_contract_terms,
                                                 &merchant_pub,
@@ -600,20 +603,20 @@ run (void *cls)
                                                 "the previous one, should 
fail"));
 
   /*Should fail as this refund a lesser amount respect to the previous one*/
-  FAILIF (GNUNET_NO !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
           plugin->increase_refund_for_contract (plugin->cls,
                                                 &h_contract_terms,
                                                 &merchant_pub,
                                                 &little_refund_amount,
                                                 "make refund testing fail"));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->increase_refund_for_contract (plugin->cls,
                                                 &h_contract_terms,
                                                 &merchant_pub,
                                                 &right_second_refund_amount,
                                                 "right refund increase"));
 
-  FAILIF (GNUNET_NO !=
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
           plugin->increase_refund_for_contract (plugin->cls,
                                                 &h_contract_terms,
                                                 &merchant_pub,
@@ -625,7 +628,8 @@ run (void *cls)
     result = 0;
 
  drop:
-  GNUNET_break (GNUNET_OK == plugin->drop_tables (plugin->cls));
+  GNUNET_break (GNUNET_OK ==
+               plugin->drop_tables (plugin->cls));
   TALER_MERCHANTDB_plugin_unload (plugin);
   plugin = NULL;
   if (NULL != deposit_proof)
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index 6f926b1..f856fc7 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -254,13 +254,13 @@ struct TALER_MERCHANTDB_Plugin
    */
   enum GNUNET_DB_QueryStatus
   (*find_contract_terms_by_date_and_range) (void *cls,
-                                           struct GNUNET_TIME_Absolute date,
-                                           const struct 
TALER_MerchantPublicKeyP *merchant_pub,
-                                           unsigned int start,
-                                           unsigned int nrows,
-                                           unsigned int future,
-                                           
TALER_MERCHANTDB_ProposalDataCallback cb,
-                                           void *cb_cls);
+                                           struct GNUNET_TIME_Absolute date,
+                                           const struct 
TALER_MerchantPublicKeyP *merchant_pub,
+                                           uint64_t start,
+                                           uint64_t nrows,
+                                           int future,
+                                           
TALER_MERCHANTDB_ProposalDataCallback cb,
+                                           void *cb_cls);
 
   /**
    * Lookup for a proposal, respecting the signature used by the
@@ -296,11 +296,11 @@ struct TALER_MERCHANTDB_Plugin
    */
   enum GNUNET_DB_QueryStatus
   (*find_contract_terms_by_date) (void *cls,
-                                 struct GNUNET_TIME_Absolute date,
-                                 const struct TALER_MerchantPublicKeyP 
*merchant_pub,
-                                 unsigned int nrows,
-                                 TALER_MERCHANTDB_ProposalDataCallback cb,
-                                 void *cb_cls);
+                                 struct GNUNET_TIME_Absolute date,
+                                 const struct TALER_MerchantPublicKeyP 
*merchant_pub,
+                                 uint64_t nrows,
+                                 TALER_MERCHANTDB_ProposalDataCallback cb,
+                                 void *cb_cls);
 
 
   /**

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



reply via email to

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