diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-08-29 23:22:17 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-08-29 23:22:17 +0200 |
commit | 394cacf9fdb640c59a41ee60a233b4e3cce44aad (patch) | |
tree | 581800a26a80cd505d6a88489c259ffd1122f49a /src/consensus/plugin_block_consensus.c | |
parent | 94fa99870bce6f8bf87b37b15b538a9164dff50f (diff) | |
download | gnunet-394cacf9fdb640c59a41ee60a233b4e3cce44aad.tar.gz gnunet-394cacf9fdb640c59a41ee60a233b4e3cce44aad.zip |
-mild refactoring of consensus, cleaning up the code a bit
Diffstat (limited to 'src/consensus/plugin_block_consensus.c')
-rw-r--r-- | src/consensus/plugin_block_consensus.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/consensus/plugin_block_consensus.c b/src/consensus/plugin_block_consensus.c index fb6da5bcd..cdac12ed5 100644 --- a/src/consensus/plugin_block_consensus.c +++ b/src/consensus/plugin_block_consensus.c | |||
@@ -58,13 +58,12 @@ block_plugin_consensus_evaluate (void *cls, | |||
58 | const void *reply_block, | 58 | const void *reply_block, |
59 | size_t reply_block_size) | 59 | size_t reply_block_size) |
60 | { | 60 | { |
61 | if (reply_block_size < sizeof(struct ConsensusElement)) | ||
62 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
63 | |||
64 | const struct ConsensusElement *ce = reply_block; | 61 | const struct ConsensusElement *ce = reply_block; |
65 | 62 | ||
66 | if ((0 != ce->marker) || | 63 | if (reply_block_size < sizeof(struct ConsensusElement)) |
67 | (0 == ce->payload_type)) | 64 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
65 | if ( (0 != ce->marker) || | ||
66 | (0 == ce->payload_type) ) | ||
68 | return GNUNET_BLOCK_EVALUATION_OK_MORE; | 67 | return GNUNET_BLOCK_EVALUATION_OK_MORE; |
69 | 68 | ||
70 | return GNUNET_BLOCK_evaluate (ctx, | 69 | return GNUNET_BLOCK_evaluate (ctx, |
@@ -75,8 +74,8 @@ block_plugin_consensus_evaluate (void *cls, | |||
75 | xquery, | 74 | xquery, |
76 | xquery_size, | 75 | xquery_size, |
77 | &ce[1], | 76 | &ce[1], |
78 | reply_block_size - sizeof(struct | 77 | reply_block_size |
79 | ConsensusElement)); | 78 | - sizeof(struct ConsensusElement)); |
80 | } | 79 | } |
81 | 80 | ||
82 | 81 | ||