diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-04-22 17:10:22 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-04-22 17:10:22 +0200 |
commit | c4fa48421916ff0777e9cf1bbb3b83634392a494 (patch) | |
tree | 1b8d0de90bc03cc022baa89297ea7cbe759eeb42 /src/revocation | |
parent | 1b57b570605c9145647e7ce62d43a5387efe9419 (diff) | |
download | gnunet-c4fa48421916ff0777e9cf1bbb3b83634392a494.tar.gz gnunet-c4fa48421916ff0777e9cf1bbb3b83634392a494.zip |
add epochs CLI parameter
Diffstat (limited to 'src/revocation')
-rw-r--r-- | src/revocation/gnunet-revocation.c | 21 |
1 files changed, 16 insertions, 5 deletions
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 | |||
@@ -59,6 +59,11 @@ static char *revoke_ego; | |||
59 | static char *test_ego; | 59 | static char *test_ego; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * -e option. | ||
63 | */ | ||
64 | static unsigned int epochs = 1; | ||
65 | |||
66 | /** | ||
62 | * Handle for revocation query. | 67 | * Handle for revocation query. |
63 | */ | 68 | */ |
64 | static struct GNUNET_REVOCATION_Query *q; | 69 | static struct GNUNET_REVOCATION_Query *q; |
@@ -333,7 +338,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
333 | } | 338 | } |
334 | GNUNET_IDENTITY_ego_get_public_key (ego, &key); | 339 | GNUNET_IDENTITY_ego_get_public_key (ego, &key); |
335 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 340 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
336 | memset(&proof_of_work, 0, sizeof (proof_of_work)); | 341 | memset (&proof_of_work, 0, sizeof (proof_of_work)); |
337 | if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && | 342 | if ((NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) && |
338 | (sizeof(proof_of_work) == | 343 | (sizeof(proof_of_work) == |
339 | GNUNET_DISK_fn_read (filename, &proof_of_work, sizeof(proof_of_work)))) | 344 | 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) | |||
363 | */ | 368 | */ |
364 | fprintf (stderr, | 369 | fprintf (stderr, |
365 | "%s", | 370 | "%s", |
366 | _("Continuing calculation where left off...\n")); | 371 | _ ("Continuing calculation where left off...\n")); |
367 | ph = GNUNET_REVOCATION_pow_start (&proof_of_work, | 372 | ph = GNUNET_REVOCATION_pow_start (&proof_of_work, |
368 | 1, /* Epochs */ | 373 | epochs, |
369 | matching_bits); | 374 | matching_bits); |
370 | } | 375 | } |
371 | fprintf (stderr, | 376 | fprintf (stderr, |
@@ -376,7 +381,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
376 | GNUNET_REVOCATION_pow_init (privkey, | 381 | GNUNET_REVOCATION_pow_init (privkey, |
377 | &proof_of_work); | 382 | &proof_of_work); |
378 | ph = GNUNET_REVOCATION_pow_start (&proof_of_work, | 383 | ph = GNUNET_REVOCATION_pow_start (&proof_of_work, |
379 | 1, /* Epochs */ | 384 | epochs, /* Epochs */ |
380 | matching_bits); | 385 | matching_bits); |
381 | } | 386 | } |
382 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); | 387 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); |
@@ -475,7 +480,7 @@ run (void *cls, | |||
475 | { | 480 | { |
476 | struct GNUNET_REVOCATION_PowCalculationHandle *ph; | 481 | struct GNUNET_REVOCATION_PowCalculationHandle *ph; |
477 | ph = GNUNET_REVOCATION_pow_start (&proof_of_work, | 482 | ph = GNUNET_REVOCATION_pow_start (&proof_of_work, |
478 | 1, /* Epochs */ | 483 | epochs, /* Epochs */ |
479 | matching_bits); | 484 | matching_bits); |
480 | 485 | ||
481 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); | 486 | pow_task = GNUNET_SCHEDULER_add_now (&calculate_pow, ph); |
@@ -528,6 +533,12 @@ main (int argc, char *const *argv) | |||
528 | gettext_noop ( | 533 | gettext_noop ( |
529 | "test if the public key KEY has been revoked"), | 534 | "test if the public key KEY has been revoked"), |
530 | &test_ego), | 535 | &test_ego), |
536 | GNUNET_GETOPT_option_uint ('e', | ||
537 | "epochs", | ||
538 | "EPOCHS", | ||
539 | gettext_noop ( | ||
540 | "number of epochs to calculate for"), | ||
541 | &epochs), | ||
531 | 542 | ||
532 | GNUNET_GETOPT_OPTION_END | 543 | GNUNET_GETOPT_OPTION_END |
533 | }; | 544 | }; |