summaryrefslogtreecommitdiff
path: root/src/exchangedb/perf_taler_exchangedb_init.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-11-30 17:17:37 +0100
committerChristian Grothoff <christian@grothoff.org>2017-11-30 17:17:37 +0100
commit5540747ca2e5f37f2df504d689b850d1078fcdc5 (patch)
tree0e8be904bdedfe74a7cf78e1c27f7edc614c6301 /src/exchangedb/perf_taler_exchangedb_init.c
parent78b77ee8d515c80ac85ca7af59e3e82c2baaeb68 (diff)
downloadexchange-5540747ca2e5f37f2df504d689b850d1078fcdc5.tar.gz
exchange-5540747ca2e5f37f2df504d689b850d1078fcdc5.tar.bz2
exchange-5540747ca2e5f37f2df504d689b850d1078fcdc5.zip
patch to address #5183: always round time before giving it to DB, tolerate DB answering without rounded time
Diffstat (limited to 'src/exchangedb/perf_taler_exchangedb_init.c')
-rw-r--r--src/exchangedb/perf_taler_exchangedb_init.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/exchangedb/perf_taler_exchangedb_init.c b/src/exchangedb/perf_taler_exchangedb_init.c
index 412853980..4efec3911 100644
--- a/src/exchangedb/perf_taler_exchangedb_init.c
+++ b/src/exchangedb/perf_taler_exchangedb_init.c
@@ -59,15 +59,18 @@ PERF_TALER_EXCHANGEDB_denomination_init ()
{/* properties */
struct TALER_Amount amount;
+ struct GNUNET_TIME_Absolute now;
properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
properties.purpose.size = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
GNUNET_CRYPTO_eddsa_key_get_public (master_prvt,
&properties.master.eddsa_pub);
- properties.start = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get());
- properties.expire_withdraw = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_forever_());
- properties.expire_deposit = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_forever_());
- properties.expire_legal = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_forever_());
+ now = GNUNET_TIME_absolute_get();
+ (void) GNUNET_TIME_round_abs (&now);
+ properties.start = GNUNET_TIME_absolute_hton (now);
+ properties.expire_withdraw = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
+ properties.expire_deposit = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
+ properties.expire_legal = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.1", &amount));
TALER_amount_hton (&properties.value, &amount);
@@ -164,7 +167,7 @@ PERF_TALER_EXCHANGEDB_reserve_init ()
&reserve->reserve.pub.eddsa_pub);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1000", &reserve->reserve.balance));
- reserve->reserve.expiry = GNUNET_TIME_absolute_get_forever_ ();
+ reserve->reserve.expiry = GNUNET_TIME_UNIT_FOREVER_ABS;
return reserve;
}
@@ -256,7 +259,9 @@ PERF_TALER_EXCHANGEDB_deposit_init (const struct PERF_TALER_EXCHANGEDB_Coin *coi
GNUNET_free (eddsa_prv);
}
timestamp = GNUNET_TIME_absolute_get ();
+ (void) GNUNET_TIME_round_abs (&timestamp);
refund_deadline = GNUNET_TIME_absolute_get ();
+ (void) GNUNET_TIME_round_abs (&refund_deadline);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.1",
&amount_with_fee));