diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-27 05:10:52 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-27 05:10:52 +0100 |
commit | ee3327de8fd04b2b8ce8692560c9f1d01a822baa (patch) | |
tree | 2c5e594ab5e123aa7b106cc04eb904de425ea04d /src/consensus/gnunet-service-consensus.c | |
parent | 2d92ec0f27dbefef916e94f5d272a2ff72091c54 (diff) | |
download | gnunet-ee3327de8fd04b2b8ce8692560c9f1d01a822baa.tar.gz gnunet-ee3327de8fd04b2b8ce8692560c9f1d01a822baa.zip |
fix set element type problem, make consensus work
Diffstat (limited to 'src/consensus/gnunet-service-consensus.c')
-rw-r--r-- | src/consensus/gnunet-service-consensus.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index 8b02031fd..6662ae8ca 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c | |||
@@ -915,6 +915,11 @@ set_result_cb (void *cls, | |||
915 | 915 | ||
916 | if (NULL != element) | 916 | if (NULL != element) |
917 | { | 917 | { |
918 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
919 | "P%u: got element of type %u, status %u\n", | ||
920 | session->local_peer_idx, | ||
921 | (unsigned) element->element_type, | ||
922 | (unsigned) status); | ||
918 | GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type); | 923 | GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type); |
919 | consensus_element = element->data; | 924 | consensus_element = element->data; |
920 | } | 925 | } |
@@ -1371,21 +1376,21 @@ commit_set (struct ConsensusSession *session, | |||
1371 | } | 1376 | } |
1372 | for (i = 0; i < evil.num; i++) | 1377 | for (i = 0; i < evil.num; i++) |
1373 | { | 1378 | { |
1374 | struct GNUNET_HashCode hash; | ||
1375 | struct GNUNET_SET_Element element; | 1379 | struct GNUNET_SET_Element element; |
1376 | element.data = &hash; | 1380 | struct ConsensusStuffedElement se = { 0 }; |
1377 | element.size = sizeof (struct GNUNET_HashCode); | 1381 | element.data = &se; |
1378 | element.element_type = 0; | 1382 | element.size = sizeof (struct ConsensusStuffedElement); |
1383 | element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT; | ||
1379 | 1384 | ||
1380 | if (EVILNESS_SUB_REPLACEMENT == evil.subtype) | 1385 | if (EVILNESS_SUB_REPLACEMENT == evil.subtype) |
1381 | { | 1386 | { |
1382 | /* Always generate a new element. */ | 1387 | /* Always generate a new element. */ |
1383 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &hash); | 1388 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &se.rand); |
1384 | } | 1389 | } |
1385 | else if (EVILNESS_SUB_NO_REPLACEMENT == evil.subtype) | 1390 | else if (EVILNESS_SUB_NO_REPLACEMENT == evil.subtype) |
1386 | { | 1391 | { |
1387 | /* Always cram the same elements, derived from counter. */ | 1392 | /* Always cram the same elements, derived from counter. */ |
1388 | GNUNET_CRYPTO_hash (&i, sizeof (i), &hash); | 1393 | GNUNET_CRYPTO_hash (&i, sizeof (i), &se.rand); |
1389 | } | 1394 | } |
1390 | else | 1395 | else |
1391 | { | 1396 | { |
@@ -2103,8 +2108,8 @@ task_start_reconcile (struct TaskEntry *task) | |||
2103 | session->local_peer_idx, task->key.peer2, debug_str_set_key (&setop->input_set)); | 2108 | session->local_peer_idx, task->key.peer2, debug_str_set_key (&setop->input_set)); |
2104 | 2109 | ||
2105 | struct GNUNET_SET_Option opts[] = { | 2110 | struct GNUNET_SET_Option opts[] = { |
2106 | {GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } }, | 2111 | { GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } }, |
2107 | {0}, | 2112 | { GNUNET_SET_OPTION_END }, |
2108 | }; | 2113 | }; |
2109 | 2114 | ||
2110 | // XXX: maybe this should be done while | 2115 | // XXX: maybe this should be done while |
@@ -2539,8 +2544,8 @@ set_listen_cb (void *cls, | |||
2539 | (task->key.peer2 == session->local_peer_idx))); | 2544 | (task->key.peer2 == session->local_peer_idx))); |
2540 | 2545 | ||
2541 | struct GNUNET_SET_Option opts[] = { | 2546 | struct GNUNET_SET_Option opts[] = { |
2542 | {GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } }, | 2547 | { GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } }, |
2543 | {0}, | 2548 | { GNUNET_SET_OPTION_END }, |
2544 | }; | 2549 | }; |
2545 | 2550 | ||
2546 | task->cls.setop.op = GNUNET_SET_accept (request, | 2551 | task->cls.setop.op = GNUNET_SET_accept (request, |