gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (5c21cd8d -> 25f93cf0)


From: gnunet
Subject: [taler-exchange] branch master updated (5c21cd8d -> 25f93cf0)
Date: Sat, 09 Dec 2023 13:57:44 +0100

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

oec pushed a change to branch master
in repository exchange.

    from 5c21cd8d use local variable as accumulator in batch-deposit
     new 9454b655 [wip, #7267] added correct response for age commitment 
conflict during deposit
     new cfb64f93 mark out #8002
     new 25f93cf0 mark out #7999

The 3 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/exchange/taler-exchange-httpd_db.c             | 11 +++++------
 src/exchange/taler-exchange-httpd_responses.c      | 22 ++++++++++++++++++++++
 src/exchange/taler-exchange-httpd_responses.h      | 21 +++++++++++++++++++++
 src/exchangedb/exchange_do_deposit.sql             |  1 +
 ...exchange_do_insert_or_update_policy_details.sql |  6 +++---
 src/exchangedb/pg_do_deposit.c                     |  1 +
 src/include/taler_extensions_policy.h              |  2 ++
 7 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_db.c 
b/src/exchange/taler-exchange-httpd_db.c
index 5660074e..a00a9785 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -37,14 +37,14 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo 
*coin,
 {
   enum TALER_EXCHANGEDB_CoinKnownStatus cks;
   struct TALER_DenominationHashP h_denom_pub;
-  struct TALER_AgeCommitmentHash age_hash;
+  struct TALER_AgeCommitmentHash h_age_commitment;
 
   /* make sure coin is 'known' in database */
   cks = TEH_plugin->ensure_coin_known (TEH_plugin->cls,
                                        coin,
                                        known_coin_id,
                                        &h_denom_pub,
-                                       &age_hash);
+                                       &h_age_commitment);
   switch (cks)
   {
   case TALER_EXCHANGEDB_CKS_ADDED:
@@ -70,13 +70,12 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo 
*coin,
       &coin->coin_pub);
     return GNUNET_DB_STATUS_HARD_ERROR;
   case TALER_EXCHANGEDB_CKS_AGE_CONFLICT:
-    /* FIXME: insufficient_funds != Age conflict! See issue #7267, need new
-     * strategy for evidence gathering */
-    *mhd_ret = TEH_RESPONSE_reply_coin_insufficient_funds (
+    *mhd_ret = TEH_RESPONSE_reply_coin_age_commitment_conflict (
       connection,
       TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH,
       &h_denom_pub,
-      &coin->coin_pub);
+      &coin->coin_pub,
+      &h_age_commitment);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
   GNUNET_assert (0);
diff --git a/src/exchange/taler-exchange-httpd_responses.c 
b/src/exchange/taler-exchange-httpd_responses.c
index 322da387..c1aa9db6 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -177,6 +177,28 @@ TEH_RESPONSE_reply_coin_insufficient_funds (
 }
 
 
+MHD_RESULT
+TEH_RESPONSE_reply_coin_age_commitment_conflict (
+  struct MHD_Connection *connection,
+  enum TALER_ErrorCode ec,
+  const struct TALER_DenominationHashP *h_denom_pub,
+  const struct TALER_CoinSpendPublicKeyP *coin_pub,
+  const struct TALER_AgeCommitmentHash *h_age_commitment_hash)
+{
+  return TALER_MHD_REPLY_JSON_PACK (
+    connection,
+    TALER_ErrorCode_get_http_status_safe (ec),
+    TALER_JSON_pack_ec (ec),
+    GNUNET_JSON_pack_data_auto ("coin_pub",
+                                coin_pub),
+    GNUNET_JSON_pack_data_auto ("h_denom_pub",
+                                h_denom_pub),
+    GNUNET_JSON_pack_data_auto ("h_age_commitment_hash",
+                                h_age_commitment_hash)
+    );
+}
+
+
 MHD_RESULT
 TEH_RESPONSE_reply_reserve_insufficient_balance (
   struct MHD_Connection *connection,
diff --git a/src/exchange/taler-exchange-httpd_responses.h 
b/src/exchange/taler-exchange-httpd_responses.h
index 8adf1136..5fe106e1 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -159,6 +159,27 @@ TEH_RESPONSE_reply_coin_insufficient_funds (
   const struct TALER_DenominationHashP *h_denom_pub,
   const struct TALER_CoinSpendPublicKeyP *coin_pub);
 
+/**
+ * Send proof that a request is invalid to client because of
+ * a conflicting value for the age commitment hash of a coin.
+ * This function will create a message with the conflicting
+ * hash value for the age commitment of the given coin.
+ *
+ * @param connection connection to the client
+ * @param ec error code to return
+ * @param h_denom_pub hash of the denomination of the coin
+ * @param coin_pub public key of the coin
+ * @param h_age_commitment hash of the age commitment as found in the database
+ * @return MHD result code
+ */
+MHD_RESULT
+TEH_RESPONSE_reply_coin_age_commitment_conflict (
+  struct MHD_Connection *connection,
+  enum TALER_ErrorCode ec,
+  const struct TALER_DenominationHashP *h_denom_pub,
+  const struct TALER_CoinSpendPublicKeyP *coin_pub,
+  const struct TALER_AgeCommitmentHash *h_age_commitment);
+
 /**
  * Fundamental details about a purse.
  */
diff --git a/src/exchangedb/exchange_do_deposit.sql 
b/src/exchangedb/exchange_do_deposit.sql
index 1156c7de..7116117f 100644
--- a/src/exchangedb/exchange_do_deposit.sql
+++ b/src/exchangedb/exchange_do_deposit.sql
@@ -142,6 +142,7 @@ THEN
   IF NOT FOUND
   THEN
     -- Deposit exists, but with *strange* differences. Not allowed.
+    -- FIXME #8002:  Surely we need to provide the client more data in this 
case.
     out_conflict=TRUE;
     RETURN;
   END IF;
diff --git a/src/exchangedb/exchange_do_insert_or_update_policy_details.sql 
b/src/exchangedb/exchange_do_insert_or_update_policy_details.sql
index 53cd2989..85e52d3d 100644
--- a/src/exchangedb/exchange_do_insert_or_update_policy_details.sql
+++ b/src/exchangedb/exchange_do_insert_or_update_policy_details.sql
@@ -93,14 +93,14 @@ BEGIN
 
        -- Set the fulfillment_state according to the values.
        -- For now, we only update the state when it was INSUFFICIENT.
-       -- FIXME: What to do in case of Failure or other state?
-       IF (out_fullfillment_state = 1) -- INSUFFICIENT
+       -- FIXME[oec] #7999: What to do in case of Failure or other state?
+       IF (out_fullfillment_state = 2) -- INSUFFICIENT
        THEN
                IF (out_accumulated_total.val >= cur_commitment.val OR
                        (out_accumulated_total.val = cur_commitment.val AND
                                out_accumulated_total.frac >= 
cur_commitment.frac))
                THEN
-                       out_fulfillment_state = 2; -- READY
+                       out_fulfillment_state = 3; -- READY
                END IF;
        END IF;
 
diff --git a/src/exchangedb/pg_do_deposit.c b/src/exchangedb/pg_do_deposit.c
index 0ba45b62..64e7886a 100644
--- a/src/exchangedb/pg_do_deposit.c
+++ b/src/exchangedb/pg_do_deposit.c
@@ -83,6 +83,7 @@ TEH_PG_do_deposit (
       GNUNET_PQ_result_spec_uint32 ("insufficient_balance_coin_index",
                                     bad_balance_index),
       balance_ok),
+    /* FIXME #8002:  We need more data to communicate the conflict to the 
client */
     GNUNET_PQ_result_spec_bool ("conflicted",
                                 ctr_conflict),
     GNUNET_PQ_result_spec_end
diff --git a/src/include/taler_extensions_policy.h 
b/src/include/taler_extensions_policy.h
index 7750f58f..b10c0d8a 100644
--- a/src/include/taler_extensions_policy.h
+++ b/src/include/taler_extensions_policy.h
@@ -28,6 +28,8 @@
 
 /*
  * @brief Describes the states of fulfillment of a policy bound to a deposit
+ * NOTE: These values must be in sync with their use in stored procedures, f.e.
+ * exchange_do_insert_or_update_policy_details.
  */
 enum TALER_PolicyFulfillmentState
 {

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