diff options
Diffstat (limited to 'src/escrow/plugin_escrow_gns.c')
-rw-r--r-- | src/escrow/plugin_escrow_gns.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c index 2d419caaf..eb37f75b3 100644 --- a/src/escrow/plugin_escrow_gns.c +++ b/src/escrow/plugin_escrow_gns.c | |||
@@ -257,6 +257,11 @@ struct ESCROW_GnsPluginOperation | |||
257 | uint8_t share_threshold; | 257 | uint8_t share_threshold; |
258 | 258 | ||
259 | /** | 259 | /** |
260 | * Share expiration time | ||
261 | */ | ||
262 | struct GNUNET_TIME_Relative share_expiration_time; | ||
263 | |||
264 | /** | ||
260 | * Continuation to be called with the restored private key | 265 | * Continuation to be called with the restored private key |
261 | */ | 266 | */ |
262 | PkContinuation restore_pk_cont; | 267 | PkContinuation restore_pk_cont; |
@@ -630,8 +635,7 @@ distribute_keyshares (struct ESCROW_PluginOperationWrapper *plugin_op_wrap, | |||
630 | curr_rd[0].data = keyshares[curr_pk->i]; | 635 | curr_rd[0].data = keyshares[curr_pk->i]; |
631 | curr_rd[0].record_type = GNUNET_GNSRECORD_TYPE_ESCROW_KEYSHARE; | 636 | curr_rd[0].record_type = GNUNET_GNSRECORD_TYPE_ESCROW_KEYSHARE; |
632 | curr_rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 637 | curr_rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
633 | // TODO: config param? | 638 | curr_rd[0].expiration_time = p_op->share_expiration_time.rel_value_us; |
634 | curr_rd[0].expiration_time = 30 * 24 * GNUNET_TIME_relative_get_hour_().rel_value_us; | ||
635 | 639 | ||
636 | curr_ns_qe->plugin_op_wrap = plugin_op_wrap; | 640 | curr_ns_qe->plugin_op_wrap = plugin_op_wrap; |
637 | curr_ns_qe->ns_qe = GNUNET_NAMESTORE_records_store (ns_h, | 641 | curr_ns_qe->ns_qe = GNUNET_NAMESTORE_records_store (ns_h, |
@@ -985,6 +989,7 @@ load_keyshare_config (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
985 | { | 989 | { |
986 | struct ESCROW_GnsPluginOperation *p_op; | 990 | struct ESCROW_GnsPluginOperation *p_op; |
987 | unsigned long long shares, share_threshold; | 991 | unsigned long long shares, share_threshold; |
992 | struct GNUNET_TIME_Relative share_expiration_time; | ||
988 | 993 | ||
989 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; | 994 | p_op = (struct ESCROW_GnsPluginOperation *)plugin_op_wrap->plugin_op; |
990 | 995 | ||
@@ -994,7 +999,7 @@ load_keyshare_config (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
994 | &shares)) | 999 | &shares)) |
995 | { | 1000 | { |
996 | handle_config_load_error (plugin_op_wrap, | 1001 | handle_config_load_error (plugin_op_wrap, |
997 | "Number of shares not specified in config!"); | 1002 | "Number of shares not specified in config!\n"); |
998 | return GNUNET_SYSERR; | 1003 | return GNUNET_SYSERR; |
999 | } | 1004 | } |
1000 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (p_op->h->cfg, | 1005 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (p_op->h->cfg, |
@@ -1003,11 +1008,21 @@ load_keyshare_config (struct ESCROW_PluginOperationWrapper *plugin_op_wrap) | |||
1003 | &share_threshold)) | 1008 | &share_threshold)) |
1004 | { | 1009 | { |
1005 | handle_config_load_error (plugin_op_wrap, | 1010 | handle_config_load_error (plugin_op_wrap, |
1006 | "Share threshold not specified in config"); | 1011 | "Share threshold not specified in config\n"); |
1012 | return GNUNET_SYSERR; | ||
1013 | } | ||
1014 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (p_op->h->cfg, | ||
1015 | "escrow", | ||
1016 | "gns_share_expiration_time", | ||
1017 | &share_expiration_time)) | ||
1018 | { | ||
1019 | handle_config_load_error (plugin_op_wrap, | ||
1020 | "Share expiration time not specified in config\n"); | ||
1007 | return GNUNET_SYSERR; | 1021 | return GNUNET_SYSERR; |
1008 | } | 1022 | } |
1009 | p_op->shares = (uint8_t)shares; | 1023 | p_op->shares = (uint8_t)shares; |
1010 | p_op->share_threshold = (uint8_t)share_threshold; | 1024 | p_op->share_threshold = (uint8_t)share_threshold; |
1025 | p_op->share_expiration_time.rel_value_us = share_expiration_time.rel_value_us; | ||
1011 | 1026 | ||
1012 | return GNUNET_OK; | 1027 | return GNUNET_OK; |
1013 | } | 1028 | } |