gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] 01/05: compute reserve expiration time pro


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 01/05: compute reserve expiration time properly
Date: Wed, 04 Apr 2018 18:12:25 +0200

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

dold pushed a commit to branch master
in repository merchant.

commit 15301040f769d586d86cef6b202ac6ea4ac70e4d
Author: Florian Dold <address@hidden>
AuthorDate: Tue Apr 3 23:25:27 2018 +0200

    compute reserve expiration time properly
---
 src/backend/taler-merchant-httpd_tip-query.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_tip-query.c 
b/src/backend/taler-merchant-httpd_tip-query.c
index bdf93be..99e24a6 100644
--- a/src/backend/taler-merchant-httpd_tip-query.c
+++ b/src/backend/taler-merchant-httpd_tip-query.c
@@ -192,7 +192,7 @@ handle_status (void *cls,
                const struct TALER_EXCHANGE_ReserveHistory *history)
 {
   struct TipQueryContext *tqc = cls;
-  struct GNUNET_TIME_Absolute expiration;
+  struct GNUNET_TIME_Absolute reserve_expiration = GNUNET_TIME_UNIT_ZERO_ABS;
 
   tqc->rsh = NULL;
   if (MHD_HTTP_OK != http_status)
@@ -246,9 +246,13 @@ handle_status (void *cls,
       {
         enum GNUNET_DB_QueryStatus qs;
         struct GNUNET_HashCode uuid;
+        struct GNUNET_TIME_Absolute deposit_expiration;
 
-        expiration = GNUNET_TIME_absolute_add 
(history[i].details.in_details.timestamp,
-                                               
tqc->idle_reserve_expiration_time);
+        deposit_expiration = GNUNET_TIME_absolute_add 
(history[i].details.in_details.timestamp,
+                                                       
tqc->idle_reserve_expiration_time);
+        /* We're interested in the latest DEPOSIT timestamp, since this 
determines the
+         * reserve's expiration date. Note that the history isn't 
chronologically ordered. */
+        reserve_expiration = GNUNET_TIME_absolute_max (reserve_expiration, 
deposit_expiration);
         GNUNET_CRYPTO_hash (history[i].details.in_details.wire_reference,
                             history[i].details.in_details.wire_reference_size,
                             &uuid);
@@ -256,7 +260,7 @@ handle_status (void *cls,
                                      &tqc->reserve_priv,
                                      &uuid,
                                      &history[i].amount,
-                                     expiration);
+                                     deposit_expiration);
         if (GNUNET_OK !=
             TALER_amount_add (&tqc->amount_deposited,
                               &tqc->amount_deposited,
@@ -331,7 +335,7 @@ handle_status (void *cls,
                                                        "reserve_pub",
                                                        
GNUNET_JSON_from_data_auto (&reserve_pub),
                                                        "reserve_expiration",
-                                                       
GNUNET_JSON_from_time_abs (expiration),
+                                                       
GNUNET_JSON_from_time_abs (reserve_expiration),
                                                        "amount_authorized",
                                                        TALER_JSON_from_amount 
(&tqc->amount_authorized),
                                                        "amount_picked_up",

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



reply via email to

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