merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit b5222ad829c41ea9be890113e94ba6a96fcaedbc
parent cea6fc540c1038877b6ea8b14a4014d192aae515
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  9 Dec 2017 19:57:34 +0100

fix issues related to unrounded times

Diffstat:
Msrc/backend/taler-merchant-httpd_exchanges.c | 6++++--
Msrc/backend/taler-merchant-httpd_history.c | 2+-
Msrc/backenddb/plugin_merchantdb_postgres.c | 3++-
Msrc/backenddb/test_merchantdb.c | 7++++---
4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c @@ -789,6 +789,7 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange, { struct Exchange *exchange; struct TMH_EXCHANGES_FindOperation *fo; + struct GNUNET_TIME_Absolute now; if (NULL == merchant_curl_ctx) { @@ -840,11 +841,12 @@ TMH_EXCHANGES_find_exchange (const char *chosen_exchange, GNUNET_CONTAINER_DLL_insert (exchange->fo_head, exchange->fo_tail, fo); - + now = GNUNET_TIME_absolute_get (); + (void) GNUNET_TIME_round_abs (&now); if ( (GNUNET_YES != exchange->pending) && ( (NULL == fo->wire_method) || (NULL != get_wire_fees (exchange, - GNUNET_TIME_absolute_get (), + now, fo->wire_method)) ) ) { /* We are not currently waiting for a reply, immediately diff --git a/src/backend/taler-merchant-httpd_history.c b/src/backend/taler-merchant-httpd_history.c @@ -137,7 +137,7 @@ MH_handler_history (struct TMH_RequestHandler *rh, MHD_GET_ARGUMENT_KIND, "date"); date = GNUNET_TIME_absolute_get (); - + (void) GNUNET_TIME_round_abs (&date); if (NULL != str) { if (1 != sscanf (str, diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c @@ -2663,6 +2663,7 @@ postgres_enable_tip_reserve (void *cls, }; now = GNUNET_TIME_absolute_get (); + (void) GNUNET_TIME_round_abs (&now); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_tip_credit_uuid", params); @@ -2895,7 +2896,7 @@ postgres_authorize_tip (void *cls, GNUNET_PQ_query_param_end }; - GNUNET_TIME_round_abs (&now); + (void) GNUNET_TIME_round_abs (&now); qs = GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_tip_justification", params); diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c @@ -392,6 +392,7 @@ test_wire_fee () RND_BLK (&h_wire_method); RND_BLK (&exchange_sig); date1 = GNUNET_TIME_absolute_get (); + (void) GNUNET_TIME_abs_round (&date1); date2 = GNUNET_TIME_absolute_add (date1, GNUNET_TIME_UNIT_DAYS); date3 = GNUNET_TIME_absolute_add (date2, @@ -799,11 +800,11 @@ run (void *cls) RND_BLK (&merchant_pub); RND_BLK (&wtid); timestamp = GNUNET_TIME_absolute_get (); - GNUNET_TIME_round_abs (&timestamp); + (void) GNUNET_TIME_round_abs (&timestamp); delta = GNUNET_TIME_UNIT_MINUTES; fake_now = GNUNET_TIME_absolute_add (timestamp, delta); refund_deadline = GNUNET_TIME_absolute_get(); - GNUNET_TIME_round_abs (&refund_deadline); + (void) GNUNET_TIME_round_abs (&refund_deadline); GNUNET_assert (GNUNET_OK == TALER_string_to_amount (CURRENCY ":5", &amount_with_fee)); @@ -894,7 +895,7 @@ run (void *cls) &pd_cb, NULL)); timestamp = GNUNET_TIME_absolute_get (); - GNUNET_TIME_round_abs (&timestamp); + (void) GNUNET_TIME_round_abs (&timestamp); FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != plugin->insert_contract_terms (plugin->cls,