diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index ef83f305c..e7fc16506 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -673,9 +673,14 @@ TEH_KS_acquire_ (const char *location) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading keys from `%s'\n", TEH_exchange_directory); - TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory, - &reload_keys_denom_iter, - key_state); + if (-1 == TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory, + &reload_keys_denom_iter, + key_state)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Can't load denomination keys.\n"); + GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex)); + return NULL; + } TALER_EXCHANGEDB_signing_keys_iterate (TEH_exchange_directory, &reload_keys_sign_iter, key_state); @@ -693,6 +698,14 @@ TEH_KS_acquire_ (const char *location) return NULL; } + if (0 == GNUNET_CONTAINER_multihashmap_size (key_state->denomkey_map)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Have no denomination keys. Bad configuration.\n"); + GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex)); + return NULL; + } + ks.purpose.size = htonl (sizeof (ks)); ks.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET); ks.list_issue_date = GNUNET_TIME_absolute_hton (key_state->reload_time);