-fix assertion failure caused by testcase

This commit is contained in:
Christian Grothoff 2021-08-06 10:20:58 +02:00
parent c71c40d4d6
commit caf6807856
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 39 additions and 2 deletions

View File

@ -980,6 +980,16 @@ denomination_info_cb (
struct TEH_KeyStateHandle *ksh = cls; struct TEH_KeyStateHandle *ksh = cls;
struct TEH_DenominationKey *dk; struct TEH_DenominationKey *dk;
if ( (0 == meta->start.abs_value_us) ||
(0 == meta->expire_withdraw.abs_value_us) ||
(0 == meta->expire_deposit.abs_value_us) ||
(0 == meta->expire_legal.abs_value_us) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Database contains invalid denomination key %s\n",
GNUNET_h2s (h_denom_pub));
return;
}
dk = GNUNET_new (struct TEH_DenominationKey); dk = GNUNET_new (struct TEH_DenominationKey);
dk->denom_pub.rsa_public_key dk->denom_pub.rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_dup (denom_pub->rsa_public_key); = GNUNET_CRYPTO_rsa_public_key_dup (denom_pub->rsa_public_key);

View File

@ -2753,6 +2753,14 @@ postgres_insert_denomination_info (
}; };
(void) cls; (void) cls;
GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
issue->properties.start).abs_value_us);
GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
issue->properties.expire_withdraw).abs_value_us);
GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
issue->properties.expire_deposit).abs_value_us);
GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
issue->properties.expire_legal).abs_value_us);
/* check fees match coin currency */ /* check fees match coin currency */
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TALER_amount_cmp_currency_nbo (&issue->properties.value, TALER_amount_cmp_currency_nbo (&issue->properties.value,

View File

@ -81,8 +81,27 @@ struct InsertDepositState
static void static void
fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue) fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{ {
memset (issue, 0, sizeof (struct struct GNUNET_TIME_Absolute now;
TALER_EXCHANGEDB_DenominationKeyInformationP));
memset (issue,
0,
sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP));
now = GNUNET_TIME_absolute_get ();
(void) GNUNET_TIME_round_abs (&now);
issue->properties.start
= GNUNET_TIME_absolute_hton (now);
issue->properties.expire_withdraw
= GNUNET_TIME_absolute_hton (
GNUNET_TIME_absolute_add (now,
GNUNET_TIME_UNIT_MINUTES));
issue->properties.expire_deposit
= GNUNET_TIME_absolute_hton (
GNUNET_TIME_absolute_add (now,
GNUNET_TIME_UNIT_HOURS));
issue->properties.expire_legal
= GNUNET_TIME_absolute_hton (
GNUNET_TIME_absolute_add (now,
GNUNET_TIME_UNIT_DAYS));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount_nbo ("EUR:1", TALER_string_to_amount_nbo ("EUR:1",
&issue->properties.value)); &issue->properties.value));