gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: make annual policy upload limit


From: gnunet
Subject: [taler-anastasis] branch master updated: make annual policy upload limit configurable
Date: Fri, 19 Mar 2021 18:53:55 +0100

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 2b2dd00  make annual policy upload limit configurable
2b2dd00 is described below

commit 2b2dd005d43d64575e4124dda4aa41c9338ade65
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Mar 19 18:53:52 2021 +0100

    make annual policy upload limit configurable
---
 src/backend/anastasis-httpd.c               | 18 ++++++++++++++++++
 src/backend/anastasis-httpd.h               |  5 +++++
 src/backend/anastasis-httpd_policy_upload.c | 15 +--------------
 src/backend/anastasis.conf                  |  3 +++
 4 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 531de76..5204201 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -96,6 +96,11 @@ struct GNUNET_TIME_Relative AH_truth_expiration;
  */
 struct ANASTASIS_CRYPTO_ProviderSaltP AH_server_salt;
 
+/**
+ * Number of policy uploads permitted per annual fee payment.
+ */
+unsigned long long AH_post_counter = 64LLU;
+
 /**
  * Our context for making HTTP requests.
  */
@@ -757,6 +762,19 @@ run (void *cls,
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_number (config,
+                                             "anastasis",
+                                             "ANNUAL_POLICY_UPLOAD_LIMIT",
+                                             &AH_post_counter))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "anastasis",
+                               "FULFILLMENT_URL");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (config,
                                              "anastasis",
diff --git a/src/backend/anastasis-httpd.h b/src/backend/anastasis-httpd.h
index 6df9b56..85406ab 100644
--- a/src/backend/anastasis-httpd.h
+++ b/src/backend/anastasis-httpd.h
@@ -172,6 +172,11 @@ extern char *AH_currency;
  */
 extern const struct GNUNET_CONFIGURATION_Handle *AH_cfg;
 
+/**
+ * Number of policy uploads permitted per annual fee payment.
+ */
+extern unsigned long long AH_post_counter;
+
 /**
  * Our fulfillment URL
  */
diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index cc07d3b..5c7651d 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -284,17 +284,6 @@ make_payment_request (struct PolicyUploadContext *puc)
 }
 
 
-/**
- * FIXME: Is this reasonable?
- */
-unsigned int
-amount_to_post_counter (const struct TALER_Amount *amount)
-{
-  // FIXME: some logic to convert an amount to an unsigned integer (counter)
-  return 10;
-}
-
-
 /**
  * Callbacks of this type are used to serve the result of submitting a
  * POST /private/orders request to a merchant.
@@ -308,7 +297,6 @@ proposal_cb (void *cls,
 {
   struct PolicyUploadContext *puc = cls;
   enum GNUNET_DB_QueryStatus qs;
-  uint32_t post_counter;
 
   puc->po = NULL;
   GNUNET_CONTAINER_DLL_remove (puc_head,
@@ -343,10 +331,9 @@ proposal_cb (void *cls,
               "Storing payment request for order `%s'\n",
               por->details.ok.order_id);
 
-  post_counter = (uint32_t) amount_to_post_counter (&AH_annual_fee);
   qs = db->record_recdoc_payment (db->cls,
                                   &puc->account,
-                                  post_counter,
+                                  (uint32_t) AH_post_counter,
                                   &puc->payment_identifier,
                                   &AH_annual_fee);
   if (0 >= qs)
diff --git a/src/backend/anastasis.conf b/src/backend/anastasis.conf
index e43d5aa..a25fade 100644
--- a/src/backend/anastasis.conf
+++ b/src/backend/anastasis.conf
@@ -29,6 +29,9 @@ DB = postgres
 # Annual fee for an account
 # ANNUAL_FEE = TESTKUDOS:0.1
 
+# Number of policy uploads included in one annual fee payment
+ANNUAL_POLICY_UPLĂ„OAD_LIMIT = 64
+
 # Insurance
 # INSURANCE = TESTKUDOS:1.0
 

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