aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/revocation/revocation_api.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 721c40c2a..39fdb8b6f 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -483,7 +483,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
483 for (unsigned int i = 0; i < POW_COUNT; i++) 483 for (unsigned int i = 0; i < POW_COUNT; i++)
484 { 484 {
485 pow_val = GNUNET_ntohll (pow->pow[i]); 485 pow_val = GNUNET_ntohll (pow->pow[i]);
486 GNUNET_memcpy (buf, &pow_val, sizeof(uint64_t)); 486 GNUNET_memcpy (buf, &pow->pow[i], sizeof(uint64_t));
487 GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work", 487 GNUNET_CRYPTO_pow_hash ("gnunet-revocation-proof-of-work",
488 buf, 488 buf,
489 sizeof(buf), 489 sizeof(buf),
@@ -619,6 +619,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
619 struct GNUNET_HashCode result; 619 struct GNUNET_HashCode result;
620 unsigned int zeros; 620 unsigned int zeros;
621 int ret; 621 int ret;
622 uint64_t pow_nbo;
622 623
623 pc->current_pow++; 624 pc->current_pow++;
624 625
@@ -628,8 +629,8 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
628 for (unsigned int i = 0; i < POW_COUNT; i++) 629 for (unsigned int i = 0; i < POW_COUNT; i++)
629 if (pc->current_pow == pc->best[i].pow) 630 if (pc->current_pow == pc->best[i].pow)
630 return GNUNET_NO; 631 return GNUNET_NO;
631 632 pow_nbo = GNUNET_htonll (pc->current_pow);
632 GNUNET_memcpy (buf, &pc->current_pow, sizeof(uint64_t)); 633 GNUNET_memcpy (buf, &pow_nbo, sizeof(uint64_t));
633 GNUNET_memcpy (&buf[sizeof(uint64_t)], 634 GNUNET_memcpy (&buf[sizeof(uint64_t)],
634 &pc->pow->timestamp, 635 &pc->pow->timestamp,
635 sizeof (uint64_t)); 636 sizeof (uint64_t));
@@ -647,7 +648,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc)
647 { 648 {
648 pc->best[i].bits = zeros; 649 pc->best[i].bits = zeros;
649 pc->best[i].pow = pc->current_pow; 650 pc->best[i].pow = pc->current_pow;
650 pc->pow->pow[i] = GNUNET_htonll (pc->current_pow); 651 pc->pow->pow[i] = pow_nbo;
651 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 652 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
652 "New best score %u with %" PRIu64 " (#%u)\n", 653 "New best score %u with %" PRIu64 " (#%u)\n",
653 zeros, pc->current_pow, i); 654 zeros, pc->current_pow, i);