From 644b53a34dfde4c8693458cacea4b2f7015d8fc3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 14 Dec 2021 19:45:35 +0100 Subject: -fix FTBFS for Taler protocol v11 --- src/backend/anastasis-httpd_policy_upload.c | 2 +- src/backend/anastasis-httpd_truth.c | 10 +++++----- src/backend/anastasis-httpd_truth_upload.c | 31 +++++++++++++++-------------- 3 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src/backend') diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c index b9ab266..4c86241 100644 --- a/src/backend/anastasis-httpd_policy_upload.c +++ b/src/backend/anastasis-httpd_policy_upload.c @@ -974,7 +974,7 @@ AH_handler_policy_post ( &version); now = GNUNET_TIME_timestamp_get (); if (GNUNET_TIME_timestamp_cmp (puc->paid_until, - (<), + <, now)) puc->paid_until = now; rem = GNUNET_TIME_absolute_get_difference (puc->paid_until.abs_time, diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c index cbf13be..6c05ef8 100644 --- a/src/backend/anastasis-httpd_truth.c +++ b/src/backend/anastasis-httpd_truth.c @@ -1651,11 +1651,11 @@ AH_handler_truth_get ( break; } - if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration ( - transmission_date.abs_time), - (<), - gc->authorization-> - code_retransmission_frequency) ) + if (GNUNET_TIME_relative_cmp ( + GNUNET_TIME_absolute_get_duration ( + transmission_date.abs_time), + <, + gc->authorization->code_retransmission_frequency) ) { /* Too early for a retransmission! */ GNUNET_free (decrypted_truth); diff --git a/src/backend/anastasis-httpd_truth_upload.c b/src/backend/anastasis-httpd_truth_upload.c index e4bce9c..ddf645c 100644 --- a/src/backend/anastasis-httpd_truth_upload.c +++ b/src/backend/anastasis-httpd_truth_upload.c @@ -526,7 +526,7 @@ AH_handler_truth_post ( const char *type; enum GNUNET_DB_QueryStatus qs; uint32_t storage_years; - struct GNUNET_TIME_Absolute paid_until; + struct GNUNET_TIME_Timestamp paid_until; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("key_share_data", &key_share_data), @@ -703,11 +703,11 @@ AH_handler_truth_post ( if (0 != TALER_amount_cmp (&AH_truth_upload_fee, &zero_amount)) { - struct GNUNET_TIME_Absolute desired_until; + struct GNUNET_TIME_Timestamp desired_until; enum GNUNET_DB_QueryStatus qs; desired_until - = GNUNET_TIME_relative_to_absolute ( + = GNUNET_TIME_relative_to_timestamp ( GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, storage_years)); qs = db->check_truth_upload_paid (db->cls, @@ -719,16 +719,16 @@ AH_handler_truth_post ( TALER_EC_GENERIC_DB_FETCH_FAILED, NULL); if ( (0 == qs) || - (paid_until.abs_value_us < desired_until.abs_value_us) ) + (GNUNET_TIME_timestamp_cmp (paid_until, + <, + desired_until) ) ) { - struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Relative rem; - now = GNUNET_TIME_absolute_get (); - if (paid_until.abs_value_us < now.abs_value_us) - paid_until = now; - rem = GNUNET_TIME_absolute_get_difference (paid_until, - desired_until); + if (GNUNET_TIME_absolute_is_past (paid_until.abs_time)) + paid_until = GNUNET_TIME_timestamp_get (); + rem = GNUNET_TIME_absolute_get_difference (paid_until.abs_time, + desired_until.abs_time); tuc->years_to_pay = rem.rel_value_us / GNUNET_TIME_UNIT_YEARS.rel_value_us; if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us)) @@ -755,16 +755,16 @@ AH_handler_truth_post ( } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TRUTH paid until %s (%d)!\n", - GNUNET_STRINGS_relative_time_to_string ( + GNUNET_TIME_relative2s ( GNUNET_TIME_absolute_get_remaining ( - paid_until), + paid_until.abs_time), GNUNET_YES), qs); } else { paid_until - = GNUNET_TIME_relative_to_absolute ( + = GNUNET_TIME_relative_to_timestamp ( GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, ANASTASIS_MAX_YEARS_STORAGE)); } @@ -773,7 +773,7 @@ AH_handler_truth_post ( GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Storing truth until %s!\n", - GNUNET_STRINGS_absolute_time_to_string (paid_until)); + GNUNET_TIME_timestamp2s (paid_until)); qs = db->store_truth (db->cls, truth_uuid, &key_share_data, @@ -783,7 +783,8 @@ AH_handler_truth_post ( encrypted_truth, encrypted_truth_size, type, - GNUNET_TIME_absolute_get_remaining (paid_until)); + GNUNET_TIME_absolute_get_remaining ( + paid_until.abs_time)); switch (qs) { case GNUNET_DB_STATUS_HARD_ERROR: -- cgit v1.2.3