exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit f5d7653ef09193a37f9ebdb09dbe5c425652f1c8
parent f6fe309f5dbfd9680bea7738e2e15caaa0953080
Author: Florian Dold <florian.dold@gmail.com>
Date:   Fri, 25 Nov 2016 16:25:33 +0100

refuse to start if we have no denominations

Diffstat:
Msrc/exchange/taler-exchange-httpd_keystate.c | 19++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git 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);