preparations for #5536

This commit is contained in:
Christian Grothoff 2019-02-14 13:41:46 +01:00
parent 9ff3c2fce5
commit e56ed85f4f
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 73 additions and 2 deletions

View File

@ -1503,7 +1503,14 @@ make_fresh_key_state ()
destroy_response_factory (&rfc);
return NULL;
}
#if FIX_FOR_5536
/* Once we no longer get expired DKIs from
TALER_EXCHANGEDB_denomination_keys_iterate(),
we must fetch the information from the database! */
qs = TEH_plugin->iterate_denomination_info (TEH_plugin->cls,
&reload_public_denoms_cb,
&rfc);
#endif
/* Initialize `current_sign_key_issue` and `rfc.sign_keys_array` */
TALER_EXCHANGEDB_signing_keys_iterate (TEH_exchange_directory,
&reload_keys_sign_iter,

View File

@ -151,6 +151,12 @@ TALER_EXCHANGEDB_denomination_key_read (const char *filename,
data,
offset);
GNUNET_free (data);
if (0 == GNUNET_TIME_absolute_get_remaining
(GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw)).rel_value_us)
{
/* FIXME: #5536: we should delete this file, the
private key is no longer needed (and return SYSERR!) */
}
return GNUNET_OK;
}

View File

@ -73,6 +73,12 @@ signkeys_iterate_dir_iter (void *cls,
(unsigned int) sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP));
return GNUNET_OK;
}
if (0 == GNUNET_TIME_absolute_get_remaining
(GNUNET_TIME_absolute_ntoh (issue.issue.expire)).rel_value_us)
{
/* FIXME: #5536: we should delete this file, the
private key is no longer needed (and return SYSERR!) */
}
return skc->it (skc->it_cls,
filename,
&issue);

View File

@ -1980,6 +1980,31 @@ postgres_get_denomination_info (void *cls,
}
/**
* Fetch information about all known denomination keys.
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param cb function to call on each denomination key
* @param cb_cls closure for @a cb
* @return transaction status code
*/
static enum GNUNET_DB_QueryStatus
postgres_iterate_denomination_info (void *cls,
TALER_EXCHANGEDB_DenominationInfoIterator cb,
void *cb_cls)
{
#if 0
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_end
};
#endif
GNUNET_break (0); // not implemented! #5536
return GNUNET_DB_STATUS_HARD_ERROR;
}
/**
* Get the summary of a reserve.
*
@ -7099,6 +7124,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->rollback = &postgres_rollback;
plugin->insert_denomination_info = &postgres_insert_denomination_info;
plugin->get_denomination_info = &postgres_get_denomination_info;
plugin->iterate_denomination_info = &postgres_iterate_denomination_info;
plugin->reserve_get = &postgres_reserve_get;
plugin->reserves_in_insert = &postgres_reserves_in_insert;
plugin->get_latest_reserve_in_reference = &postgres_get_latest_reserve_in_reference;

View File

@ -711,7 +711,6 @@ typedef int
int done);
/**
* Callback used to process data of a merchant under KYC monitoring.
*
@ -1139,6 +1138,19 @@ typedef void
/* bool? */ int done);
/**
* Function called with information about the exchange's denomination keys.
*
* @parma cls closure
* @param denom_pub public key of the denomination
* @param issue detailed information about the denomination (value, expiration times, fees)
*/
typedef void
(*TALER_EXCHANGEDB_DenominationInfoIterator)(void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue);
/**
* @brief The plugin API, returned from the plugin's "init" function.
* The argument given to "init" is simply a configuration handle.
@ -1273,6 +1285,20 @@ struct TALER_EXCHANGEDB_Plugin
struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue);
/**
* Function called on every known denomination key. Runs in its
* own read-only transaction (hence no session provided).
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param cb function to call on each denomination key
* @param cb_cls closure for @a cb
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
(*iterate_denomination_info) (void *cls,
TALER_EXCHANGEDB_DenominationInfoIterator cb,
void *cb_cls);
/**
* Get the summary of a reserve.
*