summaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-02-27 05:10:52 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-02-27 05:10:52 +0100
commitee3327de8fd04b2b8ce8692560c9f1d01a822baa (patch)
tree2c5e594ab5e123aa7b106cc04eb904de425ea04d /src/consensus
parent2d92ec0f27dbefef916e94f5d272a2ff72091c54 (diff)
fix set element type problem, make consensus work
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/consensus_protocol.h6
-rw-r--r--src/consensus/gnunet-service-consensus.c25
-rw-r--r--src/consensus/test_consensus.conf4
3 files changed, 23 insertions, 12 deletions
diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h
index fa445dc2e..e0002de56 100644
--- a/src/consensus/consensus_protocol.h
+++ b/src/consensus/consensus_protocol.h
@@ -123,6 +123,12 @@ struct ConsensusSizeElement
uint8_t sender_index;
};
+struct ConsensusStuffedElement
+{
+ struct ConsensusElement ce GNUNET_PACKED;
+ struct GNUNET_HashCode rand GNUNET_PACKED;
+};
+
GNUNET_NETWORK_STRUCT_END
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,
if (NULL != element)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "P%u: got element of type %u, status %u\n",
+ session->local_peer_idx,
+ (unsigned) element->element_type,
+ (unsigned) status);
GNUNET_assert (GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT == element->element_type);
consensus_element = element->data;
}
@@ -1371,21 +1376,21 @@ commit_set (struct ConsensusSession *session,
}
for (i = 0; i < evil.num; i++)
{
- struct GNUNET_HashCode hash;
struct GNUNET_SET_Element element;
- element.data = &hash;
- element.size = sizeof (struct GNUNET_HashCode);
- element.element_type = 0;
+ struct ConsensusStuffedElement se = { 0 };
+ element.data = &se;
+ element.size = sizeof (struct ConsensusStuffedElement);
+ element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT;
if (EVILNESS_SUB_REPLACEMENT == evil.subtype)
{
/* Always generate a new element. */
- GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &hash);
+ GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &se.rand);
}
else if (EVILNESS_SUB_NO_REPLACEMENT == evil.subtype)
{
/* Always cram the same elements, derived from counter. */
- GNUNET_CRYPTO_hash (&i, sizeof (i), &hash);
+ GNUNET_CRYPTO_hash (&i, sizeof (i), &se.rand);
}
else
{
@@ -2103,8 +2108,8 @@ task_start_reconcile (struct TaskEntry *task)
session->local_peer_idx, task->key.peer2, debug_str_set_key (&setop->input_set));
struct GNUNET_SET_Option opts[] = {
- {GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } },
- {0},
+ { GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } },
+ { GNUNET_SET_OPTION_END },
};
// XXX: maybe this should be done while
@@ -2539,8 +2544,8 @@ set_listen_cb (void *cls,
(task->key.peer2 == session->local_peer_idx)));
struct GNUNET_SET_Option opts[] = {
- {GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } },
- {0},
+ { GNUNET_SET_OPTION_BYZANTINE, { .num = session->lower_bound } },
+ { GNUNET_SET_OPTION_END },
};
task->cls.setop.op = GNUNET_SET_accept (request,
diff --git a/src/consensus/test_consensus.conf b/src/consensus/test_consensus.conf
index c3077b65d..c75205739 100644
--- a/src/consensus/test_consensus.conf
+++ b/src/consensus/test_consensus.conf
@@ -5,7 +5,7 @@ GNUNET_TEST_HOME = /tmp/test-consensus/
#OPTIONS = -L INFO
BINARY = gnunet-service-evil-consensus
-PREFIX = valgrind
+#PREFIX = valgrind
#EVIL_SPEC = 0;cram-all;noreplace;5
#EVIL_SPEC = 0;cram;5/1;cram;5
@@ -41,7 +41,7 @@ OPTIONS = -LERROR
[set]
#OPTIONS = -L INFO
#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind
+PREFIX = valgrind
[testbed]
OVERLAY_TOPOLOGY = CLIQUE