gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: working on keys fix db


From: gnunet
Subject: [taler-donau] branch master updated: working on keys fix db
Date: Mon, 25 Mar 2024 22:19:40 +0100

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

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 8e57d46  working on keys fix db
8e57d46 is described below

commit 8e57d4605d996b3f51feccf5d9e39301d603a922
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Mon Mar 25 22:18:36 2024 +0100

    working on keys fix db
---
 src/donau/.gitignore                       | 22 +++++++--------
 src/donau/donau-httpd_keys.c               | 43 +++++++++++++++---------------
 src/donaudb/0002-donau_receipts_issued.sql |  2 +-
 3 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/src/donau/.gitignore b/src/donau/.gitignore
index 1e98805..fab2861 100644
--- a/src/donau/.gitignore
+++ b/src/donau/.gitignore
@@ -1,13 +1,13 @@
-taler-donau-dbinit
-taler-donau-keycheck
-taler-donau-keyup
-taler-donau-pursemod
-taler-donau-reservemod
-taler-donau-httpd
-taler-donau-wirewatch
+donau-dbinit
+donau-keycheck
+donau-keyup
+donau-pursemod
+donau-reservemod
+donau-httpd
+donau-wirewatch
 test_taler_donau_wirewatch-postgres
 test_taler_donau_httpd_home/.config/taler/account-1.json
-taler-donau-closer
-taler-donau-transfer
-taler-donau-router
-taler-donau-expire
+donau-closer
+donau-transfer
+donau-router
+donau-expire
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index b6fbb0e..aaa0b8a 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -473,9 +473,9 @@ insert_donation_unit_cb (void *cls,
         DONAU_JSON_pack_donation_unit_pub ("donation_unit_pub",
                                            &du->donation_unit_pub),
         GNUNET_JSON_pack_uint64 ("year",
-                                 du->validity_year),
-        TALER_JSON_pack_amount ("value",
-                                &du->value)
+                                 du->validity_year) // ,
+        // TALER_JSON_pack_amount ("value", // FIXME
+        //                         &du->value)
         )));
   return GNUNET_OK;
 }
@@ -488,23 +488,22 @@ insert_donation_unit_cb (void *cls,
  * @param[in,out] ksh key state handle we build @a ksh for
  * @param[in] du_keys_hash hash over all the denomination keys in @a denoms
  * @param[in,out] signkeys list of sign keys to return
- * @param[in,out] grouped_donation_units list of grouped denominations to 
return
+ * @param[in,out] donation_units list of grouped denominations to return
  * @return #GNUNET_OK on success
  */
 static enum GNUNET_GenericReturnValue
 create_keys_response (struct DH_KeyStateHandle *ksh,
-                      const struct GNUNET_HashCode *du_keys_hash,
                       json_t *signkeys,
-                      json_t *grouped_donation_units)
+                      json_t *donation_units)
 {
   struct DONAU_DonauPublicKeyP donau_pub;
   // struct DONAU_DonauSignatureP donau_sig;
   json_t *keys;
 
   GNUNET_assert (NULL != signkeys);
-  GNUNET_assert (NULL != grouped_donation_units);
+  GNUNET_assert (NULL != donation_units);
   GNUNET_assert (NULL != DH_currency);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Creating /keys response");
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Creating /keys response\n");
 
   /* Sign hash over master signatures of all denomination keys until this time
      (in reverse order). */
@@ -548,9 +547,9 @@ create_keys_response (struct DH_KeyStateHandle *ksh,
     GNUNET_JSON_pack_array_incref ("signkeys",
                                    signkeys),
     GNUNET_JSON_pack_array_incref ("donation_units",
-                                   grouped_donation_units),
-    GNUNET_JSON_pack_data_auto ("donau_pub",
-                                &donau_pub)); // ,
+                                   donation_units)); // ,
+  // GNUNET_JSON_pack_data_auto ("donau_pub",
+  //                               &donau_pub)); // ,
   // GNUNET_JSON_pack_data_auto ("donau_sig",
   //                             &donau_sig));
   GNUNET_assert (NULL != keys);
@@ -651,12 +650,12 @@ static enum GNUNET_GenericReturnValue
 finish_keys_response (struct DH_KeyStateHandle *ksh)
 {
   enum GNUNET_GenericReturnValue ret = GNUNET_SYSERR;
-  json_t *grouped_donation_units = NULL;
-  struct GNUNET_HashContext *hash_context = NULL;
   struct KeysBuilderContext kbc;
 
   kbc.signkeys = json_array ();
+  kbc.donation_units = json_array ();
   GNUNET_assert (NULL != kbc.signkeys);
+  GNUNET_assert (NULL != kbc.donation_units);
 
   GNUNET_CONTAINER_multipeermap_iterate (ksh->signkey_map,
                                          &add_sign_key_cb,
@@ -674,9 +673,13 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
                                          &insert_donation_unit_cb,
                                          &kbc);
 
-
-  grouped_donation_units = json_array ();
-  GNUNET_assert (NULL != grouped_donation_units);
+  if (0 == json_array_size (kbc.donation_units))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "No donation units available. Refusing to generate /keys 
response.\n");
+    ret = GNUNET_NO;
+    goto CLEANUP;
+  }
 
   {
     struct DH_DonationUnitKey *dk;
@@ -691,7 +694,7 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
     //      create_keys_response (ksh,
     //                  &hc,
     //                  kbc.signkeys,
-    //                  grouped_donation_units))
+    //                  donation_units))
     //  {
     //    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
     //                "Failed to generate key response data\n");
@@ -701,11 +704,8 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
     // }
   }
 
-  struct GNUNET_HashCode hc;
-  GNUNET_CRYPTO_hash_context_finish (hash_context, &hc);
   if (GNUNET_OK !=
       create_keys_response (ksh,
-                            &hc,
                             kbc.signkeys,
                             kbc.donation_units))
   {
@@ -717,7 +717,8 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
   ret = GNUNET_OK;
 
 CLEANUP:
-  // json_decref (grouped_donation_units);
+  if (NULL != kbc.donation_units)
+    json_decref (kbc.donation_units);
   if (NULL != kbc.signkeys)
     json_decref (kbc.signkeys);
   return ret;
diff --git a/src/donaudb/0002-donau_receipts_issued.sql 
b/src/donaudb/0002-donau_receipts_issued.sql
index 4f76fdb..2b5a1db 100644
--- a/src/donaudb/0002-donau_receipts_issued.sql
+++ b/src/donaudb/0002-donau_receipts_issued.sql
@@ -23,7 +23,7 @@ CREATE TABLE receipts_issued
   );
 COMMENT ON TABLE receipts_issued
   IS 'Table containing the issued blinded donation receipts to the charity.';
-COMMENT ON COLUMN receipts_issued.charity_sig
+COMMENT ON COLUMN receipts_issued.blinded_sig
   IS 'Signature from the charity.';
 COMMENT ON COLUMN receipts_issued.receipt_hash
   IS 'Hash value over all the blinded donation receipt received plus the hash 
of the donation units public key.';

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