From: Schanzenbach, Martin Date: Wed, 22 Apr 2020 15:10:22 +0000 (+0200) Subject: add epochs CLI parameter X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fheads%2Fschanzen%2Fargon_pow;p=oweals%2Fgnunet.git add epochs CLI parameter --- diff --git a/doc/man/gnunet-revocation.1 b/doc/man/gnunet-revocation.1 index 0c447a94f..05d80178a 100644 --- a/doc/man/gnunet-revocation.1 +++ b/doc/man/gnunet-revocation.1 @@ -30,6 +30,7 @@ .Sh SYNOPSIS .Nm .Op Fl t Ar KEY | Fl -test= Ns Ar KEY +.Op Fl e Ar EPOCHS | Fl -epochs= Ns Ar EPOCHS .Op Fl R Ar NAME | Fl -revoke= Ns Ar NAME .Op Fl p | -perform .Op Fl f Ar NAME | Fl -filename= Ns Ar NAME @@ -50,6 +51,8 @@ Depending on your CPU, the calculation can take days or weeks. .Bl -tag -width indent .It Fl t Ar KEY | Fl -test= Ns Ar KEY Check if the given KEY (ASCII-encoded public key required) has been revoked. +.It Fl e Ar EPOCHS | Fl -epochs= Ns Ar EPOCHS +Number of epochs for which the revocation should be valid (default: 1) .It Fl R Ar NAME | Fl -revoke= Ns Ar NAME Calculate or perform revocation for the ego with the given NAME. .It Fl p | -perform diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index de9560172..19fd5ab2c 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c @@ -58,6 +58,11 @@ static char *revoke_ego; */ static char *test_ego; +/** + * -e option. + */ +static unsigned int epochs = 1; + /** * Handle for revocation query. */ @@ -333,7 +338,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) } GNUNET_IDENTITY_ego_get_public_key (ego, &key); privkey = GNUNET_IDENTITY_ego_get_private_key (ego); - memset(&proof_of_work, 0, sizeof (proof_of_work)); + memset (&proof_of_work, 0, sizeof (proof_of_work)); if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && (sizeof(proof_of_work) == GNUNET_DISK_fn_read (filename, &proof_of_work, sizeof(proof_of_work)))) @@ -363,9 +368,9 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) */ fprintf (stderr, "%s", - _("Continuing calculation where left off...\n")); + _ ("Continuing calculation where left off...\n")); ph = GNUNET_REVOCATION_pow_start (&proof_of_work, - 1, /* Epochs */ + epochs, matching_bits); } fprintf (stderr, @@ -376,7 +381,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) GNUNET_REVOCATION_pow_init (privkey, &proof_of_work); ph = GNUNET_REVOCATION_pow_start (&proof_of_work, - 1, /* Epochs */ + epochs, /* Epochs */ matching_bits); } pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); @@ -475,7 +480,7 @@ run (void *cls, { struct GNUNET_REVOCATION_PowCalculationHandle *ph; ph = GNUNET_REVOCATION_pow_start (&proof_of_work, - 1, /* Epochs */ + epochs, /* Epochs */ matching_bits); pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); @@ -528,6 +533,12 @@ main (int argc, char *const *argv) gettext_noop ( "test if the public key KEY has been revoked"), &test_ego), + GNUNET_GETOPT_option_uint ('e', + "epochs", + "EPOCHS", + gettext_noop ( + "number of epochs to calculate for"), + &epochs), GNUNET_GETOPT_OPTION_END };