fix use of struct TALER_DenominationKeyValidityPS

This commit is contained in:
Christian Grothoff 2015-03-28 18:23:45 +01:00
parent 576545daeb
commit 98cbd77432
2 changed files with 32 additions and 1 deletions

View File

@ -53,6 +53,11 @@ GNUNET_NETWORK_STRUCT_BEGIN
*/
struct CoinTypeNBOP
{
/**
* How long are the signatures legally valid?
*/
struct GNUNET_TIME_RelativeNBO duration_legal;
/**
* How long can the coin be spend?
*/
@ -97,6 +102,13 @@ GNUNET_NETWORK_STRUCT_END
struct CoinTypeParams
{
/**
* How long are the signatures legally valid? Should be
* significantly larger than @e duration_spend (i.e. years).
*/
struct GNUNET_TIME_Relative duration_legal;
/**
* How long can the coin be spend? Should be significantly
* larger than @e duration_withdraw (i.e. years).
@ -232,6 +244,7 @@ hash_coin_type (const struct CoinTypeParams *p,
0,
sizeof (struct CoinTypeNBOP));
p_nbo.duration_spend = GNUNET_TIME_relative_hton (p->duration_spend);
p_nbo.duration_legal = GNUNET_TIME_relative_hton (p->duration_legal);
p_nbo.duration_withdraw = GNUNET_TIME_relative_hton (p->duration_withdraw);
TALER_amount_hton (&p_nbo.value,
&p->value);
@ -605,6 +618,19 @@ get_cointype_params (const char *ct,
}
ROUND_TO_SECS (params->duration_spend,
rel_value_us);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (kcfg,
ct,
"duration_legal",
&params->duration_legal))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
ct,
"duration_legal");
return GNUNET_SYSERR;
}
ROUND_TO_SECS (params->duration_legal,
rel_value_us);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (kcfg,
ct,
@ -720,6 +746,9 @@ create_denomkey_issue (const struct CoinTypeParams *params,
dki->issue.expire_spend =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
params->duration_spend));
dki->issue.expire_legal =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
params->duration_legal));
TALER_amount_hton (&dki->issue.value,
&params->value);
TALER_amount_hton (&dki->issue.fee_withdraw,

View File

@ -138,6 +138,8 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_withdraw)),
"stamp_expire_deposit",
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_spend)),
"stamp_expire_legal",
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_legal)),
"denom_pub",
TALER_json_from_rsa_public_key (pk->rsa_public_key),
"value",